From patchwork Wed May 17 14:49:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 95322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1206672vqo; Wed, 17 May 2023 08:07:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BxJSiLM4boYc8mHVcuFDYoJuiuPbiPdmmyo6sqm4zfjyZ598pKtS+7tV4a+BrR6WxVTYZ X-Received: by 2002:a05:6a20:6a2b:b0:105:6d0e:c037 with SMTP id p43-20020a056a206a2b00b001056d0ec037mr16119305pzk.38.1684336058960; Wed, 17 May 2023 08:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684336058; cv=none; d=google.com; s=arc-20160816; b=lFB1Or7HkvDOSuzhLFIp0mnWE0EwO9HeMajRumhCQJtuxkoGIzkzQKomI9SGV43p8N YNSvi6dnBywljSojdSoBjVAdW35Psm32UZPMMN3X6vHTvZ+Umq3x0DSkl04+dAKZ2oZx WvkbLggAjV6c1o5jZyXHiFLE0pEIPimt5CCnuYq9IbtpRCtlbokH+qX1pBfsxbTvsG65 tLqZjgkOEQzjkGsJZ+JZgPVD2u7fbKygcudbXMfdUn0yX33CnAcUTiF5+Xiqd9/OpCgh gUFyMOmZamJT5Favmii7VAdzTKeSzDi03xDYZrsHp6kQ5VGHxJ7KIdd6V/9yVGftKuPW I/UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=tQpqoB4Ntro9R8CtPkmOPf1TUUOw1O7PrE3Cy7sLTH0=; b=0cqWeWKR0tB3HEOELRvk0FfQX6xFc2P4v+ydQgy7Mbyb+mlRQcU3HA7XYaw6vDXPIz 8xerrRNonn4ocCBvmETI5mk6E+NqJfl7lvIqB3wyRe0RToW+0uJNCJmfYjpZ8q5pB3F+ gsjka2l24x1fbsToGnYmVOHf1bkjB58cylQBbLyOT7nnmZ1eow3vpP46tmzjE5ODVuMc LWvV7NXOPaAo2k/NIsQ4RvhGN9V3VEQ0MhjVKhVWP+04sRxIDYDyfgeIWLIvgncFXjUU xOqPnH/CszDrczopOSDzd+V67yfNlTPsGbNutwVMFwQlN+JVUTcmOIlQcMW+1nBfFM7F H8WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=diWIlLxH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u129-20020a627987000000b0064580409a12si22328379pfc.320.2023.05.17.08.07.25; Wed, 17 May 2023 08:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=diWIlLxH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232163AbjEQOte (ORCPT + 99 others); Wed, 17 May 2023 10:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231311AbjEQOtc (ORCPT ); Wed, 17 May 2023 10:49:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AFAF3A99 for ; Wed, 17 May 2023 07:49:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 932E964813 for ; Wed, 17 May 2023 14:49:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1FFAC433D2; Wed, 17 May 2023 14:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684334970; bh=iF1IBOMKHxH3nHRxIOTWThfY8iVrLjVnyW79f8rS5rI=; h=Date:From:To:Cc:Subject:From; b=diWIlLxHUDldGPruDkaFAOzM/16zHqciRAQHM+nQV7u3JzzpZ+8iw9wv4y/Ee8m6C h6q89SObmZcA+ze99HFW7xRTQLVB4UdXy1fNT+++N2b7s2JtBTYyuFSpUE0cvKJQ7C WHfhMgNT/1INyxgfJk91reQrfhtwoG2/e5tZZZVgfN9nYsh5ePggTP6WJvUcnFp3UD IvKUc2O0F76WpeooqEa7M3wvse24W7GEc+Kv4r3McFH9bqbzkhWo9gxqmcUO+eZfO4 Ozi1voEvad/dnXXgWeKH5uvClwu7jQfZ0MyKWIG1UXW/dO09tUr6zTGPDY0/C0JqWC lE93Iz+n6MJFg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id AC47E403B5; Wed, 17 May 2023 11:49:26 -0300 (-03) Date: Wed, 17 May 2023 11:49:26 -0300 From: Arnaldo Carvalho de Melo To: linux-kernel@vger.kernel.org Cc: Dave Hansen , "Kirill A. Shutemov" , Adrian Hunter , Ian Rogers , Jiri Olsa , Namhyung Kim Subject: [PATCH 1/1 fyi] tools headers disabled-cpufeatures: Sync with the kernel sources Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766154367426615801?= X-GMAIL-MSGID: =?utf-8?q?1766154367426615801?= tldr; Just FYI, I'm carrying this on the perf tools tree. - Arnaldo Full explanation: There used to be no copies, with tools/ code using kernel headers directly. From time to time tools/perf/ broke due to legitimate kernel hacking. At some point Linus complained about such direct usage. Then we adopted the current model. The way these headers are used in perf are not restricted to just including them to compile something. There are sometimes used in scripts that convert defines into string tables, etc, so some change may break one of these scripts, or new MSRs may use some different #define pattern, etc. E.g.: $ ls -1 tools/perf/trace/beauty/*.sh | head -5 tools/perf/trace/beauty/arch_errno_names.sh tools/perf/trace/beauty/drm_ioctl.sh tools/perf/trace/beauty/fadvise.sh tools/perf/trace/beauty/fsconfig.sh tools/perf/trace/beauty/fsmount.sh $ $ tools/perf/trace/beauty/fadvise.sh static const char *fadvise_advices[] = { [0] = "NORMAL", [1] = "RANDOM", [2] = "SEQUENTIAL", [3] = "WILLNEED", [4] = "DONTNEED", [5] = "NOREUSE", }; $ The tools/perf/check-headers.sh script, part of the tools/ build process, points out changes in the original files. So its important not to touch the copies in tools/ when doing changes in the original kernel headers, that will be done later, when check-headers.sh inform about the change to the perf tools hackers. --- To pick the changes from: e0bddc19ba9578bc ("x86/mm: Reduce untagged_addr() overhead for systems without LAM") This only causes these perf files to be rebuilt: CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o CC /tmp/build/perf/bench/mem-memset-x86-64-asm.o And addresses this perf build warning: Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h' diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h Cc: Adrian Hunter Cc: Dave Hansen Cc: Ian Rogers Cc: Jiri Olsa Cc: Kirill A. Shutemov Cc: Namhyung Kim Link: https://lore.kernel.org/lkml/ Signed-off-by: Arnaldo Carvalho de Melo --- tools/arch/x86/include/asm/disabled-features.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/arch/x86/include/asm/disabled-features.h b/tools/arch/x86/include/asm/disabled-features.h index 5dfa4fb76f4b2ba0..fafe9be7a6f4ff6b 100644 --- a/tools/arch/x86/include/asm/disabled-features.h +++ b/tools/arch/x86/include/asm/disabled-features.h @@ -75,6 +75,12 @@ # define DISABLE_CALL_DEPTH_TRACKING (1 << (X86_FEATURE_CALL_DEPTH & 31)) #endif +#ifdef CONFIG_ADDRESS_MASKING +# define DISABLE_LAM 0 +#else +# define DISABLE_LAM (1 << (X86_FEATURE_LAM & 31)) +#endif + #ifdef CONFIG_INTEL_IOMMU_SVM # define DISABLE_ENQCMD 0 #else @@ -115,7 +121,7 @@ #define DISABLED_MASK10 0 #define DISABLED_MASK11 (DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \ DISABLE_CALL_DEPTH_TRACKING) -#define DISABLED_MASK12 0 +#define DISABLED_MASK12 (DISABLE_LAM) #define DISABLED_MASK13 0 #define DISABLED_MASK14 0 #define DISABLED_MASK15 0