Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4449973imu; Mon, 7 Jan 2019 23:55:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN6be3mX9Y6Z3yap1nL5OdD6+e0hisTVCcdiBsIiMFLqfV/qmbUfhvUXKvz5ACCuMFOaKIua X-Received: by 2002:a65:4b82:: with SMTP id t2mr623915pgq.189.1546934146866; Mon, 07 Jan 2019 23:55:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546934146; cv=none; d=google.com; s=arc-20160816; b=fdFVLJljh++JQXS9d1WK7c6QxGbR9D27h7YRabF5jE6slsNRrOt2QTs9WaqNIvdSoD bNXVQCKniGM6q0mkr+Z3+rOvuue7PkCADjEXZKtEAOSNYdxnF4+BaWkxqkgyXn/zG5tp boS/2jKOPTvy1jAYx+aOGYUfHQL9UMunzOEvFcmOf1u6fMAk79lFk+n2uAweAJHsgsP8 qly7am7TezltTxSojCgocU8dFfpGFBaFOhyoPbh1KQ3AJoGop+qJCyMUxKA+ITFReJTp xZUUV+pf1j/yxneiJwieFmpdDqE4P4ZnwdymDrB9gyp+Grv2KACU7hSMaKusXmIaSrDO PCJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=bLG4WYftlaQc+4zBuhqxr/ImPkWO/frzY98ggZMdIac=; b=o9ODl+lzuOwSOXstlTS6S8NigmON44VcsnC7jjxMzdMjHgcgvfoachlvuBsZSFyba7 8cKYkQt77SyaUqSJr7ozNyxKP+BcNBZ8bQ1CDksxKV+F/8ZN+oNKv8JmBhtQ9ImeDRvO DYLvgEnbAv/99EUIZb0aKF7YUz1ulaF5tgWkClP6uOeICSb5jhqGvEe7USiKQRxVyY99 Q90++psK6nlHh8AQ466O4iv/4uuA6wc9FDTIZWWIaLewg+gZnjdBJjKSRE79dOhaKCM4 QfLPZKR3muLK2qIQpEeBoF9qTc8gYFIDmfI9vdYUIsqf3uWhyyukThPefEAXdBaiOyVo Sf5w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si46378561plp.130.2019.01.07.23.55.30; Mon, 07 Jan 2019 23:55:46 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727821AbfAHHyA (ORCPT + 99 others); Tue, 8 Jan 2019 02:54:00 -0500 Received: from mga11.intel.com ([192.55.52.93]:31333 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727295AbfAHHx7 (ORCPT ); Tue, 8 Jan 2019 02:53:59 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2019 23:48:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,453,1539673200"; d="scan'208";a="132579697" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.56]) ([10.237.72.56]) by fmsmga002.fm.intel.com with ESMTP; 07 Jan 2019 23:48:53 -0800 Subject: Re: [RFC v2 0/6] x86: dynamic indirect branch promotion To: Peter Zijlstra , Andi Kleen Cc: 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 References: <20181231072112.21051-1-namit@vmware.com> <87zhshe66w.fsf@linux.intel.com> <20190107163227.GH14122@hirez.programming.kicks-ass.net> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Tue, 8 Jan 2019 09:47:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190107163227.GH14122@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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.