[PATCH 11/11] perf tools: Fix build error on generated/fs_at_flags_array.c

Namhyung Kim posted 11 patches 1 day, 15 hours ago
[PATCH 11/11] perf tools: Fix build error on generated/fs_at_flags_array.c
Posted by Namhyung Kim 1 day, 15 hours ago
It should only have generic flags in the array but the recent header
sync brought a new flags to fcntl.h and caused a build error.  Let's
update the shell script to exclude flags specific to name_to_handle_at().

    CC      trace/beauty/fs_at_flags.o
  In file included from trace/beauty/fs_at_flags.c:21:
  tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: error: initialized field overwritten [-Werror=override-init]
     13 |         [ilog2(0x002) + 1] = "HANDLE_CONNECTABLE",
        |                              ^~~~~~~~~~~~~~~~~~~~
  tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: note: (near initialization for ‘fs_at_flags[2]’)

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/trace/beauty/fs_at_flags.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/trace/beauty/fs_at_flags.sh b/tools/perf/trace/beauty/fs_at_flags.sh
index e3f13f96a27c227c..fac4d0c049fcc89f 100755
--- a/tools/perf/trace/beauty/fs_at_flags.sh
+++ b/tools/perf/trace/beauty/fs_at_flags.sh
@@ -13,13 +13,14 @@ printf "static const char *fs_at_flags[] = {\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+AT_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
 # AT_EACCESS is only meaningful to faccessat, so we will special case it there...
 # AT_STATX_SYNC_TYPE is not a bit, its a mask of AT_STATX_SYNC_AS_STAT, AT_STATX_FORCE_SYNC and AT_STATX_DONT_SYNC
-# AT_HANDLE_FID and AT_HANDLE_MNT_ID_UNIQUE are reusing values and are valid only for name_to_handle_at()
+# AT_HANDLE_FID, AT_HANDLE_MNT_ID_UNIQUE and AT_HANDLE_CONNECTABLE are reusing values and are valid only for name_to_handle_at()
 # AT_RENAME_NOREPLACE reuses 0x1 and is valid only for renameat2()
 grep -E $regex ${linux_fcntl} | \
 	grep -v AT_EACCESS | \
 	grep -v AT_STATX_SYNC_TYPE | \
 	grep -v AT_HANDLE_FID | \
 	grep -v AT_HANDLE_MNT_ID_UNIQUE | \
+	grep -v AT_HANDLE_CONNECTABLE | \
 	grep -v AT_RENAME_NOREPLACE | \
 	sed -r "s/$regex/\2 \1/g"	| \
 	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
-- 
2.47.0.338.g60cca15819-goog

Re: [PATCH 11/11] perf tools: Fix build error on generated/fs_at_flags_array.c
Posted by James Clark 1 day, 2 hours ago

On 03/12/2024 3:53 am, Namhyung Kim wrote:
> It should only have generic flags in the array but the recent header
> sync brought a new flags to fcntl.h and caused a build error.  Let's
> update the shell script to exclude flags specific to name_to_handle_at().
> 
>      CC      trace/beauty/fs_at_flags.o
>    In file included from trace/beauty/fs_at_flags.c:21:
>    tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: error: initialized field overwritten [-Werror=override-init]
>       13 |         [ilog2(0x002) + 1] = "HANDLE_CONNECTABLE",
>          |                              ^~~~~~~~~~~~~~~~~~~~
>    tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: note: (near initialization for ‘fs_at_flags[2]’)
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Hi Namhyung,

Is it possible to fix this before the updates to keep it buildable? 
Maybe it's not feasible, I didn't check.

I did notice a build issue in the kvm tests after this update:

$ make O=../build/local/ summary=1 TARGETS=kvm kselftest

In file included from aarch64/aarch32_id_regs.c:14:
include/aarch64/processor.h:15:10: fatal error: asm/brk-imm.h: No such 
file or directory
    15 | #include <asm/brk-imm.h>

But I tried the same on v6.13-rc1 and got a different error, so I don't 
know if it's any worse.

Thanks
James

> ---
>   tools/perf/trace/beauty/fs_at_flags.sh | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/trace/beauty/fs_at_flags.sh b/tools/perf/trace/beauty/fs_at_flags.sh
> index e3f13f96a27c227c..fac4d0c049fcc89f 100755
> --- a/tools/perf/trace/beauty/fs_at_flags.sh
> +++ b/tools/perf/trace/beauty/fs_at_flags.sh
> @@ -13,13 +13,14 @@ printf "static const char *fs_at_flags[] = {\n"
>   regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+AT_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
>   # AT_EACCESS is only meaningful to faccessat, so we will special case it there...
>   # AT_STATX_SYNC_TYPE is not a bit, its a mask of AT_STATX_SYNC_AS_STAT, AT_STATX_FORCE_SYNC and AT_STATX_DONT_SYNC
> -# AT_HANDLE_FID and AT_HANDLE_MNT_ID_UNIQUE are reusing values and are valid only for name_to_handle_at()
> +# AT_HANDLE_FID, AT_HANDLE_MNT_ID_UNIQUE and AT_HANDLE_CONNECTABLE are reusing values and are valid only for name_to_handle_at()
>   # AT_RENAME_NOREPLACE reuses 0x1 and is valid only for renameat2()
>   grep -E $regex ${linux_fcntl} | \
>   	grep -v AT_EACCESS | \
>   	grep -v AT_STATX_SYNC_TYPE | \
>   	grep -v AT_HANDLE_FID | \
>   	grep -v AT_HANDLE_MNT_ID_UNIQUE | \
> +	grep -v AT_HANDLE_CONNECTABLE | \
>   	grep -v AT_RENAME_NOREPLACE | \
>   	sed -r "s/$regex/\2 \1/g"	| \
>   	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"

Re: [PATCH 11/11] perf tools: Fix build error on generated/fs_at_flags_array.c
Posted by Namhyung Kim 21 hours ago
Hello,

On Tue, Dec 03, 2024 at 04:43:44PM +0000, James Clark wrote:
> 
> 
> On 03/12/2024 3:53 am, Namhyung Kim wrote:
> > It should only have generic flags in the array but the recent header
> > sync brought a new flags to fcntl.h and caused a build error.  Let's
> > update the shell script to exclude flags specific to name_to_handle_at().
> > 
> >      CC      trace/beauty/fs_at_flags.o
> >    In file included from trace/beauty/fs_at_flags.c:21:
> >    tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: error: initialized field overwritten [-Werror=override-init]
> >       13 |         [ilog2(0x002) + 1] = "HANDLE_CONNECTABLE",
> >          |                              ^~~~~~~~~~~~~~~~~~~~
> >    tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: note: (near initialization for ‘fs_at_flags[2]’)
> > 
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> 
> Hi Namhyung,
> 
> Is it possible to fix this before the updates to keep it buildable? Maybe
> it's not feasible, I didn't check.
> 
> I did notice a build issue in the kvm tests after this update:
> 
> $ make O=../build/local/ summary=1 TARGETS=kvm kselftest
> 
> In file included from aarch64/aarch32_id_regs.c:14:
> include/aarch64/processor.h:15:10: fatal error: asm/brk-imm.h: No such file
> or directory
>    15 | #include <asm/brk-imm.h>
> 
> But I tried the same on v6.13-rc1 and got a different error, so I don't know
> if it's any worse.

I suspect it's an unrelated issue.  This fix is about generating
descriptions of the flags for perf trace beautifier.

The below is the only change I made in this series for arm64.

Thanks,
Namhyung


---8<---
diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h
index 964df31da9751c96..66736ff04011e0fa 100644
--- a/tools/arch/arm64/include/uapi/asm/kvm.h
+++ b/tools/arch/arm64/include/uapi/asm/kvm.h
@@ -484,6 +484,12 @@ enum {
  */
 #define KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2        (1ULL << 0)
 
+/*
+ * Shutdown caused by a PSCI v1.3 SYSTEM_OFF2 call.
+ * Valid only when the system event has a type of KVM_SYSTEM_EVENT_SHUTDOWN.
+ */
+#define KVM_SYSTEM_EVENT_SHUTDOWN_FLAG_PSCI_OFF2       (1ULL << 0)
+
 /* run->fail_entry.hardware_entry_failure_reason codes. */
 #define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED    (1ULL << 0)
Re: [PATCH 11/11] perf tools: Fix build error on generated/fs_at_flags_array.c
Posted by James Clark 9 hours ago

On 03/12/2024 9:54 pm, Namhyung Kim wrote:
> Hello,
> 
> On Tue, Dec 03, 2024 at 04:43:44PM +0000, James Clark wrote:
>>
>>
>> On 03/12/2024 3:53 am, Namhyung Kim wrote:
>>> It should only have generic flags in the array but the recent header
>>> sync brought a new flags to fcntl.h and caused a build error.  Let's
>>> update the shell script to exclude flags specific to name_to_handle_at().
>>>
>>>       CC      trace/beauty/fs_at_flags.o
>>>     In file included from trace/beauty/fs_at_flags.c:21:
>>>     tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: error: initialized field overwritten [-Werror=override-init]
>>>        13 |         [ilog2(0x002) + 1] = "HANDLE_CONNECTABLE",
>>>           |                              ^~~~~~~~~~~~~~~~~~~~
>>>     tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: note: (near initialization for ‘fs_at_flags[2]’)
>>>
>>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>>
>> Hi Namhyung,
>>
>> Is it possible to fix this before the updates to keep it buildable? Maybe
>> it's not feasible, I didn't check.
>>
>> I did notice a build issue in the kvm tests after this update:
>>
>> $ make O=../build/local/ summary=1 TARGETS=kvm kselftest
>>
>> In file included from aarch64/aarch32_id_regs.c:14:
>> include/aarch64/processor.h:15:10: fatal error: asm/brk-imm.h: No such file
>> or directory
>>     15 | #include <asm/brk-imm.h>
>>
>> But I tried the same on v6.13-rc1 and got a different error, so I don't know
>> if it's any worse.
> 
> I suspect it's an unrelated issue.  This fix is about generating
> descriptions of the flags for perf trace beautifier.
> 
> The below is the only change I made in this series for arm64.
> 
> Thanks,
> Namhyung
> 

I'll take a look

> 
> ---8<---
> diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h
> index 964df31da9751c96..66736ff04011e0fa 100644
> --- a/tools/arch/arm64/include/uapi/asm/kvm.h
> +++ b/tools/arch/arm64/include/uapi/asm/kvm.h
> @@ -484,6 +484,12 @@ enum {
>    */
>   #define KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2        (1ULL << 0)
>   
> +/*
> + * Shutdown caused by a PSCI v1.3 SYSTEM_OFF2 call.
> + * Valid only when the system event has a type of KVM_SYSTEM_EVENT_SHUTDOWN.
> + */
> +#define KVM_SYSTEM_EVENT_SHUTDOWN_FLAG_PSCI_OFF2       (1ULL << 0)
> +
>   /* run->fail_entry.hardware_entry_failure_reason codes. */
>   #define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED    (1ULL << 0)

Re: [PATCH 11/11] perf tools: Fix build error on generated/fs_at_flags_array.c
Posted by James Clark 8 hours ago

On 04/12/2024 9:39 am, James Clark wrote:
> 
> 
> On 03/12/2024 9:54 pm, Namhyung Kim wrote:
>> Hello,
>>
>> On Tue, Dec 03, 2024 at 04:43:44PM +0000, James Clark wrote:
>>>
>>>
>>> On 03/12/2024 3:53 am, Namhyung Kim wrote:
>>>> It should only have generic flags in the array but the recent header
>>>> sync brought a new flags to fcntl.h and caused a build error.  Let's
>>>> update the shell script to exclude flags specific to 
>>>> name_to_handle_at().
>>>>
>>>>       CC      trace/beauty/fs_at_flags.o
>>>>     In file included from trace/beauty/fs_at_flags.c:21:
>>>>     tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: 
>>>> error: initialized field overwritten [-Werror=override-init]
>>>>        13 |         [ilog2(0x002) + 1] = "HANDLE_CONNECTABLE",
>>>>           |                              ^~~~~~~~~~~~~~~~~~~~
>>>>     tools/perf/trace/beauty/generated/fs_at_flags_array.c:13:30: 
>>>> note: (near initialization for ‘fs_at_flags[2]’)
>>>>
>>>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>>>
>>> Hi Namhyung,
>>>
>>> Is it possible to fix this before the updates to keep it buildable? 
>>> Maybe
>>> it's not feasible, I didn't check.
>>>
>>> I did notice a build issue in the kvm tests after this update:
>>>
>>> $ make O=../build/local/ summary=1 TARGETS=kvm kselftest
>>>
>>> In file included from aarch64/aarch32_id_regs.c:14:
>>> include/aarch64/processor.h:15:10: fatal error: asm/brk-imm.h: No 
>>> such file
>>> or directory
>>>     15 | #include <asm/brk-imm.h>
>>>
>>> But I tried the same on v6.13-rc1 and got a different error, so I 
>>> don't know
>>> if it's any worse.
>>
>> I suspect it's an unrelated issue.  This fix is about generating
>> descriptions of the flags for perf trace beautifier.
>>
>> The below is the only change I made in this series for arm64.
>>
>> Thanks,
>> Namhyung
>>
> 
> I'll take a look
> 

Looked like some kind of stale build issue. A clean fixed it but I 
wasn't able to reproduce it.

>>
>> ---8<---
>> diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/ 
>> arm64/include/uapi/asm/kvm.h
>> index 964df31da9751c96..66736ff04011e0fa 100644
>> --- a/tools/arch/arm64/include/uapi/asm/kvm.h
>> +++ b/tools/arch/arm64/include/uapi/asm/kvm.h
>> @@ -484,6 +484,12 @@ enum {
>>    */
>>   #define KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2        (1ULL << 0)
>> +/*
>> + * Shutdown caused by a PSCI v1.3 SYSTEM_OFF2 call.
>> + * Valid only when the system event has a type of 
>> KVM_SYSTEM_EVENT_SHUTDOWN.
>> + */
>> +#define KVM_SYSTEM_EVENT_SHUTDOWN_FLAG_PSCI_OFF2       (1ULL << 0)
>> +
>>   /* run->fail_entry.hardware_entry_failure_reason codes. */
>>   #define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED    (1ULL << 0)
>