[PATCH 1/4] perf trace beauty: Fix statx flags printing

Changbin Du posted 4 patches 1 year, 9 months ago
[PATCH 1/4] perf trace beauty: Fix statx flags printing
Posted by Changbin Du 1 year, 9 months ago
Missed a string specifier '%s' in format string.

Signed-off-by: Changbin Du <changbin.du@huawei.com>
---
 tools/perf/trace/beauty/statx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/trace/beauty/statx.c b/tools/perf/trace/beauty/statx.c
index dc5943a6352d..c61f2be53bda 100644
--- a/tools/perf/trace/beauty/statx.c
+++ b/tools/perf/trace/beauty/statx.c
@@ -21,7 +21,7 @@ size_t syscall_arg__scnprintf_statx_flags(char *bf, size_t size, struct syscall_
 		return scnprintf(bf, size, "%s%s", show_prefix ? "AT_STATX_" : "", "SYNC_AS_STAT");
 #define	P_FLAG(n) \
 	if (flags & AT_##n) { \
-		printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
+		printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
 		flags &= ~AT_##n; \
 	}
 
-- 
2.34.1
Re: [PATCH 1/4] perf trace beauty: Fix statx flags printing
Posted by Arnaldo Carvalho de Melo 1 year, 9 months ago
On Thu, Apr 18, 2024 at 09:13:01PM +0800, Changbin Du wrote:
> Missed a string specifier '%s' in format string.

Humm, what branch should this be applied to? I ask because:

⬢[acme@toolbox perf-tools-next]$ git log --oneline tools/perf/trace/beauty/statx.c
f122b3d6d179455e perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument
3d6cfbaf279ddec9 perf beauty: Introduce scrape script for various fs syscalls 'flags' arguments
a672af9139a843eb tools headers: Remove almost unused copy of uapi/stat.h, add few conditional defines
6652830c87be8446 perf beauty: Use the system linux/fcntl.h instead of a copy from the kernel
690811f0128eb603 tools headers uapi: Sync linux/stat.h with the kernel sources to pick STATX_MNT_ID_UNIQUE
49c75d30b0078d30 tools headers uapi: Sync linux/stat.h with the kernel sources
5d33cbfedb51f732 perf beauty: Add support to STATX_MNT_ID in the 'statx' syscall 'mask' argument
c65c83ffe9045901 perf trace: Allow asking for not suppressing common string prefixes
794f594e0c3be619 perf beauty: Switch from GPL v2.0 to LGPL v2.1
fd5cead23f546973 (tag: perf-core-for-mingo-4.12-20170331) perf trace: Beautify statx syscall 'flag' and 'mask' arguments
⬢[acme@toolbox perf-tools-next]$

⬢[acme@toolbox perf-tools-next]$ tools/perf/trace/beauty/statx_mask.sh 
static const char *statx_mask[] = {
	[ilog2(0x00000001) + 1] = "TYPE",
	[ilog2(0x00000002) + 1] = "MODE",
	[ilog2(0x00000004) + 1] = "NLINK",
	[ilog2(0x00000008) + 1] = "UID",
	[ilog2(0x00000010) + 1] = "GID",
	[ilog2(0x00000020) + 1] = "ATIME",
	[ilog2(0x00000040) + 1] = "MTIME",
	[ilog2(0x00000080) + 1] = "CTIME",
	[ilog2(0x00000100) + 1] = "INO",
	[ilog2(0x00000200) + 1] = "SIZE",
	[ilog2(0x00000400) + 1] = "BLOCKS",
	[ilog2(0x00000800) + 1] = "BTIME",
	[ilog2(0x00001000) + 1] = "MNT_ID",
	[ilog2(0x00002000) + 1] = "DIOALIGN",
	[ilog2(0x00004000) + 1] = "MNT_ID_UNIQUE",
};
⬢[acme@toolbox perf-tools-next]$

Can you please try with what is in
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git,
branch perf-tools-next?

- Arnaldo
 
> Signed-off-by: Changbin Du <changbin.du@huawei.com>
> ---
>  tools/perf/trace/beauty/statx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/trace/beauty/statx.c b/tools/perf/trace/beauty/statx.c
> index dc5943a6352d..c61f2be53bda 100644
> --- a/tools/perf/trace/beauty/statx.c
> +++ b/tools/perf/trace/beauty/statx.c
> @@ -21,7 +21,7 @@ size_t syscall_arg__scnprintf_statx_flags(char *bf, size_t size, struct syscall_
>  		return scnprintf(bf, size, "%s%s", show_prefix ? "AT_STATX_" : "", "SYNC_AS_STAT");
>  #define	P_FLAG(n) \
>  	if (flags & AT_##n) { \
> -		printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
> +		printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
>  		flags &= ~AT_##n; \
>  	}
>  
> -- 
> 2.34.1
Re: [PATCH 1/4] perf trace beauty: Fix statx flags printing
Posted by duchangbin 1 year, 9 months ago
Hi, Arnaldo,

On Thu, Apr 18, 2024 at 11:35:05AM -0300, Arnaldo Carvalho de Melo wrote:
> On Thu, Apr 18, 2024 at 09:13:01PM +0800, Changbin Du wrote:
> > Missed a string specifier '%s' in format string.
> 
> Humm, what branch should this be applied to? I ask because:
> 
> ⬢[acme@toolbox perf-tools-next]$ git log --oneline tools/perf/trace/beauty/statx.c
> f122b3d6d179455e perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument
> 3d6cfbaf279ddec9 perf beauty: Introduce scrape script for various fs syscalls 'flags' arguments
> a672af9139a843eb tools headers: Remove almost unused copy of uapi/stat.h, add few conditional defines
> 6652830c87be8446 perf beauty: Use the system linux/fcntl.h instead of a copy from the kernel
> 690811f0128eb603 tools headers uapi: Sync linux/stat.h with the kernel sources to pick STATX_MNT_ID_UNIQUE
> 49c75d30b0078d30 tools headers uapi: Sync linux/stat.h with the kernel sources
> 5d33cbfedb51f732 perf beauty: Add support to STATX_MNT_ID in the 'statx' syscall 'mask' argument
> c65c83ffe9045901 perf trace: Allow asking for not suppressing common string prefixes
> 794f594e0c3be619 perf beauty: Switch from GPL v2.0 to LGPL v2.1
> fd5cead23f546973 (tag: perf-core-for-mingo-4.12-20170331) perf trace: Beautify statx syscall 'flag' and 'mask' arguments
> ⬢[acme@toolbox perf-tools-next]$
> 
> ⬢[acme@toolbox perf-tools-next]$ tools/perf/trace/beauty/statx_mask.sh 
> static const char *statx_mask[] = {
> 	[ilog2(0x00000001) + 1] = "TYPE",
> 	[ilog2(0x00000002) + 1] = "MODE",
> 	[ilog2(0x00000004) + 1] = "NLINK",
> 	[ilog2(0x00000008) + 1] = "UID",
> 	[ilog2(0x00000010) + 1] = "GID",
> 	[ilog2(0x00000020) + 1] = "ATIME",
> 	[ilog2(0x00000040) + 1] = "MTIME",
> 	[ilog2(0x00000080) + 1] = "CTIME",
> 	[ilog2(0x00000100) + 1] = "INO",
> 	[ilog2(0x00000200) + 1] = "SIZE",
> 	[ilog2(0x00000400) + 1] = "BLOCKS",
> 	[ilog2(0x00000800) + 1] = "BTIME",
> 	[ilog2(0x00001000) + 1] = "MNT_ID",
> 	[ilog2(0x00002000) + 1] = "DIOALIGN",
> 	[ilog2(0x00004000) + 1] = "MNT_ID_UNIQUE",
> };
> ⬢[acme@toolbox perf-tools-next]$
> 
> Can you please try with what is in
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git,
> branch perf-tools-next?
> 
> - Arnaldo
>
This code has been refactored and the old bug is gone. Could you just pick up
the last two changes?

  perf trace beauty: Always show param if show_zero is set
  perf trace beauty: Always show mprotect prot even though PROT_NONE

-- 
Cheers,
Changbin Du
Re: [PATCH 1/4] perf trace beauty: Fix statx flags printing
Posted by duchangbin 1 year, 9 months ago
On Thu, Apr 18, 2024 at 11:35:05AM -0300, Arnaldo Carvalho de Melo wrote:
> On Thu, Apr 18, 2024 at 09:13:01PM +0800, Changbin Du wrote:
> > Missed a string specifier '%s' in format string.
> 
> Humm, what branch should this be applied to? I ask because:
> 
> ⬢[acme@toolbox perf-tools-next]$ git log --oneline tools/perf/trace/beauty/statx.c
> f122b3d6d179455e perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument
> 3d6cfbaf279ddec9 perf beauty: Introduce scrape script for various fs syscalls 'flags' arguments
> a672af9139a843eb tools headers: Remove almost unused copy of uapi/stat.h, add few conditional defines
> 6652830c87be8446 perf beauty: Use the system linux/fcntl.h instead of a copy from the kernel
> 690811f0128eb603 tools headers uapi: Sync linux/stat.h with the kernel sources to pick STATX_MNT_ID_UNIQUE
> 49c75d30b0078d30 tools headers uapi: Sync linux/stat.h with the kernel sources
> 5d33cbfedb51f732 perf beauty: Add support to STATX_MNT_ID in the 'statx' syscall 'mask' argument
> c65c83ffe9045901 perf trace: Allow asking for not suppressing common string prefixes
> 794f594e0c3be619 perf beauty: Switch from GPL v2.0 to LGPL v2.1
> fd5cead23f546973 (tag: perf-core-for-mingo-4.12-20170331) perf trace: Beautify statx syscall 'flag' and 'mask' arguments
> ⬢[acme@toolbox perf-tools-next]$
> 
> ⬢[acme@toolbox perf-tools-next]$ tools/perf/trace/beauty/statx_mask.sh 
> static const char *statx_mask[] = {
> 	[ilog2(0x00000001) + 1] = "TYPE",
> 	[ilog2(0x00000002) + 1] = "MODE",
> 	[ilog2(0x00000004) + 1] = "NLINK",
> 	[ilog2(0x00000008) + 1] = "UID",
> 	[ilog2(0x00000010) + 1] = "GID",
> 	[ilog2(0x00000020) + 1] = "ATIME",
> 	[ilog2(0x00000040) + 1] = "MTIME",
> 	[ilog2(0x00000080) + 1] = "CTIME",
> 	[ilog2(0x00000100) + 1] = "INO",
> 	[ilog2(0x00000200) + 1] = "SIZE",
> 	[ilog2(0x00000400) + 1] = "BLOCKS",
> 	[ilog2(0x00000800) + 1] = "BTIME",
> 	[ilog2(0x00001000) + 1] = "MNT_ID",
> 	[ilog2(0x00002000) + 1] = "DIOALIGN",
> 	[ilog2(0x00004000) + 1] = "MNT_ID_UNIQUE",
> };
> ⬢[acme@toolbox perf-tools-next]$
> 
> Can you please try with what is in
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git,
> branch perf-tools-next?
> 
No problem, let me rebase on perf-tools-next. This patchset was created on
mainline.

> - Arnaldo
>  
> > Signed-off-by: Changbin Du <changbin.du@huawei.com>
> > ---
> >  tools/perf/trace/beauty/statx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/trace/beauty/statx.c b/tools/perf/trace/beauty/statx.c
> > index dc5943a6352d..c61f2be53bda 100644
> > --- a/tools/perf/trace/beauty/statx.c
> > +++ b/tools/perf/trace/beauty/statx.c
> > @@ -21,7 +21,7 @@ size_t syscall_arg__scnprintf_statx_flags(char *bf, size_t size, struct syscall_
> >  		return scnprintf(bf, size, "%s%s", show_prefix ? "AT_STATX_" : "", "SYNC_AS_STAT");
> >  #define	P_FLAG(n) \
> >  	if (flags & AT_##n) { \
> > -		printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
> > +		printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
> >  		flags &= ~AT_##n; \
> >  	}
> >  
> > -- 
> > 2.34.1
> 

-- 
Cheers,
Changbin Du