linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-perf-users@vger.kernel.org,
	open list <linux-kernel@vger.kernel.org>,
	regressions@lists.linux.dev, lkft-triage@lists.linaro.org,
	Ravi Bangoria <ravi.bangoria@amd.com>,
	Stephane Eranian <eranian@google.com>,
	Sandipan Das <sandipan.das@amd.com>
Subject: Re: Perf: BUG: kernel NULL pointer dereference, address: 0000000000000198
Date: Thu, 3 Nov 2022 17:15:30 +0530	[thread overview]
Message-ID: <cb40c209-9c4c-f645-8454-bcd74cb72405@amd.com> (raw)
In-Reply-To: <5bec4620-2e2b-abe0-1e82-528c084d4d16@amd.com>

On 26-Oct-22 3:35 PM, Ravi Bangoria wrote:
> On 25-Oct-22 6:36 PM, Ravi Bangoria wrote:
>> On 25-Oct-22 9:59 AM, Ravi Bangoria wrote:
>>> On 20-Oct-22 12:24 PM, Naresh Kamboju wrote:
>>>> Following kernel BUG noticed while running perf testing on qemu-x86-64.
>>>
>>> Thanks Naresh. I'm aware of the crash[1] but haven't got a chance to
>>> root cause it. Let me try to spend some time on it.
>>
>> I tried to mimic https://lkft.validation.linaro.org/scheduler/job/5708609.
>> However, I don't see a way to download lava-guest.qcow2. So I just used
>> rootfs and kernel:
>>
>>   /usr/bin/qemu-system-x86_64 -cpu host -enable-kvm -nographic -net nic,model=virtio,macaddr=DE:AD:BE:EF:66:20 -net user -m 1024 -monitor none -kernel bzImage --append "root=/dev/sda  rootwait console=ttyS0,115200" -hda lkft-console-image-intel-corei7-64-20221019172733.rootfs.ext4 -m 4096 -smp 4 -nographic
>>
>> And I ran perf test inside the guest, which ran fine.
> 
> Running perf test in a loop reproduced the issue after some iterations.

Sorry was distracted a bit. So, this seems to be happening because of
race between amd_pmu_enable_all() and perf event NMI. Something like:

  amd_pmu_enable_all()
  {
      if (!test_bit(idx, cpuc->active_mask))

  --->/* perf NMI entry */
      ...
      x86_pmu_stop() {
          __clear_bit(hwc->idx, cpuc->active_mask);
          cpuc->events[hwc->idx] = NULL;
      }
      ...
  <---/* perf NMI exit */

      amd_pmu_enable_event(cpuc->events[idx]);
  }

Thanks,
Ravi

  reply	other threads:[~2022-11-03 11:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  6:54 Perf: BUG: kernel NULL pointer dereference, address: 0000000000000198 Naresh Kamboju
2022-10-25  4:29 ` Ravi Bangoria
2022-10-25 13:06   ` Ravi Bangoria
2022-10-26 10:05     ` Ravi Bangoria
2022-11-03 11:45       ` Ravi Bangoria [this message]
2022-11-03 12:33         ` Peter Zijlstra
2022-11-03 16:12           ` Ravi Bangoria
2022-11-07 10:29             ` Ravi Bangoria
2022-11-14  4:40               ` [PATCH] perf/x86/amd: Fix crash due to race between amd_pmu_enable_all, perf NMI and throttling Ravi Bangoria

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=cb40c209-9c4c-f645-8454-bcd74cb72405@amd.com \
    --to=ravi.bangoria@amd.com \
    --cc=acme@kernel.org \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=mingo@redhat.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=peterz@infradead.org \
    --cc=regressions@lists.linux.dev \
    --cc=sandipan.das@amd.com \
    /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).