From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 17C863858C53 for ; Mon, 3 Jul 2023 07:50:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17C863858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2b69f958ef3so64635241fa.1 for ; Mon, 03 Jul 2023 00:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688370610; x=1690962610; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AxLYkQ708UYFCwU4zfdqYXa7jz9IlfXb4u188y4mvv0=; b=c4/xWyaac5QwLBVIPk6C69LVjUW0eqvbf4QwIdyn0tceltgFH3Dub6a0kaEaiOLWL+ LasUrf20H/F6wGEFRCC1FXgHwYhH05t7363InKhzlrj2BKj1f7DufpexgRtzXs2EBwm3 UVrzxMXSrHogKilywTrVTQNFj75VBEK7pbedteWSyE7C8ZGVSkBkg7xAcouRi2fL4KMw eWrfGUnEEzusPffYd/V6JjvK0QqI1xoTq9XTsr4jGlcs3wZlxCL3nj9Mc+Ch5uBs2R18 2HPB/AWau6ouCKWrhwr0O9q5RAcWLcjo8t/FiOadsxeCsxtIyANLl/dD0fc+bRK/4/pl gEEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688370610; x=1690962610; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AxLYkQ708UYFCwU4zfdqYXa7jz9IlfXb4u188y4mvv0=; b=PfuT2PKjBjgrp0eefGABBu2gLN3Ol2AI2u1Y99zo5Z+kKf4YotCb0FcA+K0dx7DDLt ccXqjF9aBimjYi495TaqF7ZNrETHNv5sflqUU1MgRMbujtsvSWb1LEoRuhHuItxgsPiX mt9KZ+BuWIwkbCX69CofATbLW3mOjOyXgO5CVJuug62j2YA51ACGb/y/XdR5jiMqe0Xs N5cvFvRwPPCLD+pLI6fJM5+3u0fDSH4YD96vIvvbtIIXO30WqCdiGGj4zqjt2FNkdSpX VFxiQX6FrIkLNf0OxJnh6DbKYPh/QODCqvauOu1bg264q90Uv6J7altL51zVa+OxsgZu XjCA== X-Gm-Message-State: ABy/qLZzoX0rRQrNl08FDsz3x7uwUpvD4Jpma/FvvSeA3ULub8uc5AtV kfuocwKuymeXjLQJvtc0Ejkt6fB6Xcd4fuqPy7c= X-Google-Smtp-Source: APBJJlFrq2qAyQpaluVNVOXDCPirBfCM+H2q/4DBN0cpsITNntrllkSOFy7wedab2WPM1kqjBJCc6v6ONLuOf4ClkkI= X-Received: by 2002:a2e:80d5:0:b0:2b6:ec2d:a4b with SMTP id r21-20020a2e80d5000000b002b6ec2d0a4bmr859987ljg.42.1688370610283; Mon, 03 Jul 2023 00:50:10 -0700 (PDT) MIME-Version: 1.0 References: <87v8f51g0h.fsf@gentoo.org> In-Reply-To: From: Richard Biener Date: Mon, 3 Jul 2023 09:46:56 +0200 Message-ID: Subject: Re: [EXTERNAL] Re: [PATCH] Collect both user and kernel events for autofdo tests and autoprofiledbootstrap To: Eugene Rozenfeld Cc: Sam James , "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Jul 1, 2023 at 12:05=E2=80=AFAM Eugene Rozenfeld wrote: > > I also set /proc/sys/kernel/perf_event_paranoid to 1 instead of the defau= lt 2. Does the perf attempt fail when the privileges are not adjusted and you spe= cify --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 On Behalf Of Eugene Rozenfeld via Gcc-patches > Sent: Friday, June 30, 2023 2:44 PM > To: Sam James ; Richard Biener > Cc: gcc-patches@gcc.gnu.org > Subject: RE: [EXTERNAL] Re: [PATCH] Collect both user and kernel events f= or 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 eve= nt mapping threshold percentage a parameter to create_gcov and pass somethi= ng low enough. 80% instead of the current threshold of 95% should work, alt= hough it's a bit fragile. > > Eugene > > -----Original Message----- > From: Sam James > Sent: Friday, June 30, 2023 1:59 AM > To: Richard Biener > Cc: Eugene Rozenfeld ; gcc-patches@gcc.gn= u.org > Subject: [EXTERNAL] Re: [PATCH] Collect both user and kernel events for a= utofdo tests and autoprofiledbootstrap > > [You don't often get email from sam@gentoo.org. Learn why this is importa= nt at https://aka.ms/LearnAboutSenderIdentification ] > > Richard Biener via Gcc-patches writes: > > > On Fri, Jun 30, 2023 at 7:28=E2=80=AFAM Eugene Rozenfeld via Gcc-patche= s > > 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 eve= nts. > > > > Does this require elevated privileges? Can we instead "fix" create_gco= v 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 auto= fdo at all.