From patchwork Sat Nov 12 15:15:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 19192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1316415wru; Sat, 12 Nov 2022 07:19:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf7F0IPNoPno7renNYEIedHZvqQjJ9gS8r23xgYV2yFcvUOUULtETF46+UYC1zSsbsIXV1Gx X-Received: by 2002:a17:906:4ecc:b0:7ae:5381:bd02 with SMTP id i12-20020a1709064ecc00b007ae5381bd02mr5342618ejv.286.1668266386903; Sat, 12 Nov 2022 07:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668266386; cv=none; d=google.com; s=arc-20160816; b=ZWJ1iRXUnhlbPl1waIFU/Ic3pCxVnzc8IL40t/FsgSb61bGKrH5JuWkapUqZrD07Um GJunCEKBkzLfEx5HTS9zNiSg6tlhdvSYd/4jYghOvCaeceBcQARTETaaDAZtPH6fRKr9 CSyN90A0QGZ0E5w2a7n1mjrCO78nsbO3sqX8fiN5+XWH8ZArSyhYa8QADRxM6DHtkRpg I0B6ff1YfH1AnFsr9/nP1yUtBhWARedzj4+L5jmYlqwr6ZoqOrghnWxKUIdrxyjpnWKs 5KpuVkAF1c8vzuwu71kGWhSQNzkQNehV947P9heDkT8io/q5vlZOctiuPESgFJSTc1u/ wMog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=WjCzHJ527CE7EILo66uPy7RsslvNGwE2EGxu8KNW7b4=; b=mDFh16DDiVSagujZ23zmmKbTtpGVBUeTQPLlKsAfqfl0F06tCzDODhcodwP7kKo6LM R+yFCAack3J3cTGVLjhvddR4vQm4ovs7AaFHd3y2DUMSoYVBT2wSEWaaDifBo+Eid7FF om4xgaGPvQCDhAOV+23f04sEBG1+JBfqVsnpzz0TFPxRV4VytHUhH/GI2yRLDNFMKGgI 1lgIl8PyrXfcQsIhz+WMfD+81i4qwmu5IEDn0tBj84xbEj511qfAy66u56Zq5N9Obxsu SF1CyDmcDESsDhpgpeBsux66kIlSC4ujG33WaVyI5LKQRnBWuKEDn+FFui9DQPNbe85B c7Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=l649lpxF; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i24-20020a05640200d800b00461fc07a835si3768023edu.18.2022.11.12.07.19.22; Sat, 12 Nov 2022 07:19:46 -0800 (PST) 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=@intel.com header.s=Intel header.b=l649lpxF; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232026AbiKLPPY (ORCPT + 99 others); Sat, 12 Nov 2022 10:15:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230170AbiKLPPV (ORCPT ); Sat, 12 Nov 2022 10:15:21 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7F9C2D0; Sat, 12 Nov 2022 07:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668266120; x=1699802120; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=7w9FJuInitetdnszaHj4UPSjYnaM0MxZY/ipUusdnWE=; b=l649lpxFpO76ETFqDu/YajIzIYhyh/lVikeA9okD8iMT6T1pCRjHtuoK dBBJytssIx82GtPj09VVWixmhfUmJ4oAOOWdD353HXI8uxgRGWCnvCnIo 1RSUL+cLwIxvM38ze/ptx3ImkoBRVwLA1igIFMHXdoJQWHdP6A/KyFgSO EiFHKJ+ik+tW+nn0NiuO5fFPAQKulHOO0dNd1u5oyue4TxERjgrc9kjN6 X0d2X/zUYIRJDNzAyWBpJoGPcYSxsNtVBURzKHg8AGLX/xLdiylIMenSu MTRVMHYeq8+YWd5U6oQcFnnPTPUjNZmB9Ndj6McCpDWWUe7hFZmuvQPbl w==; X-IronPort-AV: E=McAfee;i="6500,9779,10529"; a="373864310" X-IronPort-AV: E=Sophos;i="5.96,159,1665471600"; d="scan'208";a="373864310" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2022 07:15:20 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10529"; a="762924419" X-IronPort-AV: E=Sophos;i="5.96,159,1665471600"; d="scan'208";a="762924419" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.57.165]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2022 07:15:18 -0800 From: Adrian Hunter To: Peter Zijlstra Cc: Alexander Shishkin , linux-kernel@vger.kernel.org, Ingo Molnar , linux-perf-users@vger.kernel.org Subject: [PATCH] perf/x86/intel/pt: Fix sampling using single range output Date: Sat, 12 Nov 2022 17:15:08 +0200 Message-Id: <20221112151508.13768-1-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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?1749304094754109622?= X-GMAIL-MSGID: =?utf-8?q?1749304094754109622?= Deal with errata TGL052, ADL037 and RPL017 "Trace May Contain Incorrect Data When Configured With Single Range Output Larger Than 4KB" by disabling single range output whenever larger than 4KB. Fixes: 670638477aed ("perf/x86/intel/pt: Opportunistically use single range output mode") Cc: stable@vger.kernel.org Signed-off-by: Adrian Hunter --- arch/x86/events/intel/pt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index 82ef87e9a897..42a55794004a 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c @@ -1263,6 +1263,15 @@ static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages) if (1 << order != nr_pages) goto out; + /* + * Some processors cannot always support single range for more than + * 4KB - refer errata TGL052, ADL037 and RPL017. Future processors might + * also be affected, so for now rather than trying to keep track of + * which ones, just disable it for all. + */ + if (nr_pages > 1) + goto out; + buf->single = true; buf->nr_pages = nr_pages; ret = 0;