Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5341121pxv; Wed, 7 Jul 2021 01:12:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzm2kj+qiYu9lxSR8hNwBuAEJSE0Eg3Wad6kvGQJ8ZoZWWkIlMBTHl5Xnpv0KH1VC4OvNtR X-Received: by 2002:a17:907:1c9f:: with SMTP id nb31mr17452594ejc.6.1625645532029; Wed, 07 Jul 2021 01:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625645532; cv=none; d=google.com; s=arc-20160816; b=0TJxwaOB7860sZ6I52FTzWZulDha8qceJIQfHzJgNx0J+rvP8NEroftxImNaXHq36F HDb7X8HnQgMIyTMZYl8P9wcBcqAFwdmeI094DXkam8rSf4Xlid3sg2mFmIHPlgiRfKRO l8+vvaO91eXaL4m6dFPu1nsbHGtmWeO7wMuXBuX5NDW66eQaKOlIea4COgD4vVMofrSP zJdGfAcoUIXbu/U8g8ZfCFD7ZCIkUxjVtIDNW6I4s0aHSjNYOmfVePR4d3VNUzA7/7aN l/wHfbrenhCJQz3m4eHOTzmbGJgk10i0J5Y4iebpvWjRDIV1lHYZcKCAG5Xvdj9QnOj2 lzKg== 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:sender:dkim-signature; bh=gHdncZ3P6g+2TaLtcRB/ZmZ7HXwhAytQ4tmQta2m+MU=; b=wzLO8ugXzNWkgQpRUCN8TZoBTrWgbGEdB/epub4bEUdI6LMnAMBolDXM5pz/Yuv4ka wfK5YMfTxHFzuSy0gJgNRdHdKs+lxYD+lcQlBuYZxdVYhwROGQd7yVT53e6bhkRs88k2 Fdn1tLLXeEymrMXgxkVuA7MmUNrkyJbFaOtEJGXzv8gZM/VEzJMpGzrq1CImMvWEm7TM K4jmVC+Yh+po41zVcWm50NxTOkSIe1aeWVp7xsTBlM1WWn/7U+L7u19Biyl1fRj/keBj ICOUOp04A+FAWRE3lKBCxovADHiR/IySBqJVMz/4zZC9tMyI/IJx3lSpPr8YpLE9J4ER Whuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MvO+u35O; 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 df20si8427841edb.504.2021.07.07.01.11.46; Wed, 07 Jul 2021 01:12:12 -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=@gmail.com header.s=20161025 header.b=MvO+u35O; 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 S230447AbhGGINZ (ORCPT + 99 others); Wed, 7 Jul 2021 04:13:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbhGGINY (ORCPT ); Wed, 7 Jul 2021 04:13:24 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3978C061574 for ; Wed, 7 Jul 2021 01:10:44 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id d2so2050453wrn.0 for ; Wed, 07 Jul 2021 01:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=gHdncZ3P6g+2TaLtcRB/ZmZ7HXwhAytQ4tmQta2m+MU=; b=MvO+u35OJmERKJ4gc+iV4WAlyRMoy478j0l8ySQomx+lEB8AwVW1YMgq/zNC1rQwA7 vjJPwDurT2RK/xUMSu08apSf6kY/hkFFhKshJ8R6jsnk7mrTAdvJEaLcVSTohmrUAC8g 0sO21eDU6P98sh9p9Wu8xl78g51IEMUST4t8oCn+HcrzPN8ZDUk13FU8A3yaLiFliuNf gc15nKZ5NwyB8aQAMac3LojbUDZEgqDkA0csi/oe65QbPs9BOEfAgMooFFB9/1Y1r3wH h5/cpOsodj3ErYkfXSN/QFv+gJ2bQpgLvWTZ2865ZPNksK5aPsOY6TM7g6UhjZV9sF3C e9NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=gHdncZ3P6g+2TaLtcRB/ZmZ7HXwhAytQ4tmQta2m+MU=; b=XmP0hxF/AD0iRhMu05KdryqS6AoqedQMN4M5wO5m7s6rPNdTq0Nyl37a1zNenY4lVE AotAvUzP1i2sAAhR4MiM8ppkc0rIx2nX8BlfZ8SSqlXi50dlWMSAgjTHuDnYCA2HtMFe mEnR+JGsDrRYPt5PIfR4CcFBk8Y+ftrZDaod3uYE6odFufzgecL8AderF2LDJ1pJUXZs RMmYGul+W62sDUAeSf7jt8EFVL/gV1/uoUlqPayUmhkMX/dcF7hUHRYOqYM89YdUovoe txpCZsoWIgvUTrC2D0t8IEm5fAlSmr4em6mqYJP8e+5KWV1xHyMmCRqg9mf+yXNerLvn z6zA== X-Gm-Message-State: AOAM533nQFzYrk6sm6PqGzbClPVBsRI9VdSTLfVeKtzNiJdsVNGO8Hcn c/pVvyc469LAM3zhdp6pjXoNopMBXAg= X-Received: by 2002:a5d:6e81:: with SMTP id k1mr26452325wrz.144.1625645443442; Wed, 07 Jul 2021 01:10:43 -0700 (PDT) Received: from gmail.com (178-164-188-14.pool.digikabel.hu. [178.164.188.14]) by smtp.gmail.com with ESMTPSA id w9sm18616575wmc.19.2021.07.07.01.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 01:10:42 -0700 (PDT) Sender: Ingo Molnar Date: Wed, 7 Jul 2021 10:10:40 +0200 From: Ingo Molnar To: Nick Desaulniers Cc: Linus Torvalds , Kees Cook , Linux Kernel Mailing List , Bill Wendling , Bill Wendling , Catalin Marinas , clang-built-linux , Fangrui Song , Heiko Carstens , Jarmo Tiitto , Lukas Bulwahn , Mark Rutland , Masahiro Yamada , Miguel Ojeda , Nathan Chancellor , Peter Oberparleiter , Peter Zijlstra , Sami Tolvanen , Will Deacon Subject: Re: [GIT PULL] Clang feature updates for v5.14-rc1 Message-ID: References: <202106281231.E99B92BB13@keescook> <202106291311.20AB10D04@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Nick Desaulniers wrote: > > And I really hate how pretty much all of the PGO support seems to be > > just about this inferior method of getting the data. > > Right now we're having trouble with hardware performance counters on > non-intel chips; I don't think we have working LBR equivalents on AMD > until zen3, and our ETM based samples on ARM are hung up on a few last > minute issues requiring new hardware (from multiple different chipset > vendors). > > It would be good to have some form profile based optimizations that > aren't architecture or microarchitecture dependent. That doesn't excuse using an inferior tooling ABI design though. By your own description proper hardware LBR support on the platforms you care most about is either there or close - yet the whole Clang PGO feature is designed around software based compiler instrumentation? That's backwards. The right technical solution to integrate the clang-pgo software instrumetnation would be to implement a minimal software-LBR PMU functionality on top of the clang-pgo engine, and use unified perf tooling to process the branch tracing/profiling information. In the main PGO thread PeterZ made a couple of technical suggestions about how this can be done using the existing hardware LBR interfaces of perf, but we are flexible if the design is sane and are open to improvements. I.e. try to commonalize the tooling data as soon as possible - not very late as in the current proposal, exposing a whole stack of APIs and ABIs to clang-pgo specific interfaces. The "LBR data unification" approach has numerous short term and long term advantages: - Hardware assisted LBR tracing support out of the box on two major hardware platforms (Power and x86), and on some ARM platforms "soon", maybe sooner than this feature trickles down to distributions to begin with. - GCC won't have to reinvent the wheel - they only need to make sure they can generate the minimal LBR data. In that sense perf is an 'independent' tooling facility they might be more comfortable working with as well, than a 'competing' compiler project. - There's even a chance that existing instrumentation can be reused - or a relatively self-contained compiler plugin can generate it. - Lower maintenance overhead, lower risk of subsystem obsolescence. Binding this feature to clang-pgo on the ABI level is not a good move for the Linux kernel IMO. So until this is implemented properly, or adequate explanation is given why I'm wrong: NACKED-by: Ingo Molnar Both for the core kernel and x86 bits. Please preserve this NAK and mention it prominently in future iterations of this feature. Please Cc: me on future postings. Thanks, Ingo