Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1713099pxb; Fri, 10 Sep 2021 12:01:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF/lKbzJyDoW+eUSxbyCQvfxPiGtQZWjjsUVJsWozdqkyCmoHNs/QV5NTFhzl5/g/NY1PN X-Received: by 2002:a50:fd98:: with SMTP id o24mr10331510edt.129.1631300475031; Fri, 10 Sep 2021 12:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631300475; cv=none; d=google.com; s=arc-20160816; b=HzaZtbctjKZVqCF+BXPezfKenr+eguWI2F65pfM89thYXosPiKQNYlPmVWptnYnUpa ttdz8uc5XHok1FIE5awGQo6dhdvoqhiSn7YQ5vNXMqfQSkyvVe33X7MWSOQkv8vutPkl PD+KVqTROpt+KPo9NRp5Q1nDlr0h9VFxCEAw192lihFB/yF4am+M8rrO9c5TQPTTNc3w LEaLqFLiP0po1te3GecJebNkjTHVsYs/K/Dr9gyoGXM2q6xK0Ph5SthYmjjG5UM8uVh6 sjxg87OWoUK1mhfI2n8gBm+f66rqo+cQwweALbCr00BYiJBxuActtj1Ns6yMcIQuwcIF J+DA== 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=9YGobc0SWIJL+l3HkzowCvjbKEJxnEkUTVIXD+Ukz10=; b=0eP1o5zsW1Mm0d76pTJgjiEJpocBXoqKaZBtt5TdlmdJMIAZJD9S7Ya1dYXHELiVoX JRiV66PSSHNblN8NFbHEDBUB36TRFZIPC1BM0evkB45NtTl7EoDKS0B2lSibfyIkfSJQ ZMoby+62IANT78/xe7AF4uHGZHSJXCLDOAfl/uvp4bFeuHfTLUY5WDOABoJIJ2NTARaO Ht4t72bVvCA5OMabMJLKTcEPJjb+XLzVJdQeh5KAZVwG/OHANlPO08bMkplIZtDpSDaj vTeInE1ZkOiKvDP39YrzS0Mx+5U85bDx4S7aCRLx1s6d4nsvfB+EqdrxX9LoGeiZmrnQ kvpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=AEI+C3YK; 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 qb16si7058548ejc.558.2021.09.10.12.00.42; Fri, 10 Sep 2021 12:01:15 -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=casper.20170209 header.b=AEI+C3YK; 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 S232577AbhIJTAh (ORCPT + 99 others); Fri, 10 Sep 2021 15:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbhIJTAg (ORCPT ); Fri, 10 Sep 2021 15:00:36 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E3D3C061574; Fri, 10 Sep 2021 11:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=9YGobc0SWIJL+l3HkzowCvjbKEJxnEkUTVIXD+Ukz10=; b=AEI+C3YKBw44VQ2KDAzFRRJz+r f63c/meakil2zhmGoVOnmu9l5JnOW7Mt8v7lnrSzgw4X/VVbdQDr/L6avxJwaqzmX9UYeTZPmQDQ3 MXoBXWZAMwT9hYx3aOdxyhVK+Bvu/Q5YofVCDHuWyZ3H4xFTZ2o+TQ/RpRnM8LdexOkmGmQyjk7Gn R4dSweNtfJ2b2K75zigVOYTOmJrkYaRR/UiR5gcc4BMZQuImuhKc5fmt6pD9U7p1fvoeYSvgaZ6RY b9aR9R/BXCF4vyjjGOUpL+NtQetwlvB3FL0avJNKmw+bUPQm/lLtqxynewjgLWcpQDezei7nqFXlb oeygdYXA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOljQ-00BH8Q-Py; Fri, 10 Sep 2021 18:58:42 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 00CF498627A; Fri, 10 Sep 2021 20:58:35 +0200 (CEST) Date: Fri, 10 Sep 2021 20:58:35 +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, Andrii Nakryiko , John Fastabend Subject: Re: [PATCH v7 bpf-next 3/3] selftests/bpf: add test for bpf_get_branch_snapshot Message-ID: <20210910185835.GR4323@worktop.programming.kicks-ass.net> References: <20210910183352.3151445-1-songliubraving@fb.com> <20210910183352.3151445-4-songliubraving@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210910183352.3151445-4-songliubraving@fb.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 10, 2021 at 11:33:52AM -0700, Song Liu wrote: > + /* Given we stop LBR in software, we will waste a few entries. > + * But we should try to waste as few as possible entries. We are at > + * about 7 on x86_64 systems. > + * Add a check for < 10 so that we get heads-up when something > + * changes and wastes too many entries. > + */ > + ASSERT_LT(skel->bss->wasted_entries, 10, "check_wasted_entries"); It might be worth pointing out that you can easily bust this limit by enabling all the various tracepoints that are still in that code, but that that isn't a hard error since that's not the expected use case. For example there's the wrmsr tracepoint that will inject 6 or so branches on top of that you now have. And I also think there's a tracepoint in local_irq_save() that can trigger.