From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C245C25B67 for ; Fri, 27 Oct 2023 10:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FwS2gxMehCtHUOgPz8lqq0ly9BX1/sH4//PAvF7sTGM=; b=HwEUnF8p5rjkN6 OBU4j/5377PrNaRNNQfrr8qpFk9Xcwm+RZQBTK5T34xKk/UYXyeLTRdAt7Mt2pzlqhvX6ONhoN5TO bwbL0xd4FqQFCDupHSOCT72bz7EcN1ptZ91WbaTHgptZBUgGPO9nXDHb1tjn4tsulmwyJPcwnfKYA NuqRDoNXybx7aPZT1SlAxDTK/riZveV62sjFORzxHAfY3eyehdl920io7N2f5B8i6QAuLYvwmpim7 TxdlpQ6a6Rt01aOSzAM0G6L0cmTEyCApaE+ZPqVJ0sSDH4Ani0fv0SULrS0dfx9vZ4JTKYvrkfFch 9Ey5vTpeYih+zwhl/4nw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qwK3q-00G7LL-0F; Fri, 27 Oct 2023 10:27:26 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qwK3j-00G7KW-0w for linux-arm-kernel@lists.infradead.org; Fri, 27 Oct 2023 10:27:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 2B22BCE4281; Fri, 27 Oct 2023 10:27:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07AE2C433C8; Fri, 27 Oct 2023 10:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698402432; bh=uVk/vIgkpyPnquxSXy9yhy2IXmFDx1jXSNjyl7lsroY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Aduy1fwVe4MoIIMSRETaq+mW3pN+bINdA+vYHkx2YGiUK1n6s6YnVi7t3cmHY9vKM gTqXtlWQmmtmgFTuo3Z7mpxl7qmhHfuDOzgYPdlaZBPTgMGtEqYfebe+JHnlQyO/tM m9XSdEIcuQXE3ecmhiwzcliQRW9/iWMU4x3mzJssx2MNz0i8LNmsFqQ3+8x1spYK1P 2LwGwgNuFUefRXBuRrKfd9otZ8EH64YWf/uxO4+7L4BQ55yiDbfs6chua26pWAzxwB O4IKNS1faCxl3NpHlL0r7mjBoL4+5SanS4tX2Rpu8SyPOvKYxSCdN8yUd5537MY43A J7z54BJa0xKKg== Date: Fri, 27 Oct 2023 11:27:07 +0100 From: Will Deacon To: Shanker Donthineni Cc: James Morse , Catalin Marinas , Mark Rutland , linux-arm-kernel@lists.infradead.org, Rohit Mathew , Vikram Sethi Subject: Re: [PATCH v2 1/1] drivers/perf: Fix kernel panic due to the invalid mon_ctx pointer Message-ID: <20231027102707.GA7899@willie-the-truck> References: <20231026233443.3493667-1-sdonthineni@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231026233443.3493667-1-sdonthineni@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231027_032719_526267_2C8AFEBF X-CRM114-Status: GOOD ( 14.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > --- > 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