From patchwork Mon Jan 16 13:32:23 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: 44154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1195735wrn; Mon, 16 Jan 2023 05:37:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXscKCRB1BfxwtJVpMClU3nq4+2h4LRPR/zh2SYq2F060cXi/oVl43xaemBwsbYxYVHLkuCu X-Received: by 2002:a05:6a20:6da1:b0:b8:8def:a550 with SMTP id gl33-20020a056a206da100b000b88defa550mr2749397pzb.36.1673876247787; Mon, 16 Jan 2023 05:37:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673876247; cv=none; d=google.com; s=arc-20160816; b=yb0Od9lKXD+YuAA6fk6FNfqYFnbUTzqRMZUkwJ+13pFB9TYp8dfNd8GoeE3uh7KVJM GlP9sQrGKIdDg8TPwesJ6LPHfQSZ2E/S/TSngr2b1hG1wZO56bJBsLv2546P1Y+SG0nU X1s2im9ctZ8lALPujh35UNu/mX3Q/yjTynFhkWHlXmDDgkJkjHZoKyxsCAEpcmYXqtpI UpdLJzlhEedqwXLGxy47ghhyDjzRux+2J6yOkt2oTdmL9xU2MoHlOJjvUOi30rxuberH D8GFdsj/QPMXF2FR6f8+wAhEubV/KqrEWFmjo9XBo1octcrUWr7NSLyUzpVO0uacq/Hw Ec/g== 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=igB8uAJ/n8MYbHeXsVPIFaFkwZLlgv2+SZh+5uc/M+I=; b=nRvBXJqu4AurmUh3pyVS1ovpOSF1Ab45kriCc1YtrvGH/AYhT/czLq3TAYHgfPZcKS WQCliVkW94B9Xqq/uL1GziPRVDE9fNt35BlpZf03Sscf3Pil/uxXJp4RNteqSLfJC+h5 5rQjFlwDmiT3+Lf2oR55g25e2pkJfwhpdicqKN0N5NocEsKQG4Syh5cD8s82sW+Oh9rP xl++4xUYHo7vPivj/SRJayoDi3WHxJUxLgET95eyulIr0JKwEW+nTmqoM8H7aLs79EnX RZpkD5NfA50+GOK3TX1HbBGAlny/hHD4Gu97gCj4x43pgCO2hAN0AqkxyGDrk+7C1FOR enCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SXXlXkGI; 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 c5-20020a6566c5000000b0046eed2ed669si7193799pgw.209.2023.01.16.05.37.15; Mon, 16 Jan 2023 05:37:27 -0800 (PST) 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=SXXlXkGI; 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 S229827AbjAPNca (ORCPT + 99 others); Mon, 16 Jan 2023 08:32:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjAPNc2 (ORCPT ); Mon, 16 Jan 2023 08:32:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26C4665A6 for ; Mon, 16 Jan 2023 05:32:28 -0800 (PST) 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 B533460FB0 for ; Mon, 16 Jan 2023 13:32:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F08E3C433D2; Mon, 16 Jan 2023 13:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673875947; bh=4FNGUjolVNCydpYGZa09SlRQJ5ANppLfAdPXrB1+kcU=; h=Date:From:To:Cc:Subject:From; b=SXXlXkGIWlbf3hX8iwXK0+OmZwl7FGxS2STKqHGnmT/Mt336E0o03hgs5PODpg9n+ 82+gA5FoJ/jWPfdqwM2jQYbbNUwTwkjf3doJdWUi/i80XergbPtC2Nfa58wesdL/eI 8nrCTzUDmblFWpmDInqQveqLzbrf7jsU6FXqhxIwdvFMYoy0v40uf6g5i7eEuMp0Mv 2BUp/6gdH1aBIkSA/zWzgA8lUOFaWGkYrfKsdyLMLzUEQtzWhPfBLjj38P4cKQDEmK dvJ1FTODrWAn9hccs7zbgh89FIY1mxD5H3DqzduoQRY8f3cIJpCKgTfCY11Cn2sDlc oC1tBmojxECiw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E14E5405BE; Mon, 16 Jan 2023 10:32:23 -0300 (-03) Date: Mon, 16 Jan 2023 10:32:23 -0300 From: Arnaldo Carvalho de Melo To: linux-kernel@vger.kernel.org Cc: Aaron Lewis , Paolo Bonzini , Adrian Hunter , Ian Rogers , Jiri Olsa , Namhyung Kim Subject: [PATCH 1/1 FYI] tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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?1755186460582667020?= X-GMAIL-MSGID: =?utf-8?q?1755186460582667020?= 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 in: 8aff460f216753d8 ("KVM: x86: Add a VALID_MASK for the flags in kvm_msr_filter_range") c1340fe3590ebbe7 ("KVM: x86: Add a VALID_MASK for the flag in kvm_msr_filter") be83794210e7020f ("KVM: x86: Disallow the use of KVM_MSR_FILTER_DEFAULT_ALLOW in the kernel") That just rebuilds kvm-stat.c on x86, no change in functionality. This silences these perf build warning: Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h' diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h Cc: Aaron Lewis Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Namhyung Kim Cc: Paolo Bonzini Link: http://lore.kernel.org/lkml/ Signed-off-by: Arnaldo Carvalho de Melo --- tools/arch/x86/include/uapi/asm/kvm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/arch/x86/include/uapi/asm/kvm.h b/tools/arch/x86/include/uapi/asm/kvm.h index 649e50a8f9ddff87..e48deab8901d4ecb 100644 --- a/tools/arch/x86/include/uapi/asm/kvm.h +++ b/tools/arch/x86/include/uapi/asm/kvm.h @@ -206,6 +206,8 @@ struct kvm_msr_list { struct kvm_msr_filter_range { #define KVM_MSR_FILTER_READ (1 << 0) #define KVM_MSR_FILTER_WRITE (1 << 1) +#define KVM_MSR_FILTER_RANGE_VALID_MASK (KVM_MSR_FILTER_READ | \ + KVM_MSR_FILTER_WRITE) __u32 flags; __u32 nmsrs; /* number of msrs in bitmap */ __u32 base; /* MSR index the bitmap starts at */ @@ -214,8 +216,11 @@ struct kvm_msr_filter_range { #define KVM_MSR_FILTER_MAX_RANGES 16 struct kvm_msr_filter { +#ifndef __KERNEL__ #define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0) +#endif #define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0) +#define KVM_MSR_FILTER_VALID_MASK (KVM_MSR_FILTER_DEFAULT_DENY) __u32 flags; struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES]; };