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 1CD1DC4332F for ; Tue, 12 Dec 2023 09:17:42 +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=VMzxwuJmqNRQPVoE/RONjc8juwoYTS7uClOwO3isv/Q=; b=fRGI8Rw2iZiymz 7VZe9bP2ZBnCuwTfPZWwrmz+CM1GwtBYnN7zk6SFTFOcvA0WkWvLE2HR65GmXGmK/Rhhr+pGENiGG K8dBHlkd5ZrEIpCbjbBx99ZaJ/LLcVtOTTh37qyWf/s5RlUIiXWB8smKHMxdO/mrzHud4jUWXsnOD W9v+90qChlMmvtRg+S8ji46Qiw7fmVCBNgZag3DzFt7i+JH8RT4JI61RmPrKBbMxArBGVMGTuDT/2 /0LuJFClHdeBgQQR8WM6q0YtBLOUSvpB0YBEzMLdthdHyEjVBsctnNoAq1AHAjbdZKZUNFQinY/6k qJlWLchxCFx3OuUilNIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rCyt1-00B928-35; Tue, 12 Dec 2023 09:17:07 +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 1rCysy-00B915-2w for linux-arm-kernel@lists.infradead.org; Tue, 12 Dec 2023 09:17:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id EF44DCE0B6C; Tue, 12 Dec 2023 09:17:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A81A3C433C7; Tue, 12 Dec 2023 09:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702372620; bh=pAJ3nx5Llui3FrgGOwWJ1sBjH+cYEeTGCkjb+A7qsBQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Tb1exX7maotv6ujLhPqoFP1C0nl8/QWredniP2WIk+8s+CxcMA48E3PBP9bLi/ObO dcMLa0zNrvd4z43yk7j0X8mXbOu0Ep9isOGqzT0r1RwWWbpKX4koNmB/irb0QXhX5H bisSdNZqbFqCtIblE+UuqPoSbQW+Rx/Dwr7wNtlE/5LBQbz/sFd17fFgrH0vl2DH7T ggm+VZ7Mb5w2k88xAhIVbGpY96hLfkjbbjuRGVRtYTewGx3IlzTQVn06u08R/vxD6p pzQkjY0nKIiLdxawLJLu9cUsGKFE9IgwEj8SJLGFb9AeWTpg8JosVm2Vh0wenu0LhZ Bwppx6/sfawrw== Date: Tue, 12 Dec 2023 09:16:54 +0000 From: Will Deacon To: Robin Murphy , catalin.marinas@arm.com Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jeremy.linton@arm.com, ilkka@os.amperecomputing.com, renyu.zj@linux.alibaba.com Subject: Re: [PATCH] perf/arm-cmn: Fail DTC counter allocation correctly Message-ID: <20231212091654.GA28174@willie-the-truck> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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-20231212_011705_115728_E2210D05 X-CRM114-Status: GOOD ( 18.02 ) 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 Mon, Dec 11, 2023 at 07:27:28PM +0000, Robin Murphy wrote: > Calling arm_cmn_event_clear() before all DTC indices are allocated is > wrong, and can lead to arm_cmn_event_add() erroneously clearing live > counters from full DTCs where allocation fails. Since the DTC counters > are only updated by arm_cmn_init_counter() after all DTC and DTM > allocations succeed, nothing actually needs cleaning up in this case > anyway, and it should just return directly as it did before. > > Fixes: 7633ec2c262f ("perf/arm-cmn: Rework DTC counters (again)") > Signed-off-by: Robin Murphy > --- > drivers/perf/arm-cmn.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c > index 86d970e74129..c584165b13ba 100644 > --- a/drivers/perf/arm-cmn.c > +++ b/drivers/perf/arm-cmn.c > @@ -1816,7 +1816,7 @@ static int arm_cmn_event_add(struct perf_event *event, int flags) > idx = 0; > while (cmn->dtc[j].counters[idx]) > if (++idx == CMN_DT_NUM_COUNTERS) > - goto free_dtms; > + return -ENOSPC; > } > hw->dtc_idx[j] = idx; > } > -- > 2.39.2.101.g768bb238c484.dirty Acked-by: Will Deacon Catalin -- please can you take this one as a fix? Cheers, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel