Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1708312pxb; Fri, 10 Sep 2021 11:52:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKkn6cZeFYS0utQ3e1ueotNpVituYo/f2wBoFXFe3b9VHATw50IKTbabAwvulbbtsR9Ypi X-Received: by 2002:a17:906:3685:: with SMTP id a5mr11175884ejc.144.1631299927881; Fri, 10 Sep 2021 11:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631299927; cv=none; d=google.com; s=arc-20160816; b=CBpDBHXuglbAso+DjWtMZ3kLu3E/FTVWShn63ufmDHkSW87QlimNkd0oWzoECMY1ef 90/Y7QDEkzb4gPMzUHPYpz4bZQHmuf4cee6VLieumLb0EiQ9fpIk9uB362AoFSuOFL1C U7oUNGR0IWwG7vmD5qNZYN0GYEnZ6Ex+YEZjk1yKKWRtnbwr90u652tbcoCxXM/hKX+a TbguZnRHQmaWdDX1GUpuffF6a6WyIAPwWRety4b1zBSjvW1mvAkDWQzV1QQy2LeyJNJS FRiK1dhtYYDumh3yW9EYs9mVnCT/9zi/44HqRRUSB+yS73gxi3y24AGZ6JMHaNao4JgA YPeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TJqZkDiudSfpKSVBnK+BZjQrmCRticHK6VbyrN5mug4=; b=NyNRwHugwur9kgEikcmheQTva6vsK6LHrWv/QOVGz+zR4itvk13Kgl1Pn0eewkUJOw 5ay43qGz3IGWHvWViKr78Y21wJQQN+k4iKWJFMJNpPepYaCQlbiZJA20BEZ1fEwpYMzk MMBBqQtyAbakSZZ++fSpiQQgpUfJQIDtcLqKhK+kr3jK2b0I27ZoPyuBNeUE/NYEtb+e zYLv+X56xVceYHFbEHM6V15t5MTEFaBJGBDj5pHuqlNin6OzRlFFIH/k8UD2IbCWC8eG IiJD/TqTTuvYdhZA4gLiCnW2iu/U2v4ZutPZ2Lsl/Z2J6U1+tfMUOnMDXZZmZz8MpCay egGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="J/x7SAyr"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si5511517ejy.236.2021.09.10.11.51.43; Fri, 10 Sep 2021 11:52:07 -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=@infradead.org header.s=desiato.20200630 header.b="J/x7SAyr"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbhIJSvZ (ORCPT + 99 others); Fri, 10 Sep 2021 14:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbhIJSvY (ORCPT ); Fri, 10 Sep 2021 14:51:24 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F87CC061574; Fri, 10 Sep 2021 11:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=TJqZkDiudSfpKSVBnK+BZjQrmCRticHK6VbyrN5mug4=; b=J/x7SAyrhZDzIvdq5E7GI4wR1G yVVoFbVD71804A0/pq+ptAWRQeh4L/lMOECfVtiWfnm31FEYJN8cSnFb0Q8Uj0Q617GdCglHSGo3/ 1UC90e2cp0qKN9LVDAANxeyQQXvADmEkXPwOtC1jEoiKIvPICqE4gibwZuW3l5FM+PsvSCqgwc/qt N7PkBVh59zinlrIMKOCY5pSPK3I4T6AwF/IAQVozrEu5nQvxd05elLueors6DrFeULuEsC/2b35gH Ev1UwBceNAJyPYq6/oUTRJIPffCGBzLfI4QHGpOj0iRvsuZ4HsRymjgovRKzuavJb0HE5XlGvc4K8 poI3zVAw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOlb9-002C0h-Rx; Fri, 10 Sep 2021 18:50:04 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 71BE198627A; Fri, 10 Sep 2021 20:50:03 +0200 (CEST) Date: Fri, 10 Sep 2021 20:50:03 +0200 From: Peter Zijlstra To: Song Liu Cc: "bpf@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "acme@kernel.org" , "mingo@redhat.com" , "kjain@linux.ibm.com" , Kernel Team , John Fastabend , Andrii Nakryiko Subject: Re: [PATCH v6 bpf-next 1/3] perf: enable branch record for software events Message-ID: <20210910185003.GC5106@worktop.programming.kicks-ass.net> References: <20210907202802.3675104-1-songliubraving@fb.com> <20210907202802.3675104-2-songliubraving@fb.com> <96445733-055E-41E3-986B-5E1DC04ADEFA@fb.com> <20210910184027.GQ4323@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210910184027.GQ4323@worktop.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 10, 2021 at 08:40:27PM +0200, Peter Zijlstra wrote: > On Fri, Sep 10, 2021 at 06:27:36PM +0000, Song Liu wrote: > > > This works great and saves 3 entries! We have the following now: > > Yay! > > > ID: 0 from bpf_get_branch_snapshot+18 to intel_pmu_snapshot_branch_stack+0 > > is unavoidable, we need to end up in intel_pmu_snapshot_branch_stack() > eventually. > > > ID: 1 from __brk_limit+477143934 to bpf_get_branch_snapshot+0 > > could be elided by having the JIT emit the call to > intel_pmu_snapshot_branch_stack directly, instead of laundering it > through that helper I suppose. > > > ID: 2 from __brk_limit+477192263 to __brk_limit+477143880 # trampoline > > ID: 3 from __bpf_prog_enter+34 to __brk_limit+477192251 > > -ENOCLUE > > > ID: 4 from migrate_disable+60 to __bpf_prog_enter+9 > > ID: 5 from __bpf_prog_enter+4 to migrate_disable+0 > > I suppose we can reduce that to a single branch if we inline > migrate_disable() here, that thing unfortunately needs one branch > itself. Oooh, since we put local_irq_save/restore() in intel_pmu_snapshot_branch_stack(), we no longer need to be after migrate_disable(). You could go back to placing it earlier!