Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4519636imu; Tue, 8 Jan 2019 01:28:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ZrDs+rHtADOsZh59c0q5XnYKwUWAcvPl0yC5a/qqtCQSWQaNqSvZ99/mN6iismVc6w6Cs X-Received: by 2002:a17:902:680f:: with SMTP id h15mr1011464plk.40.1546939702662; Tue, 08 Jan 2019 01:28:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546939702; cv=none; d=google.com; s=arc-20160816; b=OJxg78i0oGgUwcNIys8Qd3OQN0iJFMXqOuIsizapVhWi3EntDxO5NzzT2zR+BDxIMZ 2EueeSCTyKPOQvGoIMIrlfeO1W8Y3MQnRCjMsfJyLmkxWtyArkUUxSR6OniSMvJ/k8sG wJxWHC+A3uMPrwzVQTnQl3re41hL1Hk9pXyub1iyIv5a85PRtcsERlCU8L0ar/ylrrPk RCBGQN5gbpzvb8ssJUDUhOegvrNzjTOYYVsVqLyrrJk9Vb0kj7i7t4njEfP5Nu7tabgc lUqF6wlQmkbtcCjUjPCvN2hLNARmgx1R3YNHPu3DijnzIw6mksAJL0XjC3K/T7UBIXBe aRAg== 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; bh=UcFs79ElLYfkSMdEYQ8C2tcq6RJzZMgjPuBrAzZDW7c=; b=scE6yriQd55kDe458amc9GoDmHW34+YxELPzMu750r2wWVorV3bX6nAaI7CPMp99+K 64BZctUWh3d5pOR7U2LSXb5Wl/OwNgtkNoRbixEL7gctlvx7MtGUN96UEEIjCh4okEYa Cq8uGQKTj4V02fygN+ggRpQHDX2HIU3Wt9WIIUu98hJ/WVYppb2bZ2s6qpu4lVRAkZDh YjFi7v3aIscz6Hubrtau8r8aNH02QP7HCTyYilGM05dkPg1QlcI2KB9LiNCxPzlJb1af Ki9vyhf0aKquor67kYyuck5aL2zbM2d9EkwJgBrkYXFLVtkOr+EVrmP0OGjdcXWJks/q e2pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=A3JXKdwE; 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 v34si64140338plg.205.2019.01.08.01.28.06; Tue, 08 Jan 2019 01:28:22 -0800 (PST) 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=bombadil.20170209 header.b=A3JXKdwE; 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 S1728261AbfAHJ0Q (ORCPT + 99 others); Tue, 8 Jan 2019 04:26:16 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48274 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727367AbfAHJ0P (ORCPT ); Tue, 8 Jan 2019 04:26:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=UcFs79ElLYfkSMdEYQ8C2tcq6RJzZMgjPuBrAzZDW7c=; b=A3JXKdwEuFvsP8uk/eCujm7nI iPgjSxCw953uuyOEmygiq2MAgHpMaxW2pMVcHalULtHDHPyHRY+T0ybsmEEKnkMJEo4uMx6OrDPn0 h6dXsD9DU/WPTo1LiWcCliO8Zzz6NaY20byi7LQTxj5QwsMKKNNFy2XQX5NnJaXp3On46Lkt17z41 br4PZILx75vamQFZdD/XDd5/pfvZU/iSL5cDWe2BsOI4IxokI62iDU5RSzim8EcqFTNmbf6TXU3hi SXYYvx7CjIH2r6C5aHvZYT+OmQmfD1FSyhM9juxDv1nAV3c2moVChXZ8UDlt2+6W3HL07DZPLVpJC h7NWDE6bA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggne6-0005ow-Jq; Tue, 08 Jan 2019 09:26:03 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C531B2029D919; Tue, 8 Jan 2019 10:25:59 +0100 (CET) Date: Tue, 8 Jan 2019 10:25:59 +0100 From: Peter Zijlstra To: Adrian Hunter Cc: Andi Kleen , Nadav Amit , Ingo Molnar , Andy Lutomirski , Josh Poimboeuf , Edward Cree , "H . Peter Anvin" , Thomas Gleixner , LKML , Nadav Amit , X86 ML , Paolo Abeni , Borislav Petkov , David Woodhouse , Alexander Shishkin , songliubraving@fb.com Subject: Re: [RFC v2 0/6] x86: dynamic indirect branch promotion Message-ID: <20190108092559.GA6808@hirez.programming.kicks-ass.net> References: <20181231072112.21051-1-namit@vmware.com> <87zhshe66w.fsf@linux.intel.com> <20190107163227.GH14122@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 08, 2019 at 09:47:18AM +0200, Adrian Hunter wrote: > On 7/01/19 6:32 PM, Peter Zijlstra wrote: > > On Thu, Jan 03, 2019 at 02:18:15PM -0800, Andi Kleen wrote: > >> Nadav Amit writes: > >>> > >>> - Do we use periodic learning or not? Josh suggested to reconfigure the > >>> branches whenever a new target is found. However, I do not know at > >>> this time how to do learning efficiently, without making learning much > >>> more expensive. > >> > >> FWIW frequent patching will likely completely break perf Processor Trace > >> decoding, which needs a somewhat stable kernel text image to decode the > >> traces generated by the CPU. Right now it relies on kcore dumped after > >> the trace usually being stable because jumplabel changes happen only > >> infrequently. But if you start patching frequently this assumption will > >> break. > >> > >> You would either need a way to turn this off, or provide > >> updates for every change to the trace, so that the decoder can > >> keep track. > > > > I'm thining it would be entirely possible to create and feed text_poke > > events into the regular (!aux) buffer which can be timestamp correlated > > to the PT data. > > To rebuild kernel text from such events would require a starting point. > What is the starting point? The problem with kcore is that people can > deconfig it without realising it is needed to enable the tracing of kernel > self-modifying code. It would be nice if it was all tied together, so that > if someone selects the ability to trace kernel self-modifying code, then all > the bits needed are also selected. Perhaps we should expose another ELF > image that contains only kernel executable code, and take the opportunity to > put the symbols in it also. Meh; you always need a magic combo of CONFIG symbols to make stuff work. We don't even have a CONFIG symbol for PT, so if you really care you should probably start there. If you want symbols; what stops us from exposing kallsyms in kcore as is? > Also what about BPF jitted code? Will it always fit in an event? I was > thinking of trying to add a way to prevent temporarily the unload of modules > or jitted code, which would be a good-enough solution for now. We're working on BPF and kallsym events, those should, esp. when combined with kcore, allow you to extract the actual instructions. We don't have module events, but I suppose the kallsym events should cover module loading (a new module results in lots of new symbols after all). With all that there is still a race in that nothing blocks module-unload while we're still harvesting the information, not sure how/if we want to cure that.