Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp268914pxb; Fri, 3 Sep 2021 01:30:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSe1ZPKfeOI+duq/sLzU1EHrIRMI5q0SSsSvJarYgxswe4YNRpOwQ05ExWp3hKecbo+U0s X-Received: by 2002:a05:6402:27c6:: with SMTP id c6mr2799740ede.111.1630657826670; Fri, 03 Sep 2021 01:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630657826; cv=none; d=google.com; s=arc-20160816; b=n8396nQiSK78FehLHPdBwa/Ya+Wl5+vCyoVrZo+VdUAJ1LZnm8SMGThgw82A8nmm3i 9A4Vv7e5ZB9oQ5/TImj7lCyW9DAJO+pYQN+ZWHlm3w6h9Ey34whCLwPl8k6D3dyjYslZ YBwHABRTetD5FHw8FdrUVcRNwY6+CEQcKG/nYjHj6X0akM+cIUDXcmAHthk8RIRZW1He +NpDKD67r6OwGpS79/TgQzCphjL9QMrd0if86jly6oG0y/PEqYNZnUWJRAPbjuqJL4iY MAehEyyS9q2CPUpffOMzj5xqINlLBmyGONpHsqd2tMefYW7SLDKUKhD4FHY/+rT2k7M1 N3Aw== 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=++jm6oY+bJJxusAX097iIXvKnGM0fjw8N41n/TI3ISY=; b=hKdZaxMQV+PoKRn/j1agknAVWedoMjjYw1Q3r5caPipa+v8Q/yZV5bQVgHS0lEM/09 gv6tMCMVu9S+DNsDYDxDBebBQK+sjB6fUgjeNkixl7bw32RAbqz86HY3g5NVIKofs0c8 nKg7hJgClb74EdJRBDtMYTa22OX6sr6hvE8AEFUx4sEAAVvqoahKU4TzIjRBZ5qboTrz 619MEQVJ/6KI5cIflMswiIT+lwGmzq3dGc9QLpK98kDioTVdDCQ05eky8YAnuG6iNPnp o3ufAzPou8bYqz+irS1mbhwnY1n23b8kN2UDMGrRLFClZA2mI1zN8ah3ZSnivCR5ccfk bLxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="ils+FN/b"; 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 r24si5174423ejy.432.2021.09.03.01.30.02; Fri, 03 Sep 2021 01:30:26 -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="ils+FN/b"; 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 S1348302AbhICI3b (ORCPT + 99 others); Fri, 3 Sep 2021 04:29:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348314AbhICI3N (ORCPT ); Fri, 3 Sep 2021 04:29:13 -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 B61A5C061760; Fri, 3 Sep 2021 01:28: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=++jm6oY+bJJxusAX097iIXvKnGM0fjw8N41n/TI3ISY=; b=ils+FN/bFNcs+IBDKlS7DNCP2B srlVriyw9vZaH9rLy2nFJVzSHspBEAWpe2fnOS4rTENRRQXMo+8pTpCk5Y47zVHQcd0GWqeD+wkN1 lMMJ6sJmcS7UIlHzZ3+LTqdAOsINinU6QMmhZxqlW+69vWGuCLrMskghcApastuTRlYhXkdwz6rOn uO/uXt/JixCfNOeJEJZh/avEvp6q8faMW29OnbrLYC9h2ydadcU4UglVJTLk5b/dR+/Hfd2X1BOlb fnZqFQ7qf2ZPgQ0/vbJWtj7YI+HO/MZrdDZ/gkK7S9LJc9vB7SZXfv1hKUTAkX9LY0EOM4mxMs63Q /rj+GLHg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mM4YN-000JKU-HS; Fri, 03 Sep 2021 08:28:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6107630024D; Fri, 3 Sep 2021 10:28:02 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5225D28B658E6; Fri, 3 Sep 2021 10:28:02 +0200 (CEST) Date: Fri, 3 Sep 2021 10:28:02 +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@fb.com Subject: Re: [PATCH v5 bpf-next 2/3] bpf: introduce helper bpf_get_branch_snapshot Message-ID: References: <20210902165706.2812867-1-songliubraving@fb.com> <20210902165706.2812867-3-songliubraving@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210902165706.2812867-3-songliubraving@fb.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 02, 2021 at 09:57:05AM -0700, Song Liu wrote: > +BPF_CALL_3(bpf_get_branch_snapshot, void *, buf, u32, size, u64, flags) > +{ > +#ifndef CONFIG_X86 > + return -ENOENT; > +#else > + static const u32 br_entry_size = sizeof(struct perf_branch_entry); > + u32 entry_cnt = size / br_entry_size; > + > + if (unlikely(flags)) > + return -EINVAL; > + > + if (!buf || (size % br_entry_size != 0)) > + return -EINVAL; > + > + entry_cnt = static_call(perf_snapshot_branch_stack)(buf, entry_cnt); > + > + if (!entry_cnt) > + return -ENOENT; > + > + return entry_cnt * br_entry_size; > +#endif > +} Do we really need that CONFIG_X86 thing? Seems rather bad practise.