Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4549457imu; Tue, 8 Jan 2019 02:06:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN5eKDiZBlOPmLSSXqfb3K+pJA0m3A0HbgVt30Es+x7vxUNYKQKEJbY/Wx1ubbAIU5otK2xO X-Received: by 2002:a63:8b41:: with SMTP id j62mr969135pge.182.1546941961617; Tue, 08 Jan 2019 02:06:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546941961; cv=none; d=google.com; s=arc-20160816; b=be1pL2oH/c3FY0VJX8g8Zn4nDHkPJ7T7Azy16wlCOy+uBZz3oynCFhKZ7Ok5m71/XZ RVkkT92agsqzHAiyX5H0bk4r9u+kARpy4NJ/5mUKXwlB8ffU+/y/OftwdCH6gLqX3ZYI bhOH8MrCG0DjzUFKgE/8CckLDZtnZ/IbiF4qUlYSKDcvpxQJ/RD/KrsHz0+TcOjFFh51 PTXNgLYkKk6X57JhQyKx0WHxSxIQ75JUUyHq7khpWuayYIWv8yDFVN51vPVyxiDm03yK +a6g2nssQUhuIt8Pm5sHhyg5Mswr/p7d8YHtI0OB/7DUBf4Kkd9sgU1z4ZwTsv8rnR/7 ruBg== 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=D+85BX1xv0ed5L14TyUjnU4a5UfMNd6z5kt+JKOSCwU=; b=TfmxRBrYT/fZ9Nfo1Of+eQMUczaM5X5oL1vp4/ua1CsavQ/lYCpuAL/h864PYWQkNS BHpy4UMQFTcH2DTqNZlhavxZssrB5sPZtAqcd/3IMMLoHaedv+hzsZ+ALT9pmP1HAEaQ uOAOQHbzP25iRs4Nxr3EQFEXfABtA58bpOea50FctFDeZ+aQhpLCW6EXMpu3y4eeA9a+ PxPY2P2V1nzB6WMLH0x3bZ/x8TRJErora92FSeU6uTutNR2LRTJPIYaggWPpLA+odFUD 0Vp+MucMbAbq/3S4MpC00Hqx3xYbkk170Oe5sEBAqC3sgpbYG+7alRHCy5RASPY1dc9X 6L2g== 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 b131si51271629pga.394.2019.01.08.02.05.45; Tue, 08 Jan 2019 02:06:01 -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 S1728632AbfAHKCx (ORCPT + 99 others); Tue, 8 Jan 2019 05:02:53 -0500 Received: from mga02.intel.com ([134.134.136.20]:26948 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727001AbfAHKCw (ORCPT ); Tue, 8 Jan 2019 05:02:52 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2019 02:02:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,453,1539673200"; d="scan'208";a="116389408" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.56]) ([10.237.72.56]) by orsmga003.jf.intel.com with ESMTP; 08 Jan 2019 02:02:46 -0800 Subject: Re: [RFC v2 0/6] x86: dynamic indirect branch promotion To: Peter Zijlstra 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 References: <20181231072112.21051-1-namit@vmware.com> <87zhshe66w.fsf@linux.intel.com> <20190107163227.GH14122@hirez.programming.kicks-ass.net> <20190108092559.GA6808@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: <306d38fb-7ce6-a3ec-a351-6c117559ebaa@intel.com> Date: Tue, 8 Jan 2019 12:01:11 +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: <20190108092559.GA6808@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 8/01/19 11:25 AM, Peter Zijlstra wrote: > 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. The problem is that the jitted code gets freed from memory, which is why I suggested the ability to pin it for a while.