Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp562897pxf; Thu, 8 Apr 2021 08:34:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC5St3ofMhYuzG7EkFySp1PEIjlzWiZjD3xcPEetOiHa+UIKvLZZCZlhrS5KGHWntR0vQT X-Received: by 2002:a65:6844:: with SMTP id q4mr8670477pgt.48.1617896053399; Thu, 08 Apr 2021 08:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617896053; cv=none; d=google.com; s=arc-20160816; b=LjWxuG/nwL8/3ZZdFJ2s/gPHQRteeO0L//p3yvlWsWduNlnrO2kOK8VlTrmOqwllsu 9lKKgSMovvpUKYnpGbLLNEcRSGfmlmOUHISNdIDO1YzVjku2fGPMCNSm2t6ePz5TI4FB bmasLefoClNni1Hd39qM2epy61dl4eoWA6Ygwvo17hLud0feHzxfRzLcANcxK6oVCVAn RX1UhiE0RCS8JsgwMKY8KrnGmFUaUl0ikiymSMYEghZ2jHEBLwpVYKAvIBVkQcYhWWQd VIvQx/k/cvb59pfK61HcxGQSciXqeX9BmuPjy0/YMOEoC14Pl6mMxWfeFAUM3q6NRSDc 5iNQ== 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:ironport-sdr:ironport-sdr; bh=MLfvmt2X/Xs5NQXdajk6L44PYQcmI5PWPPH2euTG9Mc=; b=eo6ZBom5N9u1rr59IQATJiA1AXnaQWwWNO1iWoY2W7bHEZtpf3qT//3ObPfnWQOtwW QZvXEOTfLpbnKRgS2OmA+LPKefikoMYn+Ka7ld2i9uwsXekqF3qYasjKXOjyQgXZ5uIs QFCol/sVC+NG0xSswKx5Bk5UQ73qI/InTiIBOUIXFRKttD3Zz8F95MdZ1UkKwKxRVr5j ue4EKv03OQu/CeCQsFKLsudDbR/9lAhiwCXPqMJZg1Dwjgt7QgBC/gQ4ggLlWy07VjCP SN1uo59IR399AnuJBhJBa8fgHaqDKs6mGzaRNJ85ywVCICx8yK+fUmX/BvUaLuX2XOZG QGTg== 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d18si28758575pgg.224.2021.04.08.08.34.00; Thu, 08 Apr 2021 08:34:13 -0700 (PDT) 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231712AbhDHPcN (ORCPT + 99 others); Thu, 8 Apr 2021 11:32:13 -0400 Received: from mga06.intel.com ([134.134.136.31]:26940 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231526AbhDHPcL (ORCPT ); Thu, 8 Apr 2021 11:32:11 -0400 IronPort-SDR: BaqIoR/ze4NDkO0oqu+u2W9Vyu13VVixZib9AQvVOePT+/SGSYQrNnMkp09HviLAEmDJ+3f5Vw Lztp9vltQrjQ== X-IronPort-AV: E=McAfee;i="6000,8403,9948"; a="254903905" X-IronPort-AV: E=Sophos;i="5.82,206,1613462400"; d="scan'208";a="254903905" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2021 08:31:59 -0700 IronPort-SDR: AKACWkVzhno9+X+z5BSx5bfkogmHCe1ci4l6zIpm2DNQP2YjniI9xHBujFfrV24awkRo6RiA87 OIEbcdBa9VaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,206,1613462400"; d="scan'208";a="415820645" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 08 Apr 2021 08:31:56 -0700 From: Alexander Shishkin To: Peter Zijlstra , Arnaldo Carvalho de Melo , adrian.hunter@intel.com Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Jiri Olsa , Mathieu Poirier , Alexander Shishkin Subject: [PATCH 0/2] perf, pt: Improve data loss Date: Thu, 8 Apr 2021 18:31:57 +0300 Message-Id: <20210408153159.81880-1-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi guys, There is a problem between the PT driver and the AUX allocator that results in smaller buffers consisting of 2 high-order regions, which also means only 2 possibilities of where PMI gets generated and where tracing stops. This is not good enough for double buffering: when we get a PMI mid-buffer, we update the ->aux_head etc and immediately start a new transaction while observing ->aux_tail to still be zero, which makes the PT driver put a stop bit at the end of the buffer. However quick userspace is to update the ->aux_tail, that second transaction/PERF_RECORD_AUX ends up truncated. The proposed solution here is to set up attr.aux_watermark to a quarter of the buffer. Unfortunately, at the moment, the PT driver is not equipped to deal with aux_watermark that's smaller than the AUX allocation order. I could fix this in the driver itself, but, seeing as it's the only PMU that actually uses the 'order' from AUX allocations, I'd rather fix the allocator instead, which is done in patch 1/2. Patch 2/2 could be replaced by instead changing the in-kernel aux_watermark default, but that may interfere with PMU drivers that don't ignore said watermark / handle->wakeup (afaict, that's only arm_spe). Alexander Shishkin (2): perf: Cap allocation order at aux_watermark perf intel-pt: Use aux_watermark kernel/events/ring_buffer.c | 34 +++++++++++++++-------------- tools/perf/arch/x86/util/intel-pt.c | 4 ++++ 2 files changed, 22 insertions(+), 16 deletions(-) -- 2.30.2