Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1239311ima; Wed, 24 Oct 2018 17:28:31 -0700 (PDT) X-Google-Smtp-Source: AJdET5czwaoXQpqizh/IwclRijr3u8rH8FDQJPzMke1xdAOGgng4O1KzcyEaDIVJJPlS70dT3tYp X-Received: by 2002:a63:bc12:: with SMTP id q18-v6mr4365624pge.353.1540427311707; Wed, 24 Oct 2018 17:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540427311; cv=none; d=google.com; s=arc-20160816; b=qjSi85NZB7cOrffmF5JxQMBDvMVUQYv6QgYrNR+B0UO5mzS2H37dsOQh9hj7Zp0Y/f hEabPvMukOZlLOi4Pln5d3ThbuWUPP486WLY9PEGP+roKx2okUT6r/VfwPNa902bblU2 za4UqOdeRWK1vi7RbDBrGeUXkDRfuQMXgYWQasEzcpNfPiCQbFi4/bf0hh8Q12n1sYXK 8jCf6kaXcSGAYMSZDJSrr3xA4uU8axy5DE+Z/bcu+KWMRuYCoO+2/FDox9fRcXXdO0nZ ZFnHnmWKakqOQJ+6sp8CBCFsikMJI+1XEiIGGEPr8fYF1WZVRd8nZD+6YvbETYVXx2zK VXUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VfaDUHETRy8/0Wh/vIwSpCThnNBKJKuvSaiBs8l7RiU=; b=AJAvTJno5eox+Oj0Me0x4+7YF7VM/C2i/tTfN+ieROLw/X6W57csrVIFzKt4YXLtnq umnq/MBSo2/sKh+MnUzh27E+JWDUvFvcE83rKOXsjLP0p3mG/UUunFXlZFtdqZbTTsgB U0ZClFYg7U1ebty/1PxRq/8WRJOKSxkY3NzNB5O6vbzv87eZR+V51AQGOxVleXJVNhJ+ PKS4VRmWym6BeXa1vv7KYqqFCn5lojLEhSgCu7GULrfgzvIg+NwtlJCiwA0jY6QRHFNp jCYS1d1/inmWc5HvjvZudII71SlAFwqVszjh1JgtmS/dSaCy1lfuXHZeRcCXya4N0gHa oeRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=GAENQegQ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f19-v6si6335594pgb.465.2018.10.24.17.28.15; Wed, 24 Oct 2018 17:28:31 -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=pass header.i=@google.com header.s=20161025 header.b=GAENQegQ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727228AbeJYI43 (ORCPT + 99 others); Thu, 25 Oct 2018 04:56:29 -0400 Received: from mail-ua1-f67.google.com ([209.85.222.67]:38975 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726117AbeJYI42 (ORCPT ); Thu, 25 Oct 2018 04:56:28 -0400 Received: by mail-ua1-f67.google.com with SMTP id j38so2583490uae.6 for ; Wed, 24 Oct 2018 17:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VfaDUHETRy8/0Wh/vIwSpCThnNBKJKuvSaiBs8l7RiU=; b=GAENQegQFp2kSFQw2iZotCEyEMUCoXLegLYeNCiITfL54JwUbs3Na0cLB//qv0Mf1i lM5r6kzrbVam8BL4KSdMyRbOLy2DZhB50KfIjdZcKr1YyRPGasSs424ISEMqXR2ujWuw G2xjFac0aPwDr9CPk5EzaoLQIN818oVkkusS9+A4CMXitgOom5FFgxHNjV5AKVfWPU1R WWEkCX6iTccupIeTdkwCPUI2sECf4sVpOMhp59mHe0kJiwqBDRvfORi7ypM37MkfSkKZ pSyilKN7AzQ55GNEF4ix5AKeCldPL7N90Sd7+hgz4+XP5c0PK0WgtXrTcsUs0Sn9xIHj yWNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VfaDUHETRy8/0Wh/vIwSpCThnNBKJKuvSaiBs8l7RiU=; b=rNbB/cW85KF08KzWefHuEPcHi8xmKZMQaUPnPtXupyvtvRr/Gm1p0EmvGUHZI6izWv QKr6XrpFZqbY+F8MyFrprdNy54VziyKWsH9ZbXBP8IUiwCDBQ++t8h7fV02HlJfPRGCS h+eaqn3Davu+dp6mFmrFaPbf9NXKTU+W1oktFhY3fLmb/5kel17oIUt2bQZNu9tjl6V1 ckIeFQKuxOBoE5uPGWnUgLYO99mAAOHsrvdwja9titYwURcdirqvN3VjmxOr2mkDdfMR nWvEEhzQcourxzlBqG/QQ8n5K0bGnxPsoqfSnepqlCOLZ35LbuRUiwSNsB6DfsAgUL9f CNfg== X-Gm-Message-State: AGRZ1gJJr02Pc850Yr0hIt058aoyclzCcW1LDFW5QGre3f+8kBwgkwmL sOqB5rXpWEX8kiQ0tBohWjM25dKvmVjHy9FOuOL3TvgQS/4= X-Received: by 2002:a9f:3b27:: with SMTP id i39mr2313865uah.101.1540427171082; Wed, 24 Oct 2018 17:26:11 -0700 (PDT) MIME-Version: 1.0 References: <20181024151116.30935-1-kan.liang@linux.intel.com> <20181025002312.GS3109@worktop.c.hoisthospitality.com> In-Reply-To: <20181025002312.GS3109@worktop.c.hoisthospitality.com> From: Stephane Eranian Date: Wed, 24 Oct 2018 17:25:59 -0700 Message-ID: Subject: Re: [PATCH 1/2] perf: Add munmap callback To: Peter Zijlstra Cc: "Liang, Kan" , Thomas Gleixner , Ingo Molnar , Arnaldo Carvalho de Melo , LKML , Borislav Petkov , Andi Kleen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 24, 2018 at 5:23 PM Peter Zijlstra wrote: > > On Wed, Oct 24, 2018 at 12:30:52PM -0700, Stephane Eranian wrote: > > Hi, > > > > On Wed, Oct 24, 2018 at 8:12 AM wrote: > > > > > > From: Kan Liang > > > > > > To calculate the physical address, perf needs to walk the pages tables. > > > The related mapping may has already been removed from pages table in > > > some cases (e.g. large PEBS). The virtual address recorded in the first > > > PEBS records may already be unmapped before draining PEBS buffers. > > > > > > Add a munmap callback to notify the PMU of any unmapping, which only be > > > invoked when the munmap is implemented. > > > > > The need for this new record type extends beyond physical address conversions > > and PEBS. A long while ago, someone reported issues with symbolization related > > to perf lacking munmap tracking. It had to do with vma merging. I think the > > sequence of mmaps was as follows in the problematic case: > > 1. addr1 = mmap(8192); > > 2. munmap(addr1 + 4096, 4096) > > 3. addr2 = mmap(addr1+4096, 4096) > > > > If successful, that yields addr2 = addr1 + 4096 (could also get the > > same without forcing the address). > > That is actually a different problem. And you're right, we never did fix > that. > it is a different problem but the solution is the same: PERF_RECORD_UNMAP! That's why I mentioned it here. To show that this is needed for more than one reason ;-) > I agree with you that Kan's Changelog is somewhat cryptic; it took me at > least 3 times reading and looking at what the patches actually do to > understand :/