On Sat, Jul 1, 2023 at 12:05 AM Eugene Rozenfeld <eugene.rozenf...@microsoft.com> wrote: > > I also set /proc/sys/kernel/perf_event_paranoid to 1 instead of the default 2.
Does the perf attempt fail when the privileges are not adjusted and you specify --all? I see it adds /uk as flags, when I do > perf record -e instructions//uk ./a.out it doesn't complain in any way with > cat /proc/sys/kernel/kptr_restrict 1 > cat /proc/sys/kernel/perf_event_paranoid 2 so in case the 'kernel' side is simply ignored when profiling there isn't permitted/possible then I guess the patch is OK? Can you confirm? Thanks, Richard. > -----Original Message----- > From: Gcc-patches <gcc-patches-bounces+erozen=microsoft....@gcc.gnu.org> On > Behalf Of Eugene Rozenfeld via Gcc-patches > Sent: Friday, June 30, 2023 2:44 PM > To: Sam James <s...@gentoo.org>; Richard Biener <richard.guent...@gmail.com> > Cc: gcc-patches@gcc.gnu.org > Subject: RE: [EXTERNAL] Re: [PATCH] Collect both user and kernel events for > autofdo tests and autoprofiledbootstrap > > I don't run this with elevated privileges but I set > /proc/sys/kernel/kptr_restrict to 0. Setting that does require elevated > privileges. > > If that's not acceptable, the only fix I can think of is to make that event > mapping threshold percentage a parameter to create_gcov and pass something > low enough. 80% instead of the current threshold of 95% should work, although > it's a bit fragile. > > Eugene > > -----Original Message----- > From: Sam James <s...@gentoo.org> > Sent: Friday, June 30, 2023 1:59 AM > To: Richard Biener <richard.guent...@gmail.com> > Cc: Eugene Rozenfeld <eugene.rozenf...@microsoft.com>; gcc-patches@gcc.gnu.org > Subject: [EXTERNAL] Re: [PATCH] Collect both user and kernel events for > autofdo tests and autoprofiledbootstrap > > [You don't often get email from s...@gentoo.org. Learn why this is important > at https://aka.ms/LearnAboutSenderIdentification ] > > Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > > > On Fri, Jun 30, 2023 at 7:28 AM Eugene Rozenfeld via Gcc-patches > > <gcc-patches@gcc.gnu.org> wrote: > >> > >> When we collect just user events for autofdo with lbr we get some > >> events where branch sources are kernel addresses and branch targets > >> are user addresses. Without kernel MMAP events create_gcov can't make > >> sense of kernel addresses. Currently create_gcov fails if it can't > >> map at least 95% of events. We sometimes get below this threshold with > >> just user events. The change is to collect both user events and kernel > >> events. > > > > Does this require elevated privileges? Can we instead "fix" create_gcov > > here? > > Right, requiring privileges for this is going to be a no-go for a lot of > builders. In a distro context, for example, it means we can't consider > autofdo at all.