1

RISC-V Fixes for 6.12-rc2

* PERF_TYPE_BREAKPOINT now returns -EOPNOTSUPP instead of -ENOENT, which
   aligns to other ports and is a saner value.
 * The KASAN-related stack size increasing logic has been moved to a
   C header, to avoid dependency issues.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEKzw3R0RoQ7JKlDp6LhMZ81+7GIkFAmb/+C8THHBhbG1lckBk
 YWJiZWx0LmNvbQAKCRAuExnzX7sYicPGD/4z/Z2Jk8h0nQY4E+dr6OIRuHHzrghx
 BzZSI41eFbfw//SjGmr4s0lFhr7MNYiXMvnIwATpJ8iemBmGdutVnKE/wtkrYmCg
 FCoduapfhKpzbrIeOZVKcw0w33DVnoBSZ8kaT+soazCk3j8isBemSqu9bY9/wWbW
 u7SZmSbusd7DNWYSkm+pF0wWUgJ+dgeo8eDSbMB8zgLQvnFvJVGqMpE14N1PatFd
 BCyNZLhWUVoLf17tm0tcPNu/ZblV1La0wt6QLTum30IXrq70RI0QnSifw+l26P+x
 ABcDt/AwDunEX9GopbfV2LL/sgoYyfOff7RhR5v5dNc8V+rAY83efCyzLuz9gJ8N
 GepHz9sY5nm2w0bqL6T9SyakYiULAqoy6uhWUTfQTXGOejuV8JLY9YdHJ1t31sFP
 iO9BAN/7pOuB48Q20zTfMJ1SBrYH17SeP6fuEeoI9QWZ5mWeEx4RCGfAM4XfA6W7
 yQFIvKBel0x6bO8pJ3xJ1U+K1Dza/zJSVdnzcPRRPNIN9TF8E4wbnKZ2/fsLoqRi
 bmiKx8ZCk6YHKUuGb6aGYk+UgT+V5/Zegkt9n3fNnIacxBhKkxUnwtSbX2qQNlin
 CYOOo9EmtmjIpCsMHe6Edn3wFhBQKWzai7B+PjqutydG3bRnJ2fHh5djC0H9XNG2
 J+k/1IOV2IYmzg==
 =kB+2
 -----END PGP SIGNATURE-----

Merge tag 'riscv-for-linus-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:

 - PERF_TYPE_BREAKPOINT now returns -EOPNOTSUPP instead of -ENOENT,
   which aligns to other ports and is a saner value

 - The KASAN-related stack size increasing logic has been moved to a C
   header, to avoid dependency issues

* tag 'riscv-for-linus-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: Fix kernel stack size when KASAN is enabled
  drivers/perf: riscv: Align errno for unsupported perf event
This commit is contained in:
Linus Torvalds 2024-10-04 12:16:51 -07:00
commit 7943f06cfc
4 changed files with 11 additions and 7 deletions

View File

@ -777,8 +777,7 @@ config IRQ_STACKS
config THREAD_SIZE_ORDER
int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
range 0 4
default 1 if 32BIT && !KASAN
default 3 if 64BIT && KASAN
default 1 if 32BIT
default 2
help
Specify the Pages of thread stack size (from 4KB to 64KB), which also

View File

@ -13,7 +13,12 @@
#include <linux/sizes.h>
/* thread information allocation */
#define THREAD_SIZE_ORDER CONFIG_THREAD_SIZE_ORDER
#ifdef CONFIG_KASAN
#define KASAN_STACK_ORDER 1
#else
#define KASAN_STACK_ORDER 0
#endif
#define THREAD_SIZE_ORDER (CONFIG_THREAD_SIZE_ORDER + KASAN_STACK_ORDER)
#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
/*

View File

@ -22,13 +22,13 @@ static int pmu_legacy_ctr_get_idx(struct perf_event *event)
struct perf_event_attr *attr = &event->attr;
if (event->attr.type != PERF_TYPE_HARDWARE)
return -EOPNOTSUPP;
return -ENOENT;
if (attr->config == PERF_COUNT_HW_CPU_CYCLES)
return RISCV_PMU_LEGACY_CYCLE;
else if (attr->config == PERF_COUNT_HW_INSTRUCTIONS)
return RISCV_PMU_LEGACY_INSTRET;
else
return -EOPNOTSUPP;
return -ENOENT;
}
/* For legacy config & counter index are same */

View File

@ -309,7 +309,7 @@ static void pmu_sbi_check_event(struct sbi_pmu_event_data *edata)
ret.value, 0x1, SBI_PMU_STOP_FLAG_RESET, 0, 0, 0);
} else if (ret.error == SBI_ERR_NOT_SUPPORTED) {
/* This event cannot be monitored by any counter */
edata->event_idx = -EINVAL;
edata->event_idx = -ENOENT;
}
}
@ -556,7 +556,7 @@ static int pmu_sbi_event_map(struct perf_event *event, u64 *econfig)
}
break;
default:
ret = -EINVAL;
ret = -ENOENT;
break;
}