Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1720642pxb; Fri, 10 Sep 2021 12:12:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEXhiBl5XEFowqykqhQn5W6mzgHkH3sqgTvJ+/eoeIqRzPyNXFXBiGbaxL4BNXT09UOqyI X-Received: by 2002:a05:6402:348e:: with SMTP id v14mr10545076edc.123.1631301140155; Fri, 10 Sep 2021 12:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631301140; cv=none; d=google.com; s=arc-20160816; b=GHCIy0qOtAPeveAkUxRlY4P8/v/F7oC3KIUjRFY6H+gmP7DMl1a+IPr2jm0IHebeRA WbIRDIGFaKxrdqv3l2J509Wum4Ikxm4Cpwqe86saWNxiInMjSQSpdNgGF4VT/6tgrXmh R5Yac2cOPCPPY9I81c9BQFbH5FblYRN+VsHyDG2/Cg7jUbEBC/JQnCgz4zU1oxmbWxgM rqx1xufBl8pfKVsMOzzeELdlV1yTd2V/LeznB0HllHz9XXk/vZkfC3jDeJZAprV7Ajdz Vw9sTlUyy9s0xDElqRfeAgyUuEPbFaNqUiaNSFT8EcYt7r7hDT0DA9N1oCD2IjzWE6af ot3A== 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=RvbOKws0vugnzCKuDTONgPld9Ii4J9dkZzNenEfUNqQ=; b=w0hNIkk8exkGMFz88JB2nPSBXPA0Yufevnv9Arjl2sm5cT5+Ku8sCOLpHzCU9Gvo9d 0VTahfxYU6dfO27jX8QVT5r3D1hTkiZSEeMLE56ILpyxSZ7eXIsq2s9jBFd6d3FJMiab yRiZhS3n3sluWd8mFoCgEaVrTto5DlKjoE1uUBp4El8RKN2TKcnE7bewZD8zi2+4rxK9 7dX+vl/L2DqxnZeM4JUdylmQL0JKeGowgNTgRri2FMVHIdK5wFeYDRvQxKSDVSmRDFWQ 58uophqcvOEIpjGVWZdc7MPlegwfPTD7Veq7vyJNB9QNAfZxjPwjdD7nGUbB9NJiuVmM v2nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=lEb37XTI; 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 i23si805857edr.582.2021.09.10.12.11.56; Fri, 10 Sep 2021 12:12:20 -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=lEb37XTI; 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 S232258AbhIJTJc (ORCPT + 99 others); Fri, 10 Sep 2021 15:09:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbhIJTJb (ORCPT ); Fri, 10 Sep 2021 15:09:31 -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 57E9CC061574; Fri, 10 Sep 2021 12:08:20 -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=RvbOKws0vugnzCKuDTONgPld9Ii4J9dkZzNenEfUNqQ=; b=lEb37XTIAAKxxFQZd/qjhReziA qvG9vN/kWb8vRH00OnuyV2Huaon4u9hYkWgGGy0ivwB01bHyInZP6t+UqQaoinoLYOGNaZAWIVAqe aGFAc1U1uoTjdoEa8EdYIpyQBT/GmAYf6ZhJtaiMtz7J6MEetoaWfjnioacDmDeKFBn36RI9LrHvK jfxGG1Uv1FZmZEgttfgIVznKLk+vd85IowrSXWo50Xr6NrH1SsoS654YnKwg1CH2j87Z07GdS+pr9 snKUB7Iq6yM9yyJg0emhYGSvFjOr/63hJD6xot+O/YeMTkIhtk4tGzLGqX7KBSV2CJOm/6Ql26IN7 rq0d3vqw==; 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 1mOlsb-002CBg-DA; Fri, 10 Sep 2021 19:08:07 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id E00B198627A; Fri, 10 Sep 2021 21:08:04 +0200 (CEST) Date: Fri, 10 Sep 2021 21:08:04 +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: <20210910190804.GS4323@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> <20210910185003.GC5106@worktop.programming.kicks-ass.net> <6830FC62-995A-4282-BD30-76E2506ED993@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6830FC62-995A-4282-BD30-76E2506ED993@fb.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 10, 2021 at 07:00:08PM +0000, Song Liu wrote: > Hmm.. not really. We call migrate_disable() before entering the BPF program. > And the helper calls snapshot_branch_stack() inside the BPF program. To move > it to before migrate_disable(), we will have to add a "whether to snapshot > branch stack" check before entering the BPF program. This check, while is > cheap, is added to all BPF programs on this hook, even when the program does > not use snapshot at all. So we would rather keep all logic inside the helper, > and not touch the common path. Moo :/ Because I also really don't want to expose struct rq, it's currently nicely squirelled away in kernel/sched/ and doesn't get anywhere near include/. A well, maybe we can do something clever with migrate_disable() itself. I'll put it on this endless todo list ;-)