Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp638133imm; Fri, 13 Jul 2018 03:54:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd0lI3N88ehiSWG+8jO8hlXIkEpwvC5zwBq6pUhT7w0EH5IaujTSMu3PdpoG/mHcSc+GjER X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr5961042pli.7.1531479253950; Fri, 13 Jul 2018 03:54:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531479253; cv=none; d=google.com; s=arc-20160816; b=WT5N09GMgSp6XNBJl2OCQJaKjKi/cFYdd1epXkfxUpVNKj59HlVK7mtW18sAMun9Zc Kkqhzm2I9mxKRq4bBKDLL0j2sSbuFtBelc/SeuWOg2/Dpx25oPgEsm/fUBTBXLcsFT2/ ebioheCee+K6SF07xlceofF78tePyA+B8F4Tv9pzC8a0890XCrfYFwnFecxMc14dgR2g n0rJbkdyqxfwGTkktCtJ3ZTmZQG6+JMUAnvj4XNdvjX9AStRk2tMuNNKc9CUi1tamw6a lcyDG9rTB0DlrhVearUbA9UQdOXOtCuEBAqwGcaPd7hEIqAMB/E7CAiOJBaYzMc8Q3Ke 38cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=+RcBWhtlIsgX5SPlqSYCeOZVBuk4qr6SyH8gAr7ZpeY=; b=xqDU8rtrTUSNAxk/Jhq03Ab3Hk8BXiyH+Tgjv1/1sjpM3NqFqrKx2L5xa+B3WuMYm2 amCYKJfeiFUigqR0zkfOQma2ezTM47W1GfJAzvpqbgnYsI1LnYTLg4i49fF9vvLAnDJ1 OiTDh8xIdjMpIb0BblJ073VLPyfpRUGhql3Rhs9U579tdt53dJ4Dqjj2KaNjTTv/o2RE d9b7crVkqg34gZFMNtMkCGVc9yF47e015WDsex19nmXRDlUds59W7nUU31QsvdJNKn3E H5qbVJOWXUm3Kp19UmMpC9D2cyvSH63CG6RfGSXB98f6dcXnhQq9zTtNIas1/wftspTa TlSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=wvU+Bc+d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4-v6si22693411plo.208.2018.07.13.03.53.59; Fri, 13 Jul 2018 03:54:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=wvU+Bc+d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbeGMLHd (ORCPT + 99 others); Fri, 13 Jul 2018 07:07:33 -0400 Received: from merlin.infradead.org ([205.233.59.134]:39504 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727269AbeGMLHd (ORCPT ); Fri, 13 Jul 2018 07:07:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+RcBWhtlIsgX5SPlqSYCeOZVBuk4qr6SyH8gAr7ZpeY=; b=wvU+Bc+dGKXrrVoluTdqUuNwX IK1vQidtMKlSUrBt3a32z/3dvTTeUGNEVXc6siVWYMID2I/NulctikJWan2v/nxqen39nfm286Zst +SnYsSY4TZClz9Ae1xCbC4oLALi9ZAJz+lWpCjTa3cj8fQstBZP+fj4byTFLcPMwO52njk/qhP+lV /cS4JieSv79PRKogKaCS1WCPOvgMpbUGKJzwDS44ln1n5FOu8EnheA9KOj7ldCj7kLPmkf0W5b76L Or3DYKsyrAF/yDk/Ow3vbU/bO2sidp0KWBao8XR672ZSRpjskyHMcaPjOhPkFSK8n0CD0XYgSaAOg mjl9BEsQw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fdvhN-0006f6-I0; Fri, 13 Jul 2018 10:53:17 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3CDA720298BAE; Fri, 13 Jul 2018 12:53:16 +0200 (CEST) Date: Fri, 13 Jul 2018 12:53:16 +0200 From: Peter Zijlstra To: Hugh Dickins Cc: "Metzger, Markus T" , Ingo Molnar , Arnaldo Carvalho de Melo , "Shishkin, Alexander" , "Kleen, Andi" , Dave Hansen , Thomas Gleixner , Stephane Eranian , Linux Kernel Mailing List Subject: Re: [bug] kpti, perf_event, bts: sporadic truncated trace Message-ID: <20180713105316.GX2494@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 12, 2018 at 06:22:13PM -0700, Hugh Dickins wrote: > A little "optimization" crept into alloc_bts_buffer() along the way, > which now places bts_interrupt_threshold not on a record boundary. > And Stephane has shown me the sentence in Vol 3B, 17.4.9, which says > "This address must point to an offset from the BTS buffer base that > is a multiple of the BTS record size." > > Please give the patch below a try, and let us know if it helps (if it > does not, then I think we'll need perfier expertise than I can give). Ooh, good find! > --- 4.18-rc4/arch/x86/events/intel/ds.c 2018-06-03 14:15:21.000000000 -0700 > +++ linux/arch/x86/events/intel/ds.c 2018-07-12 17:38:28.471378616 -0700 > @@ -408,9 +408,11 @@ static int alloc_bts_buffer(int cpu) > ds->bts_buffer_base = (unsigned long) cea; > ds_update_cea(cea, buffer, BTS_BUFFER_SIZE, PAGE_KERNEL); > ds->bts_index = ds->bts_buffer_base; > - max = BTS_RECORD_SIZE * (BTS_BUFFER_SIZE / BTS_RECORD_SIZE); > - ds->bts_absolute_maximum = ds->bts_buffer_base + max; > - ds->bts_interrupt_threshold = ds->bts_absolute_maximum - (max / 16); > + max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE; > + ds->bts_absolute_maximum = ds->bts_buffer_base + > + max * BTS_RECORD_SIZE; > + ds->bts_interrupt_threshold = ds->bts_absolute_maximum - > + (max / 16) * BTS_RECORD_SIZE; > return 0; > } >