Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4278046pxb; Mon, 27 Sep 2021 13:19:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR3hkQn2/ePFy9tBqry8Ix4PrnzdVSgApX3xWyPsgwjz6Y4CeiUuWXUBmNhAjkLCHcIPTR X-Received: by 2002:a65:6a0c:: with SMTP id m12mr1290967pgu.168.1632773943781; Mon, 27 Sep 2021 13:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632773943; cv=none; d=google.com; s=arc-20160816; b=EaOnTtOh6Ly9IcfKaKfd/FKSn/Bd5gu7O7c+2k4aUvHN9r7+wPPa/KfgJhtm+hZ9hJ 9Fnmy+qc/CmvbpQiueMI0m3EDW09oXp0X063X6AhdpYaw+vvee8VeQn6ALwFX2/H7n4Y 8TvP+YR1XNO+ITFKbXxWZUmhWNNdqu6qVR9FjtxxIt2sGtNt3DZbm1Qhj6U3BnYuhqS7 HR8wDK+7XeSEmePszhy3EC6pRCnaDcI16SAFvkf691yzxgAF2qW6lfX2MF4LqHOe1+4T +VPghTKAkh2q3QpZkkaw1oEQv0c1wrCUnE9gskG2I1DamrTKIz7MHFh3CGHS+/whywmj vY6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GBZnzufrghCCnDvbgqbhG5ZA6q2pOuipAFhPr73pxiU=; b=bQ48iSLGyaE3JUgC4FJLstHBG6YgyUXifN+k7bgS+SvAZGqdR4v1Fq/5ORdEhb5uA+ MzQvjdeAk3cFjw2RbWWizn1pIMcGp/xU3li8LYGR9Zntva1tX59ODWI7C0oXxmLsdKMH dEqn5crLo4UxXO31rrynAZoIHAtSkWNTcJcZ9wsB2uzi3zVTWEnowxqBv661nxw4YlB3 lluZ5eKRCPgvuDxq8NAylExD8IhBUqnpfzjT5sbfw/kex9EforGm4qOitZmqaA1Nmi8a XqtgdaHZoZSsZzbNooMeHxur9k8Wb5pqbFbIjFLDLWB6IqKzcT8tGGaBLm3KDnR0oU3F A3Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=biT1ueVm; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v188si23010423pfb.299.2021.09.27.13.18.50; Mon, 27 Sep 2021 13:19:03 -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=@kernel.org header.s=k20201202 header.b=biT1ueVm; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236921AbhI0UTp (ORCPT + 99 others); Mon, 27 Sep 2021 16:19:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:36982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236897AbhI0UTo (ORCPT ); Mon, 27 Sep 2021 16:19:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0D72E61041 for ; Mon, 27 Sep 2021 20:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632773886; bh=IHsvUyvzsKP7lWOY4wr3zpA6gSFdzHNOrAmHGV/uNv0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=biT1ueVmFhaYAmS6xk951LigOoHAZwceTHazGzH1RUDITt1Ofg8fYXAzXIvNA0HLx ESi/KT+3i/UCkN4j9O2uv+CVR87GGQtgeMI5JBR2rjkZV+GDnptNuhE+EKHzXM0ZEZ QrnVbY5R+esVTxIEzqrptGnVjzKGhPwAGVEWQ5kJ5ZKlRAqiuyexszSpw/2zOdM9Oy VQJHvZSpxIghowA0GQka343IuRS0GDu59rSlK3Elw/fmsKeVtuN7Ze7nBRH3O2qthU 6eSep5oKojfAgw9jrDllV7wnTksrp+/1Mo7S5kbLTZJzwOX0Lj6i480iC7bUmaaOGf RPdanXpiw4lJA== Received: by mail-lf1-f45.google.com with SMTP id t10so82531783lfd.8 for ; Mon, 27 Sep 2021 13:18:05 -0700 (PDT) X-Gm-Message-State: AOAM531elmX6l+ogcx/NjSStvG02Rx4j23s8sW9X+pyu3LZuBoT+vQdU oVbXgXJ20VzseKE2/GbTKn2E43Lwkz4dkw+mAF8= X-Received: by 2002:a2e:5442:: with SMTP id y2mr1877130ljd.436.1632773884184; Mon, 27 Sep 2021 13:18:04 -0700 (PDT) MIME-Version: 1.0 References: <20210909075700.4025355-1-eranian@google.com> In-Reply-To: From: Song Liu Date: Mon, 27 Sep 2021 13:17:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 00/13] perf/x86/amd: Add AMD Fam19h Branch Sampling support To: Stephane Eranian Cc: Peter Zijlstra , open list , Arnaldo Carvalho de Melo , Jiri Olsa , kim.phillips@amd.com, Namhyung Kim , Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stephane, On Tue, Sep 14, 2021 at 10:57 PM Stephane Eranian wrote: > > On Thu, Sep 9, 2021 at 1:55 AM Peter Zijlstra wrote: > > > > On Thu, Sep 09, 2021 at 12:56:47AM -0700, Stephane Eranian wrote: > > > This patch series adds support for the AMD Fam19h 16-deep branch sampling > > > feature as described in the AMD PPR Fam19h Model 01h Revision B1 section 2.1.13. > > > > Yay.. > > > > > BRS interacts with the NMI interrupt as well. Because enabling BRS is expensive, > > > it is only activated after P event occurrences, where P is the desired sampling period. > > > At P occurrences of the event, the counter overflows, the CPU catches the NMI interrupt, > > > activates BRS for 16 branches until it saturates, and then delivers the NMI to the kernel. > > > > WTF... ?!? Srsly? You're joking right? > > > > As I said, this is because of the cost of running BRS usually for > millions of branches to keep only the last 16. > Running branch sampling in general on any arch is never totally free. Could you please share some data on how expensive the BRS is? We are hoping to use BRS/LBR without PMI (bpf_get_branch_snapshot). If it is too expensive, we may need some heuristic to turn it on/off. Thanks, Song