Skip to content

Commit 7943f06

Browse files
committed
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
2 parents 622a3ed + cfb10de commit 7943f06

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

arch/riscv/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,7 @@ config IRQ_STACKS
777777
config THREAD_SIZE_ORDER
778778
int "Kernel stack size (in power-of-two numbers of page size)" if VMAP_STACK && EXPERT
779779
range 0 4
780-
default 1 if 32BIT && !KASAN
781-
default 3 if 64BIT && KASAN
780+
default 1 if 32BIT
782781
default 2
783782
help
784783
Specify the Pages of thread stack size (from 4KB to 64KB), which also

arch/riscv/include/asm/thread_info.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
#include <linux/sizes.h>
1414

1515
/* thread information allocation */
16-
#define THREAD_SIZE_ORDER CONFIG_THREAD_SIZE_ORDER
16+
#ifdef CONFIG_KASAN
17+
#define KASAN_STACK_ORDER 1
18+
#else
19+
#define KASAN_STACK_ORDER 0
20+
#endif
21+
#define THREAD_SIZE_ORDER (CONFIG_THREAD_SIZE_ORDER + KASAN_STACK_ORDER)
1722
#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
1823

1924
/*

drivers/perf/riscv_pmu_legacy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ static int pmu_legacy_ctr_get_idx(struct perf_event *event)
2222
struct perf_event_attr *attr = &event->attr;
2323

2424
if (event->attr.type != PERF_TYPE_HARDWARE)
25-
return -EOPNOTSUPP;
25+
return -ENOENT;
2626
if (attr->config == PERF_COUNT_HW_CPU_CYCLES)
2727
return RISCV_PMU_LEGACY_CYCLE;
2828
else if (attr->config == PERF_COUNT_HW_INSTRUCTIONS)
2929
return RISCV_PMU_LEGACY_INSTRET;
3030
else
31-
return -EOPNOTSUPP;
31+
return -ENOENT;
3232
}
3333

3434
/* For legacy config & counter index are same */

drivers/perf/riscv_pmu_sbi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static void pmu_sbi_check_event(struct sbi_pmu_event_data *edata)
309309
ret.value, 0x1, SBI_PMU_STOP_FLAG_RESET, 0, 0, 0);
310310
} else if (ret.error == SBI_ERR_NOT_SUPPORTED) {
311311
/* This event cannot be monitored by any counter */
312-
edata->event_idx = -EINVAL;
312+
edata->event_idx = -ENOENT;
313313
}
314314
}
315315

@@ -556,7 +556,7 @@ static int pmu_sbi_event_map(struct perf_event *event, u64 *econfig)
556556
}
557557
break;
558558
default:
559-
ret = -EINVAL;
559+
ret = -ENOENT;
560560
break;
561561
}
562562

0 commit comments

Comments
 (0)