linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org,
	Kan Liang <kan.liang@linux.intel.com>,
	x86@kernel.org
Subject: Re: [tip: perf/core] perf/x86: Reset the dirty counter to prevent the leak for an RDPMC task
Date: Fri, 16 Apr 2021 18:45:39 +0200	[thread overview]
Message-ID: <YHm/M4za2LpRYePw@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <161858530850.29796.5870405530830102241.tip-bot2@tip-bot2>

On Fri, Apr 16, 2021 at 03:01:48PM -0000, tip-bot2 for Kan Liang wrote:
> @@ -2331,6 +2367,9 @@ static void x86_pmu_event_unmapped(struct perf_event *event, struct mm_struct *m
>  	if (!(event->hw.flags & PERF_X86_EVENT_RDPMC_ALLOWED))
>  		return;
>  
> +	if (x86_pmu.sched_task && event->hw.target)
> +		perf_sched_cb_dec(event->ctx->pmu);
> +
>  	if (atomic_dec_and_test(&mm->context.perf_rdpmc_allowed))
>  		on_each_cpu_mask(mm_cpumask(mm), cr4_update_pce, NULL, 1);
>  }

'perf test' on a kernel with CONFIG_DEBUG_PREEMPT=y gives:

[  244.439538] BUG: using smp_processor_id() in preemptible [00000000] code: perf/1771
[  244.448144] caller is perf_sched_cb_dec+0xa/0x70
[  244.453314] CPU: 28 PID: 1771 Comm: perf Not tainted 5.12.0-rc3-00026-gb04c0cddff6d #595
[  244.462347] Hardware name: Intel Corporation S2600GZ/S2600GZ, BIOS SE5C600.86B.02.02.0002.122320131210 12/23/2013
[  244.473804] Call Trace:
[  244.476535]  dump_stack+0x6d/0x89
[  244.480237]  check_preemption_disabled+0xc8/0xd0
[  244.485394]  perf_sched_cb_dec+0xa/0x70
[  244.489677]  x86_pmu_event_unmapped+0x35/0x60
[  244.494541]  perf_mmap_close+0x76/0x580
[  244.498833]  remove_vma+0x31/0x70
[  244.502535]  __do_munmap+0x2e8/0x4e0
[  244.506531]  __vm_munmap+0x7e/0x120
[  244.510429]  __x64_sys_munmap+0x28/0x30
[  244.514712]  do_syscall_64+0x33/0x80
[  244.518701]  entry_SYSCALL_64_after_hwframe+0x44/0xae


Obviously I tested that after I pushed it out :/


  reply	other threads:[~2021-04-16 16:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 14:36 [PATCH V4 1/2] perf/x86: Move cpuc->running into P4 specific code kan.liang
2021-04-14 14:36 ` [PATCH V4 2/2] perf/x86: Reset the dirty counter to prevent the leak for an RDPMC task kan.liang
2021-04-16 15:01   ` [tip: perf/core] " tip-bot2 for Kan Liang
2021-04-16 16:45     ` Peter Zijlstra [this message]
2021-04-16 19:50       ` Liang, Kan
2021-04-16 15:01 ` [tip: perf/core] perf/x86: Move cpuc->running into P4 specific code tip-bot2 for Kan Liang
2021-06-14 17:59 [RESEND PATCH V8] perf/x86: Reset the dirty counter to prevent the leak for an RDPMC task kan.liang
2021-06-18  8:46 ` [tip: perf/core] " tip-bot2 for Kan Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHm/M4za2LpRYePw@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).