Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp715617ybg; Fri, 12 Jun 2020 12:38:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxw7xDIc4R392z77JhwsUgz89BOh75di6q/sy4QbN7i5Xem7M3Zu/oKm4lSAYPE6aiZEGuz X-Received: by 2002:a05:6402:70b:: with SMTP id w11mr12902897edx.251.1591990697546; Fri, 12 Jun 2020 12:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591990697; cv=none; d=google.com; s=arc-20160816; b=PtYdYtneUCQ0pwcPv0oau9cWDE5/2VCvzeYNJOpMzxZRLLzSrbpmVAli7sRRkSsjqH D98Q6tbR4OzC2f625KKoqe238F5/VA+Xt2tDVDBwKaDgOM6E1zQDXCUWDMfpwc5BqvHW SvPCCMP+Znktry923NBWLk9M4YAGUuNyVgBuYo7lrGpuSsefTgEZ5w78ARDmqghiRjwZ s2VI++zLUnCnpNCe1Rk8C4tjDljkLoZ3/uL90SYjjGjDElBZ5m2LR9T1XQ1Ni/W2Y105 +RkJc0beXhiU+I7qemOdVLtaYWPjOQynP7piY5o4ZNewtHL40JHhojnGHKAnHggIBFAM 2JGQ== 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=mswfdgdzx+2TexQxeT06feX4kOyrZlalUeDchfsNWxg=; b=t3/AtH+y69UG780lRzoR0NTKA/traeJtewGsUvJNQ3+l8XUG/rENtbYN8hGXvZtMeb HFBbCPiD9FzSn6RelyahG0aI23jkmQVP7/SMN/xCuEGM8X2XqoPDoJL+k0GgJYoG39Vp GmhSPOtGeV8tW55eS5/IBHYuZjmqOJCUjDXilNEjoWURMZe3QuAQ0e9iOPT5KPx6LFRt 75pJ0XfXEL3OvuFWlWYLJ/XhZbX4nacp5BykvPHx6pnAtc52YQM2LY9DfRFJQfrR/CVk Jv+r1W/ugvj3kN6Zyv7nZu/BY8nq10HbYd4PUZCp9lOUf0FIRiWDDO3Y3zadEbEn+Qgm eAvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cgQaVUl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id g1si4135177edv.486.2020.06.12.12.37.55; Fri, 12 Jun 2020 12:38:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cgQaVUl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726396AbgFLTd5 (ORCPT + 99 others); Fri, 12 Jun 2020 15:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726290AbgFLTd5 (ORCPT ); Fri, 12 Jun 2020 15:33:57 -0400 Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67B55C03E96F for ; Fri, 12 Jun 2020 12:33:57 -0700 (PDT) Received: by mail-yb1-xb43.google.com with SMTP id d13so5437426ybk.8 for ; Fri, 12 Jun 2020 12:33:57 -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=mswfdgdzx+2TexQxeT06feX4kOyrZlalUeDchfsNWxg=; b=cgQaVUl66dmOWC5t0q3/ouZypSbshyuwE6f80bk75brPARaM0MyTEqK2QvKyQEdslB JiBb5IF/nTPwxEwj9coEf1MpKefh/4ghrl5zdfBGzfbA+y2fmlRYHkw1gT+r7n0wwojU Z0UpOpKEcy8sD/xcKIaQPgKwEEXSQuYHp9IvPZyYcRxRdM8ndsXwiLLVQzbx5nbx7wCS H2AOE1WDRMQK3sw072a0x77kDVOlcV/Kb4fyCK7+jm3QFuOxDn6HQlaLGXd+8mvHbQwu p6bBI/lajbUu245jV8YT6ZWyYNZWWrNsQKVbqGuJ/N08pW2IyRSmVdeRqueRBCv7G6nz 0n+A== 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=mswfdgdzx+2TexQxeT06feX4kOyrZlalUeDchfsNWxg=; b=fIQHNh+mHd584SI/me5W+WwMYCxtPn95sOu7dDWr3aMmW7b4kjpNB8c2art254Lm4W p2/WdNEq/ixKVQn0KTLXpdZQiFUYdIL+E274vgL2VM5kjgFgvUgA+wXVBAPquML/PJNm NHCwVkODJjiJEWRfb6lSlZ1uNNnnEMWHnEGs7MVk05mwzWdeXS/1uc8+tXIfpr/WXoEu AX5QTqCaXDwYkQ+UEmzXtnbzgeUMP9HAOlNZ5s31irfvYvm0Zn+XUVuxpt2ABuXfueEB zGSluHnq8Fl5HVzy8Oc6Un4fpGrDKT5ilNyG+bgLCW9kUXTOjKwtUAVDuFrAKh3K527d CFWw== X-Gm-Message-State: AOAM533gI4XD65QilzvdusXcgTBTQ6hkQ/rPwg5qfxjIm3AogoQoM1Pv ZpwsyYU8wc4iJ7hOordnQ7rS/VhHmVcXtgcoC/Fwrw== X-Received: by 2002:a25:504d:: with SMTP id e74mr23139770ybb.47.1591990436306; Fri, 12 Jun 2020 12:33:56 -0700 (PDT) MIME-Version: 1.0 References: <1590544271-125795-1-git-send-email-steve.maclean@linux.microsoft.com> In-Reply-To: From: Ian Rogers Date: Fri, 12 Jun 2020 12:33:45 -0700 Message-ID: Subject: Re: [EXTERNAL] Re: [PATCH v4] perf inject --jit: Remove //anon mmap events To: Steve MacLean , Arnaldo Carvalho de Melo Cc: Nick Gasson , Steve MacLean , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Stephane Eranian , LKML 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 Fri, Jun 12, 2020 at 12:00 PM Steve MacLean wrote: > > >>> Hi Ian, > >>> > >>>> I tried this as well with latest perf/core. The difference is that > >>> unresolved addresses currently look like: > >>> > >>> 0.00% java [JIT] tid 221782 [.] 0x0000ffff451499a4 > >>> 0.00% java [JIT] tid 221782 [.] 0x0000ffff4514f3e8 > >>> 0.00% java [JIT] tid 221782 [.] 0x0000ffff45149394 > >>> > >>> But after Steve's patch this becomes: > >>> > >>> 0.00% java [unknown] [.] 0x0000ffff58557d14 > >>> 0.00% java [unknown] [.] 0x0000ffff785c03b4 > >>> 0.00% java [unknown] [.] 0x0000ffff58386520 > >>> > >>> I couldn't see any events that were symbolised before but are no > >>> longer symbolised after this patch. > >> > >> I see this, thanks for digging into the explanation! Were you able to > >> get a test case where the unknowns went down? For example, by forcing > >> the code cache size to be small? This is the result I'd expect to see. > > > >I tried the same Dacapo benchmark as you with different values of InitialCodeCacheSize and grepped for -e '\[unknown\]' -e '\[JIT\]'. > > > > Base Patched > > 100M 338 373 > > 50M 333 315 > > 25M 323 368 > > 15M 1238 309 > > 10M 2600 333 > > 1M 6035 337 > > > >This looks fairly convincing to me: the cliff at 15M is where the code cache starts needing to be enlarged. > > > > Removing the anonymous mappings causes a small regression. Specifically, > the reporting of the module name goes from "[JIT] tid " to "[unknown]". > This occurs when the JIT fails to report memory used in jitdump before it > is used. > > However there is also confirmation that JAVA does see the reported issue > when using a small code cache. The current patch resolves the issue in > this case. > > I see two options: > > + Accept the regression. Since this is a regression for a jit dump > reporting synchronization error, this may be a reasonable option. > > + Design a more complicated patch. Either > + Only strip parts of // anon mmap events overlapping existing > jitted--.so mmap events. > + Only strip parts of // anon mmap events overlapping prior > // anon mmap events > > Any opinions? Hi Steve, I think we should merge this change. I wanted to get a test case together showing the benefit. Based on Nick Gasson's feedback I was trying with command lines like: /tmp/perf/perf record -k 1 -e cycles:u -o /tmp/perf.data /usr/lib/jvm/java-14-openjdk-amd64/bin/java -agentpath:/tmp/perf/libperf-jvmti.so -XX:+PreserveFramePointer -XX:InitialCodeCacheSize=10M -jar dacapo-9.12-bach.jar jython I wanted to be able to demonstrate a non-zero effect in getting samples. I spent limited time on the test and didn't get a result that demonstrated a benefit, things weren't worse. I think the lack of benefit is another bug where HotSpot's JVMTI code runs in parallel to the new code being available in the JIT cache. We get samples ahead of when the jitdump thinks the code is there and so it symbolizes them as unknown. We should get HotSpot to provide the earliest timestamp to avoid this problem. I think a good way forward would be to merge this code as other issues can be fixed as a follow up. Arnaldo, does that work for you? If so, Acked-by: Ian Rogers . Thanks, Ian