Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1002504pxb; Wed, 6 Apr 2022 06:28:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVKL2xIK2hLBNMeeK1jUUPjBa1nXPCt7d/v5FB4iAwwPbO22ZuxXepTkuT5zAQabyvkF0u X-Received: by 2002:a17:903:2352:b0:155:d4e8:12c6 with SMTP id c18-20020a170903235200b00155d4e812c6mr8972213plh.27.1649251712753; Wed, 06 Apr 2022 06:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649251712; cv=none; d=google.com; s=arc-20160816; b=gCQYPAHjqt5H0yOJOmFzWTgqwysgg32cOMALKE1OiaMWpFkC49eA/rWekR2T3AUB40 QPW5p2tzQsDhebAAQRyz50O5IdE4BZ/4TsnB9kEoX8MF8Ty7uDQbGfgLfSj0H72zHYqU GoZsAEVcxw6jhiumgCsPpVvTrob74jktN2+OWcDapRfIB+94pJTHiKjTmfkrxxS0Lx7F RcYZVYA9xx7SXPZgdGaz/8/+4po+kgfms92SgcVWsCdjV4xYDJrmDF48jZ7uhKkTxPP5 sDYTSgni1ebqK5JUMr3+tlVhRTa2VUj/3FVk/+3yr0WXe6iOeYwGLB3rm/4XmBGamnP0 7XNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VRbJwvSwICoWlBZsfXU/00cYou2AGRHKX3B34NCda6w=; b=jKAtKbunozbhwTfSZtucRYZkZ9rryyzj5uhDN+HT0L+F4l2s8sjeyY3afUebGc2c8y 1ms2iVqVR1sFOPfGp9FoZPFFrx2gXeCOGafPabhx4jnrd+PJAzfQ5Y5Jl3AgejDx+qeG 6H3AwtZslnahufOlVhDLYZY0JW2FUJxN2Utuf8cnvKbgfZ42irdNb+ijoNc9cawoObdD G6yBQP+DSMzztZNHQu3jXqNGGLoIyzgdOzRxWkPbLaP/ef6Sn2Din/xw2X3ZEddw1hfI 1Dz1qzEhj4v3zM9Ge2H58o2Z7yC70kyf+dDho3RQ2Q5ciMFI1YYdYLFFsj0BSbpJP7PN Atuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gj6422Wb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k19-20020a056a00135300b004fa3a8dff81si16846359pfu.56.2022.04.06.06.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:28:32 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gj6422Wb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A153C531499; Wed, 6 Apr 2022 04:06:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346008AbiDEVDT (ORCPT + 99 others); Tue, 5 Apr 2022 17:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348920AbiDEJsr (ORCPT ); Tue, 5 Apr 2022 05:48:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC42EE4EC; Tue, 5 Apr 2022 02:37:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2925961368; Tue, 5 Apr 2022 09:37:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39A09C385A2; Tue, 5 Apr 2022 09:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151449; bh=ksj7NaMP7Eh/EV7FFmcfWjOot3c2gY7+vG8k34T7j4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gj6422Wb9976BZXx8dytej13MlfV/NY/kv48UuXqTi3J1+KNMhTXXxc4FWrpoPt3S qIy4Iv5+2yiXEEF3GIoPJiFUrPNtssQ4YMGTxJvdK+9JWIq9Kq8iFyc1ty+crU0Dqg gysFOl8Opwdgwute6G+HTFLl4SKLDhbzTbwUm1x4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Athira Rajeev , Madhavan Srinivasan , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 420/913] powerpc/perf: Dont use perf_hw_context for trace IMC PMU Date: Tue, 5 Apr 2022 09:24:42 +0200 Message-Id: <20220405070352.435852317@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Athira Rajeev [ Upstream commit 0198322379c25215b2778482bf1221743a76e2b5 ] Trace IMC (In-Memory collection counters) in powerpc is useful for application level profiling. For trace_imc, presently task context (task_ctx_nr) is set to perf_hw_context. But perf_hw_context should only be used for CPU PMU. See commit 26657848502b ("perf/core: Verify we have a single perf_hw_context PMU"). So for trace_imc, even though it is per thread PMU, it is preferred to use sw_context in order to be able to do application level monitoring. Hence change the task_ctx_nr to use perf_sw_context. Fixes: 012ae244845f ("powerpc/perf: Trace imc PMU functions") Signed-off-by: Athira Rajeev Reviewed-by: Madhavan Srinivasan [mpe: Update subject & incorporate notes into change log, reflow comment] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220202041837.65968-1-atrajeev@linux.vnet.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/perf/imc-pmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index e106909ff9c3..e7583fbcc8fa 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -1457,7 +1457,11 @@ static int trace_imc_event_init(struct perf_event *event) event->hw.idx = -1; - event->pmu->task_ctx_nr = perf_hw_context; + /* + * There can only be a single PMU for perf_hw_context events which is assigned to + * core PMU. Hence use "perf_sw_context" for trace_imc. + */ + event->pmu->task_ctx_nr = perf_sw_context; event->destroy = reset_global_refc; return 0; } -- 2.34.1