lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 8 Nov 2021 10:50:54 -0800
From:   Namhyung Kim <namhyung@...nel.org>
To:     Ravi Bangoria <ravi.bangoria@....com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Ian Rogers <irogers@...gle.com>,
        Stephane Eranian <eranian@...gle.com>,
        Kim Phillips <kim.phillips@....com>
Subject: Re: [PATCH v3] perf evsel: Fix missing exclude_{host,guest} setting

On Sun, Nov 7, 2021 at 2:26 AM Ravi Bangoria <ravi.bangoria@....com> wrote:
>
>
>
> On 07-Nov-21 12:54 AM, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Nov 05, 2021 at 11:00:29AM -0700, Namhyung Kim escreveu:
> >> Hello,
> >>
> >> On Wed, Nov 3, 2021 at 12:22 AM Ravi Bangoria <ravi.bangoria@....com> wrote:
> >>>
> >>>> The current logic for the perf missing feature has a bug that it can
> >>>> wrongly clear some modifiers like G or H.  Actually some PMUs don't
> >>>> support any filtering or exclusion while others do.  But we check it
> >>>> as a global feature.
> >>>
> >>> (Sorry to pitch in bit late)
> >>>
> >>> AMD has one more problem on a similar line. On AMD, non-precise and
> >>> precise sampling are provided by core and IBS pmu respectively. Plus,
> >>> core pmu has filtering capability but IBS does not. Perf by default
> >>> sets precise_ip=3 and exclude_guest=1 and goes on decreasing precise_ip
> >>> with exclude_guest set until perf_event_open() succeeds. This is
> >>> causing perf to always fallback to core pmu (non-precise mode) even if
> >>> it's perfectly feasible to do precise sampling. Do you guys think this
> >>> problem should also be addressed while designing solution for Namhyung's
> >>> patch or solve it seperately like below patch:
> >>>
> >>> ---><---
> >>>
> >>> From 48808299679199c39ff737a30a7f387669314fd7 Mon Sep 17 00:00:00 2001
> >>> From: Ravi Bangoria <ravi.bangoria@....com>
> >>> Date: Tue, 2 Nov 2021 11:01:12 +0530
> >>> Subject: [PATCH] perf/amd/ibs: Don't set exclude_guest by default
> >>>
> >>> Perf tool sets exclude_guest by default while calling perf_event_open().
> >>> Because IBS does not have filtering capability, it always gets rejected
> >>> by IBS PMU driver and thus perf falls back to non-precise sampling. Fix
> >>> it by not setting exclude_guest by default on AMD.
> >>>
> >>> Before:
> >>>   $ sudo ./perf record -C 0 -vvv true |& grep precise
> >>>     precise_ip                       3
> >>>   decreasing precise_ip by one (2)
> >>>     precise_ip                       2
> >>>   decreasing precise_ip by one (1)
> >>>     precise_ip                       1
> >>>   decreasing precise_ip by one (0)
> >>>
> >>> After:
> >>>   $ sudo ./perf record -C 0 -vvv true |& grep precise
> >>>     precise_ip                       3
> >>>   decreasing precise_ip by one (2)
> >>>     precise_ip                       2
> >>>
> >>> Reported-by: Kim Phillips <kim.phillips@....com>
> >>> Signed-off-by: Ravi Bangoria <ravi.bangoria@....com>
> >>
> >> It'd be nice if it can cover explicit -e cycles:pp as well.  Anyway,
> >
> > Ravi, please consider Namhyung's request, a patch on top as I'm adding
> > this already.
>
> For explicit :pp modifier, evsel->precise_max does not get set and thus perf
> does not try with different attr->precise_ip values while exclude_guest set.
> So no issue with explicit :pp:
>
>   $ sudo ./perf record -C 0 -e cycles:pp -vvv |& grep "precise_ip\|exclude_guest"
>     precise_ip                       2
>     exclude_guest                    1
>     precise_ip                       2
>     exclude_guest                    1
>   switching off exclude_guest, exclude_host
>     precise_ip                       2
>   ^C
>
> Also, with :P modifier, evsel->precise_max gets set but exclude_guest does
> not and thus :P also works fine:
>
>   $ sudo ./perf record -C 0 -e cycles:P -vvv |& grep "precise_ip\|exclude_guest"
>     precise_ip                       3
>   decreasing precise_ip by one (2)
>     precise_ip                       2
>   ^C

Ah, ok.  Thanks for making it clear!

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ