Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1939314pxu; Sun, 13 Dec 2020 08:12:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrrGPuCYrOeYdXma8rrjTxQImdkRM36LStVCDa4GcdGukQWc707wKC6ojDrEQBMboWTsUw X-Received: by 2002:a17:906:4c85:: with SMTP id q5mr18900317eju.375.1607875928934; Sun, 13 Dec 2020 08:12:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607875928; cv=none; d=google.com; s=arc-20160816; b=SE1/uz85TBliGXThoS0sjrXLP2ERr2rRcQwYF8vH+YjyWfkZkRXrLShEkj1Dv9uhL9 fVWuM/Um9zKvAgpvzIzWkzYKiGiGGFm1MuDXryyFc93J14XxE/84Pu9q5dSFKReuA6/Y 94zaFTG/7xQqDlDUf9osMxOlBgMum7eqeOYr4KArCBK7/mGzPnSqj72ilVo7DWyCnK7o 92+PdQs+kbM5b6D04IbRNRonOLjYIrfRa7/r8enjVFkbASoaaiJVaZYJvmJZvmH3Ygj0 RXguG94dRYTfXpdMdRYIJ5nxJEIWHIPBj2/eVkCK0f8/VhVQQTE99ucJUx0w7JVR87Ng DzxA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5gVxvrN7TauBXCIv1g5Ms9yXS0eQg9ASAu/O6B3LlVs=; b=JqS4t585Qf2Za7NLoBOaBoSVDzGmvQqq/nCQ4/4HDqHe2YuDgez+dniVlXpJ398Lv5 s0gXZ5GsNovPwYBaBrC20Q7WsavgUGOAvgACudFD+rH5IjDSxNXpOTUe1IpZJGjWw0tj U5Ibirqt0rd2wVT2GvO4ztELHw+brYQhCojXvz2KH6KYx6+53IDo17Lm7M14uM47bKCi 1N/GO0u8pUxeACA4F75e5MOD888Zg7ZiTjHVKGpahx3un+FXQY5n9F3/+He/7RisoXqv okD8lpCYNEAcO1PvMQC3lCzdXwDjKvPUDpqCv+lb5hpoWtPEjAtJc8s7RQg2aOXMCsxu 17pQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si8461110eja.53.2020.12.13.08.11.45; Sun, 13 Dec 2020 08:12:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2407581AbgLLQfi (ORCPT + 99 others); Sat, 12 Dec 2020 11:35:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:57722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439406AbgLLQJ4 (ORCPT ); Sat, 12 Dec 2020 11:09:56 -0500 From: Sasha Levin Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephane Eranian , Namhyung Kim , Peter Zijlstra , Sasha Levin Subject: [PATCH AUTOSEL 5.9 21/23] perf/x86/intel: Check PEBS status correctly Date: Sat, 12 Dec 2020 11:08:02 -0500 Message-Id: <20201212160804.2334982-21-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201212160804.2334982-1-sashal@kernel.org> References: <20201212160804.2334982-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephane Eranian [ Upstream commit fc17db8aa4c53cbd2d5469bb0521ea0f0a6dbb27 ] The kernel cannot disambiguate when 2+ PEBS counters overflow at the same time. This is what the comment for this code suggests. However, I see the comparison is done with the unfiltered p->status which is a copy of IA32_PERF_GLOBAL_STATUS at the time of the sample. This register contains more than the PEBS counter overflow bits. It also includes many other bits which could also be set. Signed-off-by: Namhyung Kim Signed-off-by: Stephane Eranian Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20201126110922.317681-2-namhyung@kernel.org Signed-off-by: Sasha Levin --- arch/x86/events/intel/ds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 404315df1e167..cf12e5a956f7e 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -1913,7 +1913,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) * that caused the PEBS record. It's called collision. * If collision happened, the record will be dropped. */ - if (p->status != (1ULL << bit)) { + if (pebs_status != (1ULL << bit)) { for_each_set_bit(i, (unsigned long *)&pebs_status, size) error[i]++; continue; -- 2.27.0