Commit 8581ae1e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull RISC-V fixes from Palmer Dabbelt:

 - Two fixes for smp_processor_id() calls in preemptible sections: one
   if the perf driver, and one in the fence.i prctl.

* tag 'riscv-for-linus-6.11-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: Disable preemption while handling PR_RISCV_CTX_SW_FENCEI_OFF
  drivers: perf: Fix smp_processor_id() use in preemptible code
parents 5abfdfd4 7c1e5b96
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@ void __init riscv_init_cbo_blocksizes(void)
#ifdef CONFIG_SMP
static void set_icache_stale_mask(void)
{
	int cpu = get_cpu();
	cpumask_t *mask;
	bool stale_cpu;

@@ -168,10 +169,11 @@ static void set_icache_stale_mask(void)
	 * concurrently on different harts.
	 */
	mask = &current->mm->context.icache_stale_mask;
	stale_cpu = cpumask_test_cpu(smp_processor_id(), mask);
	stale_cpu = cpumask_test_cpu(cpu, mask);

	cpumask_setall(mask);
	cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu);
	cpumask_assign_cpu(cpu, mask, stale_cpu);
	put_cpu();
}
#endif

@@ -239,14 +241,12 @@ int riscv_set_icache_flush_ctx(unsigned long ctx, unsigned long scope)
	case PR_RISCV_CTX_SW_FENCEI_OFF:
		switch (scope) {
		case PR_RISCV_SCOPE_PER_PROCESS:
			current->mm->context.force_icache_flush = false;

			set_icache_stale_mask();
			current->mm->context.force_icache_flush = false;
			break;
		case PR_RISCV_SCOPE_PER_THREAD:
			current->thread.force_icache_flush = false;

			set_icache_stale_mask();
			current->thread.force_icache_flush = false;
			break;
		default:
			return -EINVAL;
+6 −1
Original line number Diff line number Diff line
@@ -1373,11 +1373,15 @@ static int pmu_sbi_device_probe(struct platform_device *pdev)

	/* SBI PMU Snapsphot is only available in SBI v2.0 */
	if (sbi_v2_available) {
		int cpu;

		ret = pmu_sbi_snapshot_alloc(pmu);
		if (ret)
			goto out_unregister;

		ret = pmu_sbi_snapshot_setup(pmu, smp_processor_id());
		cpu = get_cpu();

		ret = pmu_sbi_snapshot_setup(pmu, cpu);
		if (ret) {
			/* Snapshot is an optional feature. Continue if not available */
			pmu_sbi_snapshot_free(pmu);
@@ -1391,6 +1395,7 @@ static int pmu_sbi_device_probe(struct platform_device *pdev)
			 */
			static_branch_enable(&sbi_pmu_snapshot_available);
		}
		put_cpu();
	}

	register_sysctl("kernel", sbi_pmu_sysctl_table);