public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Shanker Donthineni <sdonthineni@nvidia.com>
Cc: James Morse <james.morse@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	Rohit Mathew <Rohit.Mathew@arm.com>,
	Vikram Sethi <vsethi@nvidia.com>
Subject: Re: [PATCH v2 1/1] drivers/perf: Fix kernel panic due to the invalid mon_ctx pointer
Date: Fri, 27 Oct 2023 11:27:07 +0100	[thread overview]
Message-ID: <20231027102707.GA7899@willie-the-truck> (raw)
In-Reply-To: <20231026233443.3493667-1-sdonthineni@nvidia.com>

On Thu, Oct 26, 2023 at 06:34:43PM -0500, Shanker Donthineni wrote:
> The return pointer from the resctrl_arch_mon_ctx_alloc_no_wait() function
> is saved in a 32-bit variable 'hwc->idx' which results in the loss of
> the upper 32 bits. This, in turn, triggers a kernel panic when attempting
> to access a corrupted pointer.
> 
> Use 'event->pmu_private' instead of 'hwc->idx' to resolve the issue.
> 
> Another reason contributing to the problem due to continuous 'error irq'
> messages. The resctrl_arch_mon_ctx_alloc_no_wait() function returns a valid
> PTR when it cannot allocate monitor resources, resulting in an incorrect
> MON_SEL configuration. To resolve this issue, return an ERR_PTR when monitor
> allocation fails
> 
> dmesg:
>   mpam: error irq from msc:0 'Monitor_Range', partid:228, pmg: 0, ris: 0
>   mpam: error irq from msc:0 'Monitor_Range', partid:228, pmg: 0, ris: 0
>   mpam: error irq from msc:0 'Monitor_Range', partid:228, pmg: 0, ris: 0
>   ...
>   mpam: error irq from msc:0 'Monitor_Range', partid:228, pmg: 0, ris: 0
> 
> Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
> ---
> Changes in v2:
>  -Use 'event->pmu_private' instead of 'hwc->idx' to keep monitor context
>  -Return ERR_PTR if unable to allocate resource in resctrl_arch_mon_ctx_alloc_no_wait()
> 
>  drivers/perf/resctrl_pmu.c           | 12 ++++++------
>  drivers/platform/mpam/mpam_resctrl.c | 23 ++++++++++++++++-------

I can't see these files upstream or in linux-next, so please don't cc me on
changes to them until they've landed. My inbox is bad enough as it is!

Thanks,

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2023-10-27 10:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 23:34 [PATCH v2 1/1] drivers/perf: Fix kernel panic due to the invalid mon_ctx pointer Shanker Donthineni
2023-10-27 10:27 ` Will Deacon [this message]

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=20231027102707.GA7899@willie-the-truck \
    --to=will@kernel.org \
    --cc=Rohit.Mathew@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=sdonthineni@nvidia.com \
    --cc=vsethi@nvidia.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