From patchwork Fri Jun 2 19:45:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 102690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1265357vqr; Fri, 2 Jun 2023 12:59:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VQaQDR73CZWT+RaD1djyR4uNzJn9DveDr88DjIrxiRiGkEVuUlfz2mL4IKqjp33Utw0Vo X-Received: by 2002:a17:902:c40e:b0:1b0:25ab:a9eb with SMTP id k14-20020a170902c40e00b001b025aba9ebmr1433622plk.8.1685735971884; Fri, 02 Jun 2023 12:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685735971; cv=none; d=google.com; s=arc-20160816; b=PVkYEBv+SKQ38NRbRTrd9E7EsOLRT/5u8xLsjLxeqqt3W5dtcuvTE5Z4YdbuAyDaZ2 v2Rq7KLNUi9svewyhDQelblV8jrGOGvT3+ycMrHXGvk0m3DRY6kFqGlnvlUCN+oj6WJ0 /Em4uRLUqo8H7ngbEF/B7z1E8yWt7RZa/VpIe1tqG+8NLcNTySYMrB0qwgXuW+aO4i5a 1Dkd625JhjQKX+/h5iQ5wbjhC2eI9shkUDdIntjAznrIgUKVR673tsZl4D+Kl+dWr3UK eGMg1zcc2ujskBmiCqASwsTGvMxwiPcSD/jfMCEADLuKHclxV7juOh2Qrr6LSE1Felis N5MQ== 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 :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=Yo0iLHtIXzns4YdryR3pdo44wLy6L2MpMgI0lT2F9VA=; b=nF0gAtU09QAaLzP3Gfug810N9h+qvaeyTR/wORXjTwu0IjC+88uo8n2DbVtuzCU8eD Rp20ImBkicW0BFKjzwH/Vwucy7lSGVfIVbtovADsCNLtl1qiQBEyf05rOCCsb0iKEb05 YxB0IXmrwnVzb0NUgmFSoLyfJxbhFzcUvFXFtCk/RtckpQ5xTKYJXIl4CoMM7kQkRjxy 90k1+Y9qS6ZKSNb0JqhL1hKXlq/NfTjuuZ3Arqq3yot0gYISHf8vXbuu2IHqrtgIN017 NKTKFT5rirbO0auqm+/7KL3jGjr6ZvyFVPtcO2rOt/MmHQJs45hsHtQKWPO1A39HgVGe 8Ufw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DOTRovC7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2-20020a170902e80200b001aaff9c8dd1si1390657plg.427.2023.06.02.12.59.17; Fri, 02 Jun 2023 12:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DOTRovC7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235908AbjFBTpT (ORCPT + 99 others); Fri, 2 Jun 2023 15:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235937AbjFBTpS (ORCPT ); Fri, 2 Jun 2023 15:45:18 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 237CD19B for ; Fri, 2 Jun 2023 12:45:17 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-651f2f38634so1966036b3a.0 for ; Fri, 02 Jun 2023 12:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685735116; x=1688327116; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=Yo0iLHtIXzns4YdryR3pdo44wLy6L2MpMgI0lT2F9VA=; b=DOTRovC7U744AstVeBREzqt5mec2w6cmU+Ju/GIz2VOX64xZo4EOUY3C533UaWZhh3 IzJUQq4wGZV3/NZrwM9H3JqIdFGgzJrugVjbwsNBNVg+2AG4+nz7Ez2eM80jXeDBPqyw YXyBlzDNBckIzTb0U0mFW28atGrt1z4ix0QUZSwdu4kycEttdPIQgvJENq1/4Lf6jprv +ebACT7Vl/RFBKMF2lBbqmazYrTdozXLwNJ1Y280dWzOvRkAgBd6c1vEEtwUb4dhiHVW DZ+8IYntD3VBNUDX1xNgQ6kZPxeRPaO3Wns0b1PBGKFlqrRAu3AJrzsdm9+GcGgHajj1 t8xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685735116; x=1688327116; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Yo0iLHtIXzns4YdryR3pdo44wLy6L2MpMgI0lT2F9VA=; b=I92vzsGyayF8hPw6vUDFT8YyNUn2/KqHl55YUW6maBre34kFds9lrdOsTdLthhG0VF euYI/VACMrvyzUOFyQ5CDM2xWq7gYd52w6VQQwlvEaHgV8Uc/FNcESxNEW6PzcE9ak96 1hUquDncs2CE1gdR6iaEsWN4dv/nyByWSu9GLTT6MhF/81o4AdiZk8S6HB6FnPIoxCbO 1ymgghZ4MFnpWgQ2IejzhG/yt2VaupE/ToJ1nFUk4MfNu3ZA2wEaUOYt7HYoyG4NKhsJ lg70LB2rhHz3Ey5YHr9qFWOwFM8b6lxAnOZnMz3bbRgJLEBsMTMVJXo7nrAAzw2Gq5E8 NOBQ== X-Gm-Message-State: AC+VfDwpTRIby2yA4D5c2ssyssoHQW3SDjuUiDci99Buqjq0Sm/UBAjA SvGCX/sUzfnhXrbVHDe1dkM= X-Received: by 2002:a05:6a00:23c8:b0:64c:c5f9:152a with SMTP id g8-20020a056a0023c800b0064cc5f9152amr16789338pfc.23.1685735116310; Fri, 02 Jun 2023 12:45:16 -0700 (PDT) Received: from moohyul.svl.corp.google.com ([2620:15c:2a3:200:bc81:87cb:7da8:98c2]) by smtp.gmail.com with ESMTPSA id j1-20020aa78d01000000b0065329194416sm1291341pfe.193.2023.06.02.12.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 12:45:15 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Peter Zijlstra , Ingo Molnar Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Ian Rogers , Adrian Hunter , LKML , Stephane Eranian , Ravi Bangoria Subject: [PATCH] perf/x86/amd: Reject branch stack for IBS events Date: Fri, 2 Jun 2023 12:45:13 -0700 Message-ID: <20230602194513.1589179-1-namhyung@kernel.org> X-Mailer: git-send-email 2.41.0.rc2.161.g9c6817b8e7-goog MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767622282590060974?= X-GMAIL-MSGID: =?utf-8?q?1767622282590060974?= The AMD IBS PMU doesn't handle branch stacks, so it should not accept events with brstack. Cc: Ravi Bangoria Signed-off-by: Namhyung Kim Reviewed-by: Ravi Bangoria --- arch/x86/events/amd/ibs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 371014802191..607a692ba8ce 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -265,6 +265,9 @@ static int perf_ibs_init(struct perf_event *event) if (config & ~perf_ibs->config_mask) return -EINVAL; + if (has_branch_stack(event)) + return -EOPNOTSUPP; + if (hwc->sample_period) { if (config & perf_ibs->cnt_mask) /* raw max_cnt may not be set */