From patchwork Tue Jul 11 16:29:56 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: 118652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp613529vqm; Tue, 11 Jul 2023 09:45:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlFFg1hNUUbrBCNXlGxoFO2p9s32aPTiBLT/oVu3dbZYo15+fceiYaNjowCkHZl1WSeikFfD X-Received: by 2002:a05:6a00:3a14:b0:668:8705:57cf with SMTP id fj20-20020a056a003a1400b00668870557cfmr19215316pfb.25.1689093923806; Tue, 11 Jul 2023 09:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689093923; cv=none; d=google.com; s=arc-20160816; b=j/nAzEpmguikLRMC4j5CNAa94S8edJqhIhQSpoTcnf925N+/UIcFDPWDYDLAe22a22 wmLZ0GUEa+IFnYQJc5oYGLIyW+gw8j03xDcOwF/LKLBcaF4i3cHo6OKB01ucId5j6Q0q lNY8pyQNVJlX/Su+JL5vaWKnRrLEhOdLjzY8u4oOvKtJ6LS/RU9f5YHKbZjTAE8JCr7u 5nxrm9FkmTM8iDiRuCEEFP5f68Hqw9P/vaCfNpXcYdN9lRsfSkdl/pMK3aLgTG5fsCl+ E4oK5n1+sPUukXjAgpaeqVezifQrTbNZ5/DVfuIJ0acEkAiFQShlwOtNVBLa/mZmi+FB 4rKQ== 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:to:from:date:dkim-signature; bh=TvUuj3WgypL19H/giC5Xwq+FJqgFYAMkpkcHoaSAMws=; fh=c9IfCPbQdggaMW5MeFAJcdnU729I/vQHWAC5+ynTMQY=; b=UuBxqFDAMMkMdogvDB6LKnFgfWVHRnyYXgvaaUOPsEWe4cdAHreKK4pmxF9/vYxiix NNaXWaqZn1KFowerdw0dU0NLKigcHAodWCtgN/4GMBsPUMZjJ9skcLWzFFqdQ3w8BEuR VdgGal7mRdpN1zCqOstfL3ATlAl71SAsQhsS4mftAfNfaVEHcZessg1aBznVIyLKp/Sv 8qfxcK9PUjal6klPj82T2WGmJUvQEJDsB1H8lWD3cY1sm+g+V/FhW8GDiBaaGr2KraOC sAKG3HNhMhihrxx1AMZusjxzco9mwlshrxGYMTc0aQMNdcFgORniXa3+Cg842RnMoFOm PH3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=klhIFyJM; 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 ch4-20020a056a00288400b00681c3725a98si1731566pfb.82.2023.07.11.09.45.09; Tue, 11 Jul 2023 09:45:23 -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=klhIFyJM; 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 S231218AbjGKQaC (ORCPT + 99 others); Tue, 11 Jul 2023 12:30:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbjGKQaB (ORCPT ); Tue, 11 Jul 2023 12:30:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C829CA for ; Tue, 11 Jul 2023 09:30:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDACA61515 for ; Tue, 11 Jul 2023 16:29:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 083BBC433C8 for ; Tue, 11 Jul 2023 16:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689092999; bh=gJ41FrkMgC8wmnXMSCJF6e1D3EvOp1u4fS6IyfvlNmg=; h=Date:From:To:Subject:From; b=klhIFyJMPy7Gs6zUB4+BVgnFiUTfVv7GqGieFXyvnufOVpEdY+OQvRtTTKt4BEX/x aMC/a7MexjGu5TjE6hzGoHscNGhkVF+dDNtGYxmqVD2XRx0vQ/sgidy8+TSCxa1fhp xBuA6rHkS9+/TflO4g+KkoXv+NDdKrcA5rbr1/Nlwx2Va0cGQsyr3LF2MJ6eGnVj8F j8ZORZnqwPcEy9l+w6LWt9Vt6Rg4WpGI1xKTwzfJYdUJFzlPCmyOSwQVJaf5O1eIWU 7RGpaUUnZpSibbPyx5l9mhtIdOVcDi1D31B2R25CYVj3h9dUCXToGO7LHTcwhj8Nnu jerbcB68zzPuQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 2AF7640516; Tue, 11 Jul 2023 13:29:56 -0300 (-03) Date: Tue, 11 Jul 2023 13:29:56 -0300 From: Arnaldo Carvalho de Melo To: linux-kernel@vger.kernel.org Subject: [PATCH 1/1 fyi] tools headers UAPI: Sync linux/prctl.h with the kernel sources Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: INBOX X-GMAIL-THRID: 1771143350250360833 X-GMAIL-MSGID: 1771143350250360833 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: 1fd96a3e9d5d4feb ("riscv: Add prctl controls for userspace vector management") That adds some RISC-V specific prctl options: $ tools/perf/trace/beauty/prctl_option.sh > before $ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h $ tools/perf/trace/beauty/prctl_option.sh > after $ diff -u before after --- before 2023-07-11 13:22:01.928705942 -0300 +++ after 2023-07-11 13:22:36.342645970 -0300 @@ -63,6 +63,8 @@ [66] = "GET_MDWE", [67] = "SET_MEMORY_MERGE", [68] = "GET_MEMORY_MERGE", + [69] = "RISCV_V_SET_CONTROL", + [70] = "RISCV_V_GET_CONTROL", }; static const char *prctl_set_mm_options[] = { [1] = "START_CODE", $ That now will be used to decode the syscall option and also to compose filters, for instance: [root@five ~]# perf trace -e syscalls:sys_enter_prctl --filter option==SET_NAME 0.000 Isolated Servi/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23f13b7aee) 0.032 DOM Worker/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23deb25670) 7.920 :3474328/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fbb10) 7.935 StreamT~s #374/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fb970) 8.400 Isolated Servi/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24bab10) 8.418 StreamT~s #374/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24ba970) ^C[root@five ~]# This addresses this perf build warning: Warning: Kernel ABI header differences: diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h Cc: Adrian Hunter Cc: Andy Chiu Cc: Ian Rogers Cc: Jiri Olsa Cc: Namhyung Kim Cc: Palmer Dabbelt Link: https://lore.kernel.org/lkml/ Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/uapi/linux/prctl.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/include/uapi/linux/prctl.h b/tools/include/uapi/linux/prctl.h index f23d9a16507f6f46..3c36aeade991e945 100644 --- a/tools/include/uapi/linux/prctl.h +++ b/tools/include/uapi/linux/prctl.h @@ -294,4 +294,15 @@ struct prctl_mm_map { #define PR_SET_MEMORY_MERGE 67 #define PR_GET_MEMORY_MERGE 68 + +#define PR_RISCV_V_SET_CONTROL 69 +#define PR_RISCV_V_GET_CONTROL 70 +# define PR_RISCV_V_VSTATE_CTRL_DEFAULT 0 +# define PR_RISCV_V_VSTATE_CTRL_OFF 1 +# define PR_RISCV_V_VSTATE_CTRL_ON 2 +# define PR_RISCV_V_VSTATE_CTRL_INHERIT (1 << 4) +# define PR_RISCV_V_VSTATE_CTRL_CUR_MASK 0x3 +# define PR_RISCV_V_VSTATE_CTRL_NEXT_MASK 0xc +# define PR_RISCV_V_VSTATE_CTRL_MASK 0x1f + #endif /* _LINUX_PRCTL_H */