[PATCH] tracing: eliminate const char[] auto variables

2018-11-02 Thread Rasmus Villemoes
iable used in tracing_mark_raw_write(). Finally, for the two runs of spaces, just use variables initialized with string literals; the linker (at least for x86) will reuse the tail of the longer for the shorter string. Signed-off-by: Rasmus Villemoes --- kernel/trace/ftrace.c | 2 +- kernel/tra

Re: [RFC PATCH 0/7] runtime format string checking

2018-11-02 Thread Rasmus Villemoes
[trimming cc list] On 2018-11-01 23:57, Kees Cook wrote: > On Thu, Nov 1, 2018 at 3:06 PM, Rasmus Villemoes > wrote: >> referring to an anonymous object in .rodata; one gets code gen like >> >> +: 31 c0 xor%eax,%eax >> +:

Re: [RFC PATCH 0/7] runtime format string checking

2018-11-02 Thread Rasmus Villemoes
[trimming cc list] On 2018-11-01 23:57, Kees Cook wrote: > On Thu, Nov 1, 2018 at 3:06 PM, Rasmus Villemoes > wrote: >> referring to an anonymous object in .rodata; one gets code gen like >> >> +: 31 c0 xor%eax,%eax >> +:

[PATCH 2/3] drivers/char/random.c: remove unused stuct poolinfo::poolbits

2018-11-02 Thread Rasmus Villemoes
This field is never used, might as well remove it. Signed-off-by: Rasmus Villemoes --- drivers/char/random.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 320108df04c1..1b2e1580b4b5 100644 --- a/drivers/char

[PATCH 2/3] drivers/char/random.c: remove unused stuct poolinfo::poolbits

2018-11-02 Thread Rasmus Villemoes
This field is never used, might as well remove it. Signed-off-by: Rasmus Villemoes --- drivers/char/random.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 320108df04c1..1b2e1580b4b5 100644 --- a/drivers/char

[PATCH 3/3] drivers/char/random.c: make primary_crng static

2018-11-02 Thread Rasmus Villemoes
Since the definition of struct crng_state is private to random.c, and primary_crng is neither declared or used elsewhere, there's no reason for that symbol to have external linkage. Signed-off-by: Rasmus Villemoes --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 1/3] drivers/char/random.c: constify poolinfo_table

2018-11-02 Thread Rasmus Villemoes
Never modified, might as well be put in .rodata. Signed-off-by: Rasmus Villemoes --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 2eb70e76ed35..320108df04c1 100644 --- a/drivers/char/random.c +++ b

[PATCH 3/3] drivers/char/random.c: make primary_crng static

2018-11-02 Thread Rasmus Villemoes
Since the definition of struct crng_state is private to random.c, and primary_crng is neither declared or used elsewhere, there's no reason for that symbol to have external linkage. Signed-off-by: Rasmus Villemoes --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 1/3] drivers/char/random.c: constify poolinfo_table

2018-11-02 Thread Rasmus Villemoes
Never modified, might as well be put in .rodata. Signed-off-by: Rasmus Villemoes --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 2eb70e76ed35..320108df04c1 100644 --- a/drivers/char/random.c +++ b

Re: [RFC PATCH 1/7] compiler_attributes.h: add __attribute__((format_arg)) shorthand

2018-11-02 Thread Rasmus Villemoes
On 2018-11-02 11:36, Miguel Ojeda wrote: > Hi Rasmus, > > On Sat, Oct 27, 2018 at 2:06 PM Miguel Ojeda > wrote: >> >> I did quick check and gcc >= 4.1, clang >= 3.0, icc >= 13 compilers >> seem to support it (or at least recognize it, even if they just ignore >> it), so we do not need to make it

Re: [RFC PATCH 1/7] compiler_attributes.h: add __attribute__((format_arg)) shorthand

2018-11-02 Thread Rasmus Villemoes
On 2018-11-02 11:36, Miguel Ojeda wrote: > Hi Rasmus, > > On Sat, Oct 27, 2018 at 2:06 PM Miguel Ojeda > wrote: >> >> I did quick check and gcc >= 4.1, clang >= 3.0, icc >= 13 compilers >> seem to support it (or at least recognize it, even if they just ignore >> it), so we do not need to make it

Re: [PATCH] fs: proc: move linux_proc_banner to where it is used

2018-10-30 Thread Rasmus Villemoes
On 2018-10-27 21:47, Alexey Dobriyan wrote: > On Fri, Oct 26, 2018 at 11:20:34PM +0200, Rasmus Villemoes wrote: >> +#include > >> +#define linux_proc_banner \ >> +"%s version %s" \ >> +" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_

Re: [PATCH] fs: proc: move linux_proc_banner to where it is used

2018-10-30 Thread Rasmus Villemoes
On 2018-10-27 21:47, Alexey Dobriyan wrote: > On Fri, Oct 26, 2018 at 11:20:34PM +0200, Rasmus Villemoes wrote: >> +#include > >> +#define linux_proc_banner \ >> +"%s version %s" \ >> +" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_

[PATCH v2 1/3] tracing: merge seq_print_sym_short() and seq_print_sym_offset()

2018-10-29 Thread Rasmus Villemoes
These two functions are nearly identical, so we can avoid some code duplication by moving the conditional into a common implementation. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_output.c | 34 +++--- 1 file changed, 7 insertions(+), 27 deletions(-) diff

[PATCH v2 1/3] tracing: merge seq_print_sym_short() and seq_print_sym_offset()

2018-10-29 Thread Rasmus Villemoes
These two functions are nearly identical, so we can avoid some code duplication by moving the conditional into a common implementation. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_output.c | 34 +++--- 1 file changed, 7 insertions(+), 27 deletions(-) diff

[PATCH v2 3/3] tracing: simplify printf'ing in seq_print_sym

2018-10-29 Thread Rasmus Villemoes
eclaration of the str buffer inside the CONFIG_KALLSYMS guard, which in turn will make gcc inline the function for !CONFIG_KALLSYMS (it only has a single caller, but the huge stack frame seems to make gcc not inline it for CONFIG_KALLSYMS). Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_ou

[PATCH v2 3/3] tracing: simplify printf'ing in seq_print_sym

2018-10-29 Thread Rasmus Villemoes
eclaration of the str buffer inside the CONFIG_KALLSYMS guard, which in turn will make gcc inline the function for !CONFIG_KALLSYMS (it only has a single caller, but the huge stack frame seems to make gcc not inline it for CONFIG_KALLSYMS). Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_ou

[PATCH v2 2/3] tracing: avoid -Wformat-nonliteral warning

2018-10-29 Thread Rasmus Villemoes
a single caller which passes "%s" as fmt, so we might as well just use that directly. That also paves the way for further cleanups that will actually make that format string go away entirely. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_output.c | 9 - 1 file changed, 4

[PATCH v2 0/3] tracing: a few simplifying patches

2018-10-29 Thread Rasmus Villemoes
-> offset. Rasmus Villemoes (3): tracing: merge seq_print_sym_short() and seq_print_sym_offset() tracing: avoid -Wformat-nonliteral warning tracing: simplify printf'ing in seq_print_sym kernel/trace/trace_output.c | 38 - 1 file changed, 8 insertions(+),

[PATCH v2 2/3] tracing: avoid -Wformat-nonliteral warning

2018-10-29 Thread Rasmus Villemoes
a single caller which passes "%s" as fmt, so we might as well just use that directly. That also paves the way for further cleanups that will actually make that format string go away entirely. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_output.c | 9 - 1 file changed, 4

[PATCH v2 0/3] tracing: a few simplifying patches

2018-10-29 Thread Rasmus Villemoes
-> offset. Rasmus Villemoes (3): tracing: merge seq_print_sym_short() and seq_print_sym_offset() tracing: avoid -Wformat-nonliteral warning tracing: simplify printf'ing in seq_print_sym kernel/trace/trace_output.c | 38 - 1 file changed, 8 insertions(+),

[tip:x86/urgent] x86/traps: Use format string with panic() call

2018-10-29 Thread tip-bot for Rasmus Villemoes
Commit-ID: 2022cceb4e30f1bb4c84d40ffa705aa8d8d68adb Gitweb: https://git.kernel.org/tip/2022cceb4e30f1bb4c84d40ffa705aa8d8d68adb Author: Rasmus Villemoes AuthorDate: Sat, 27 Oct 2018 00:20:04 +0200 Committer: Ingo Molnar CommitDate: Mon, 29 Oct 2018 07:19:26 +0100 x86/traps: Use format

[tip:x86/urgent] x86/traps: Use format string with panic() call

2018-10-29 Thread tip-bot for Rasmus Villemoes
Commit-ID: 2022cceb4e30f1bb4c84d40ffa705aa8d8d68adb Gitweb: https://git.kernel.org/tip/2022cceb4e30f1bb4c84d40ffa705aa8d8d68adb Author: Rasmus Villemoes AuthorDate: Sat, 27 Oct 2018 00:20:04 +0200 Committer: Ingo Molnar CommitDate: Mon, 29 Oct 2018 07:19:26 +0100 x86/traps: Use format

Re: [RFC PATCH 1/7] compiler_attributes.h: add __attribute__((format_arg)) shorthand

2018-10-29 Thread Rasmus Villemoes
On 2018-10-27 14:06, Miguel Ojeda wrote: > Hi Rasmus, > > On Sat, Oct 27, 2018 at 1:24 AM Rasmus Villemoes > wrote: >> >> +/* >> + * Optional > > I did quick check and gcc >= 4.1, clang >= 3.0, icc >= 13 compilers > seem to support it (or

Re: [RFC PATCH 1/7] compiler_attributes.h: add __attribute__((format_arg)) shorthand

2018-10-29 Thread Rasmus Villemoes
On 2018-10-27 14:06, Miguel Ojeda wrote: > Hi Rasmus, > > On Sat, Oct 27, 2018 at 1:24 AM Rasmus Villemoes > wrote: >> >> +/* >> + * Optional > > I did quick check and gcc >= 4.1, clang >= 3.0, icc >= 13 compilers > seem to support it (or

[RFC PATCH 5/7] kernel/kthread.c: do runtime check of format string in kthread_create_on_cpu()

2018-10-26 Thread Rasmus Villemoes
One is supposed to pass in a format string containing (at most) one %u instance. Use fmtcheck() to enforce that at runtime, WARNing and falling back to a harmless "kthread/%u" in case verification fails. Signed-off-by: Rasmus Villemoes --- kernel/kthread.c | 4 ++-- 1 file changed, 2

[RFC PATCH 2/7] lib/vsprintf.c: add fmtcheck utility

2018-10-26 Thread Rasmus Villemoes
n linux) contain a fmtcheck() function; I took the name and return semantics from that. Signed-off-by: Rasmus Villemoes --- include/linux/kernel.h | 18 lib/Kconfig.debug | 9 ++ lib/vsprintf.c | 65 ++ 3 files changed, 92

[RFC PATCH 1/7] compiler_attributes.h: add __attribute__((format_arg)) shorthand

2018-10-26 Thread Rasmus Villemoes
mpiler cannot do any type checking. Even a static inline fmtcheck() that just returns its first argument would provide documentation for which specifiers what->ever is supposed to contain, but we'll implement an actual run-time check later. Signed-off-by: Rasmus Villemoes --- include/linux/co

[RFC PATCH 6/7] nfs: use fmtcheck() in root_nfs_data

2018-10-26 Thread Rasmus Villemoes
eck of fmt to ensure it doesn't contain odd printf specifiers that would make snprintf go off into the weeds. The lack of the FMTCHECK_NO_EXTRA_ARGS flag (i.e., the last 0 argument) means we allow either no specifiers or precisely one occurrence of %s in tmp. Signed-off-by: Rasmus Villemoes -

[RFC PATCH 4/7] lib/test_printf.c: add a few fmtcheck() test cases

2018-10-26 Thread Rasmus Villemoes
It should be trivial to add more test cases, once we figure out the exact rules for being compatible or not. Perhaps we'll have to extend the struct test with a flags element if we add flags that affect the return value. Signed-off-by: Rasmus Villemoes --- lib/test_printf.c | 43

[RFC PATCH 5/7] kernel/kthread.c: do runtime check of format string in kthread_create_on_cpu()

2018-10-26 Thread Rasmus Villemoes
One is supposed to pass in a format string containing (at most) one %u instance. Use fmtcheck() to enforce that at runtime, WARNing and falling back to a harmless "kthread/%u" in case verification fails. Signed-off-by: Rasmus Villemoes --- kernel/kthread.c | 4 ++-- 1 file changed, 2

[RFC PATCH 2/7] lib/vsprintf.c: add fmtcheck utility

2018-10-26 Thread Rasmus Villemoes
n linux) contain a fmtcheck() function; I took the name and return semantics from that. Signed-off-by: Rasmus Villemoes --- include/linux/kernel.h | 18 lib/Kconfig.debug | 9 ++ lib/vsprintf.c | 65 ++ 3 files changed, 92

[RFC PATCH 1/7] compiler_attributes.h: add __attribute__((format_arg)) shorthand

2018-10-26 Thread Rasmus Villemoes
mpiler cannot do any type checking. Even a static inline fmtcheck() that just returns its first argument would provide documentation for which specifiers what->ever is supposed to contain, but we'll implement an actual run-time check later. Signed-off-by: Rasmus Villemoes --- include/linux/co

[RFC PATCH 6/7] nfs: use fmtcheck() in root_nfs_data

2018-10-26 Thread Rasmus Villemoes
eck of fmt to ensure it doesn't contain odd printf specifiers that would make snprintf go off into the weeds. The lack of the FMTCHECK_NO_EXTRA_ARGS flag (i.e., the last 0 argument) means we allow either no specifiers or precisely one occurrence of %s in tmp. Signed-off-by: Rasmus Villemoes -

[RFC PATCH 4/7] lib/test_printf.c: add a few fmtcheck() test cases

2018-10-26 Thread Rasmus Villemoes
It should be trivial to add more test cases, once we figure out the exact rules for being compatible or not. Perhaps we'll have to extend the struct test with a flags element if we add flags that affect the return value. Signed-off-by: Rasmus Villemoes --- lib/test_printf.c | 43

[RFC PATCH 3/7] kernel.h: implement fmtmatch() wrapper around fmtcheck()

2018-10-26 Thread Rasmus Villemoes
Some users may prefer to check a "user-supplied" string upfront and return EINVAL rather than using the the template as a fallback for printf'ing later. fmtmatch() is simply a shorthand for fmtcheck(a, b, c | FMTCHECK_SILENT) == a. Signed-off-by: Rasmus Villemoes --- include/linu

[RFC PATCH 3/7] kernel.h: implement fmtmatch() wrapper around fmtcheck()

2018-10-26 Thread Rasmus Villemoes
Some users may prefer to check a "user-supplied" string upfront and return EINVAL rather than using the the template as a fallback for printf'ing later. fmtmatch() is simply a shorthand for fmtcheck(a, b, c | FMTCHECK_SILENT) == a. Signed-off-by: Rasmus Villemoes --- include/linu

[PATCH] x86: traps.c: use format string with panic() call

2018-10-26 Thread Rasmus Villemoes
with a string not containing format specifiers, but we might as well silence this warning using "%s" as format string. Signed-off-by: Rasmus Villemoes --- arch/x86/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/traps.c b/arch/x86/kern

[PATCH] x86: traps.c: use format string with panic() call

2018-10-26 Thread Rasmus Villemoes
with a string not containing format specifiers, but we might as well silence this warning using "%s" as format string. Signed-off-by: Rasmus Villemoes --- arch/x86/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/traps.c b/arch/x86/kern

[PATCH] fs: proc: move linux_proc_banner to where it is used

2018-10-26 Thread Rasmus Villemoes
to complain in the unlikely case one of the LINUX_* strings ended up containing a %. This also avoids compiling it in for !CONFIG_PROC_FS. Signed-off-by: Rasmus Villemoes --- fs/proc/version.c | 6 ++ include/linux/printk.h | 1 - init/version.c | 5 - 3 files changed, 6 insertions

[PATCH] fs: proc: move linux_proc_banner to where it is used

2018-10-26 Thread Rasmus Villemoes
to complain in the unlikely case one of the LINUX_* strings ended up containing a %. This also avoids compiling it in for !CONFIG_PROC_FS. Signed-off-by: Rasmus Villemoes --- fs/proc/version.c | 6 ++ include/linux/printk.h | 1 - init/version.c | 5 - 3 files changed, 6 insertions

[PATCH 3/3] tracing: simplify printf'ing in seq_print_sym

2018-10-26 Thread Rasmus Villemoes
eclaration of the str buffer inside the CONFIG_KALLSYMS guard, which in turn will make gcc inline the function for !CONFIG_KALLSYMS (it only has a single caller, but the huge stack frame seems to make gcc not inline it for CONFIG_KALLSYMS). Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_ou

[PATCH 1/3] tracing: merge seq_print_sym_short() and seq_print_sym_offset()

2018-10-26 Thread Rasmus Villemoes
These two functions are nearly identical, so we can avoid some code duplication by moving the conditional into a common implementation. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_output.c | 34 +++--- 1 file changed, 7 insertions(+), 27 deletions(-) diff

[PATCH 2/3] tracing: avoid -Wformat-nonliteral warning

2018-10-26 Thread Rasmus Villemoes
a single caller which passes "%s" as fmt, so we might as well just use that directly. That also paves the way for further cleanups that will actually make that format string go away entirely. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_output.c | 9 - 1 file changed, 4

[PATCH 3/3] tracing: simplify printf'ing in seq_print_sym

2018-10-26 Thread Rasmus Villemoes
eclaration of the str buffer inside the CONFIG_KALLSYMS guard, which in turn will make gcc inline the function for !CONFIG_KALLSYMS (it only has a single caller, but the huge stack frame seems to make gcc not inline it for CONFIG_KALLSYMS). Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_ou

[PATCH 1/3] tracing: merge seq_print_sym_short() and seq_print_sym_offset()

2018-10-26 Thread Rasmus Villemoes
These two functions are nearly identical, so we can avoid some code duplication by moving the conditional into a common implementation. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_output.c | 34 +++--- 1 file changed, 7 insertions(+), 27 deletions(-) diff

[PATCH 2/3] tracing: avoid -Wformat-nonliteral warning

2018-10-26 Thread Rasmus Villemoes
a single caller which passes "%s" as fmt, so we might as well just use that directly. That also paves the way for further cleanups that will actually make that format string go away entirely. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_output.c | 9 - 1 file changed, 4

Re: [PATCH AUTOSEL 3.18 15/98] usb: musb: Fix a few off-by-one lengths

2018-10-26 Thread Rasmus Villemoes
On 2018-10-25 16:17, Sasha Levin wrote: > From: Rasmus Villemoes > > [ Upstream commit e87c3f80ad0490d26ffe04754b7d094463b40f30 ] > > !strncmp(buf, "force host", 9) is true if and only if buf starts with > "force hos". This was obviously not what was intend

Re: [PATCH AUTOSEL 3.18 15/98] usb: musb: Fix a few off-by-one lengths

2018-10-26 Thread Rasmus Villemoes
On 2018-10-25 16:17, Sasha Levin wrote: > From: Rasmus Villemoes > > [ Upstream commit e87c3f80ad0490d26ffe04754b7d094463b40f30 ] > > !strncmp(buf, "force host", 9) is true if and only if buf starts with > "force hos". This was obviously not what was intend

[PATCH] fs/file.c: make more use of cloexec bits not being cleared

2018-10-24 Thread Rasmus Villemoes
the state of close_on_exec in the new bits when we expand the fdtable, we don't need to clear close_on_exec[i] in do_close_on_exec, and since we may have quite a few bits set in close_on_exec[i] without an actual open file, mask the set with open_fds[i]. Signed-off-by: Rasmus Villemoes --- fs

[PATCH] fs/file.c: make more use of cloexec bits not being cleared

2018-10-24 Thread Rasmus Villemoes
the state of close_on_exec in the new bits when we expand the fdtable, we don't need to clear close_on_exec[i] in do_close_on_exec, and since we may have quite a few bits set in close_on_exec[i] without an actual open file, mask the set with open_fds[i]. Signed-off-by: Rasmus Villemoes --- fs

[PATCH v2] staging: greybus: loopback.c: remove unused lists

2018-10-24 Thread Rasmus Villemoes
. Reviewed-by: Bryan O'Donoghue Signed-off-by: Rasmus Villemoes --- Sending as a proper patch. Marked v2 since this replaces earlier 2/3 and 3/3 patches. Applies on top of b4fc4e8340784e30c5a59bf0791f9c3ce15e (staging: greybus: loopback.c: remove unused gb_loopback::lbid). drivers/staging

[PATCH v2] staging: greybus: loopback.c: remove unused lists

2018-10-24 Thread Rasmus Villemoes
. Reviewed-by: Bryan O'Donoghue Signed-off-by: Rasmus Villemoes --- Sending as a proper patch. Marked v2 since this replaces earlier 2/3 and 3/3 patches. Applies on top of b4fc4e8340784e30c5a59bf0791f9c3ce15e (staging: greybus: loopback.c: remove unused gb_loopback::lbid). drivers/staging

Re: [PATCH 2/3] staging: greybus: loopback.c: do insertion in O(n) instead of O(n lg n)

2018-10-23 Thread Rasmus Villemoes
On 2018-10-11 01:03, Bryan O'Donoghue wrote: > On 05/10/2018 15:28, Rasmus Villemoes wrote: >> Signed-off-by: Rasmus Villemoes >> --- >> I have no idea if the performance matters (it probably doesn't). Feel >> free to ignore this and the followup cleanup. > > What

Re: [PATCH 2/3] staging: greybus: loopback.c: do insertion in O(n) instead of O(n lg n)

2018-10-23 Thread Rasmus Villemoes
On 2018-10-11 01:03, Bryan O'Donoghue wrote: > On 05/10/2018 15:28, Rasmus Villemoes wrote: >> Signed-off-by: Rasmus Villemoes >> --- >> I have no idea if the performance matters (it probably doesn't). Feel >> free to ignore this and the followup cleanup. > > What

[POC 01/12] Accessing __ro_after_init variables as immediates

2018-10-17 Thread Rasmus Villemoes
cache miss is hardly noticable. Comments? Flames? Signed-off-by: Rasmus Villemoes --- include/linux/rai.h | 83 + 1 file changed, 83 insertions(+) create mode 100644 include/linux/rai.h diff --git a/include/linux/rai.h b/include/linux/rai.h new

[POC 01/12] Accessing __ro_after_init variables as immediates

2018-10-17 Thread Rasmus Villemoes
cache miss is hardly noticable. Comments? Flames? Signed-off-by: Rasmus Villemoes --- include/linux/rai.h | 83 + 1 file changed, 83 insertions(+) create mode 100644 include/linux/rai.h diff --git a/include/linux/rai.h b/include/linux/rai.h new

[POC 07/12] x86-64: rai: implement _rai_load

2018-10-17 Thread Rasmus Villemoes
t;cat /proc/rai" continues to print "one: 1, two: 2, three: 3". Signed-off-by: Rasmus Villemoes --- arch/x86/include/asm/rai.S | 42 +- arch/x86/include/asm/rai.h | 30 ++- arch/x86/kernel/rai.c | 18

[POC 07/12] x86-64: rai: implement _rai_load

2018-10-17 Thread Rasmus Villemoes
t;cat /proc/rai" continues to print "one: 1, two: 2, three: 3". Signed-off-by: Rasmus Villemoes --- arch/x86/include/asm/rai.S | 42 +- arch/x86/include/asm/rai.h | 30 ++- arch/x86/kernel/rai.c | 18

[POC 09/12] fs/inode.c: access inode_cachep via rai_load

2018-10-17 Thread Rasmus Villemoes
This avoids a cacheline access to get the value of the inode_cachep pointer in the places that do a kmem_cache_*(inode_cachep, ...); Signed-off-by: Rasmus Villemoes --- fs/inode.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index

[POC 05/12] x86-64: initial ro-after-init patching support

2018-10-17 Thread Rasmus Villemoes
This just sets things up so that the ARCH_HAS_RAI symbol gets selected, and prepare the arch-specific headers and support functions. Signed-off-by: Rasmus Villemoes --- arch/x86/Kconfig | 1 + arch/x86/include/asm/rai.S | 18 ++ arch/x86/include/asm/rai.h | 25

[POC 08/12] fs/dcache.c: access dentry_cache via rai_load

2018-10-17 Thread Rasmus Villemoes
This avoids a cacheline access to get the value of the dentry_cache pointer in the places that do a kmem_cache_*(dentry_cache, ...); Signed-off-by: Rasmus Villemoes --- fs/dcache.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index

[POC 09/12] fs/inode.c: access inode_cachep via rai_load

2018-10-17 Thread Rasmus Villemoes
This avoids a cacheline access to get the value of the inode_cachep pointer in the places that do a kmem_cache_*(inode_cachep, ...); Signed-off-by: Rasmus Villemoes --- fs/inode.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index

[POC 05/12] x86-64: initial ro-after-init patching support

2018-10-17 Thread Rasmus Villemoes
This just sets things up so that the ARCH_HAS_RAI symbol gets selected, and prepare the arch-specific headers and support functions. Signed-off-by: Rasmus Villemoes --- arch/x86/Kconfig | 1 + arch/x86/include/asm/rai.S | 18 ++ arch/x86/include/asm/rai.h | 25

[POC 08/12] fs/dcache.c: access dentry_cache via rai_load

2018-10-17 Thread Rasmus Villemoes
This avoids a cacheline access to get the value of the dentry_cache pointer in the places that do a kmem_cache_*(dentry_cache, ...); Signed-off-by: Rasmus Villemoes --- fs/dcache.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index

[POC 04/12] vmlinux.lds.h: handle various rai sections

2018-10-17 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- include/asm-generic/vmlinux.lds.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index f09ee3c544bc..f38510c6bfcc 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm

[POC 04/12] vmlinux.lds.h: handle various rai sections

2018-10-17 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- include/asm-generic/vmlinux.lds.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index f09ee3c544bc..f38510c6bfcc 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm

[POC 11/12] x86-64: implement _rai_bucket_shift

2018-10-17 Thread Rasmus Villemoes
or any other) and adjust the stack pointer. The patched code does need to do a shr, so I don't think there's a way around the cc clobber. Signed-off-by: Rasmus Villemoes --- arch/x86/include/asm/rai.S | 59 ++ arch/x86/include/asm/rai.h | 21

[POC 03/12] arch/Kconfig: add ARCH_HAS_RAI symbol

2018-10-17 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- arch/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 9d329608913e..160893bd6a5c 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -275,6 +275,9 @@ config ARCH_THREAD_STACK_ALLOCATOR config

[POC 11/12] x86-64: implement _rai_bucket_shift

2018-10-17 Thread Rasmus Villemoes
or any other) and adjust the stack pointer. The patched code does need to do a shr, so I don't think there's a way around the cc clobber. Signed-off-by: Rasmus Villemoes --- arch/x86/include/asm/rai.S | 59 ++ arch/x86/include/asm/rai.h | 21

[POC 03/12] arch/Kconfig: add ARCH_HAS_RAI symbol

2018-10-17 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- arch/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 9d329608913e..160893bd6a5c 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -275,6 +275,9 @@ config ARCH_THREAD_STACK_ALLOCATOR config

[POC 12/12] fs/dcache.c: use rai_bucket_shift for dentry hashtable

2018-10-17 Thread Rasmus Villemoes
f8902e9b1 0x8902e906: mov%r12,%rax 0x8902e909: mov%r12d,%r10d 0x8902e90c: mov%rdx,%r15 The shr $0x12, %eax is consistent with [ 0.300676] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes) and nothing seems to explode. Signed-off-

[POC 10/12] hack: /proc/rai: add rai_bucket_shift use

2018-10-17 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- arch/x86/kernel/rai.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/rai.c b/arch/x86/kernel/rai.c index e55e85f11a2e..c4284ce7478f 100644 --- a/arch/x86/kernel/rai.c +++ b/arch/x86/kernel/rai.c @@ -63,11 +63,21

[POC 12/12] fs/dcache.c: use rai_bucket_shift for dentry hashtable

2018-10-17 Thread Rasmus Villemoes
f8902e9b1 0x8902e906: mov%r12,%rax 0x8902e909: mov%r12d,%r10d 0x8902e90c: mov%rdx,%r15 The shr $0x12, %eax is consistent with [ 0.300676] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes) and nothing seems to explode. Signed-off-

[POC 10/12] hack: /proc/rai: add rai_bucket_shift use

2018-10-17 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- arch/x86/kernel/rai.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/rai.c b/arch/x86/kernel/rai.c index e55e85f11a2e..c4284ce7478f 100644 --- a/arch/x86/kernel/rai.c +++ b/arch/x86/kernel/rai.c @@ -63,11 +63,21

[POC 06/12] ugly ugly hack

2018-10-17 Thread Rasmus Villemoes
Just to have a quick way of seeing that rai-patching works (i.e., once we implement rai_load, we'd not expect the output to change). Also, inside virtme we can do a quick "gdb vmlinux /proc/kcode" and disassemble rai_proc_show to see how the patched function looks. Signed-off-by: Rasmus

[POC 06/12] ugly ugly hack

2018-10-17 Thread Rasmus Villemoes
Just to have a quick way of seeing that rai-patching works (i.e., once we implement rai_load, we'd not expect the output to change). Also, inside virtme we can do a quick "gdb vmlinux /proc/kcode" and disassemble rai_proc_show to see how the patched function looks. Signed-off-by: Rasmus

[POC 02/12] init/main.c: call update_rai_access()

2018-10-17 Thread Rasmus Villemoes
, we will live with that wasted space. Signed-off-by: Rasmus Villemoes --- init/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init/main.c b/init/main.c index a664246450d1..39709ca33316 100644 --- a/init/main.c +++ b/init/main.c @@ -92,6 +92,7 @@ #include #include #include

[POC 02/12] init/main.c: call update_rai_access()

2018-10-17 Thread Rasmus Villemoes
, we will live with that wasted space. Signed-off-by: Rasmus Villemoes --- init/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init/main.c b/init/main.c index a664246450d1..39709ca33316 100644 --- a/init/main.c +++ b/init/main.c @@ -92,6 +92,7 @@ #include #include #include

Re: [PATCH v6 1/1] ns: add binfmt_misc to the user namespace

2018-10-16 Thread Rasmus Villemoes
On 2018-10-10 18:14, Laurent Vivier wrote: > + /* create a new binfmt namespace > + * if we are not in the first user namespace > + * but the binfmt namespace is the first one > + */ > + if (READ_ONCE(ns->binfmt_ns) == NULL) { > + struct binfmt_namespace

Re: [PATCH v6 1/1] ns: add binfmt_misc to the user namespace

2018-10-16 Thread Rasmus Villemoes
On 2018-10-10 18:14, Laurent Vivier wrote: > + /* create a new binfmt namespace > + * if we are not in the first user namespace > + * but the binfmt namespace is the first one > + */ > + if (READ_ONCE(ns->binfmt_ns) == NULL) { > + struct binfmt_namespace

Re: [RESEND PATCH v4 3/8] gpio: 104-dio-48e: Utilize for_each_set_clump macro

2018-10-15 Thread Rasmus Villemoes
On 2018-10-14 06:19, William Breathitt Gray wrote: > a bit value of 0 in the > bits array does not necessarily mean the input was not requested, but > may instead mean that the value at the input is 0; sure enough, but... > therefore, the caller > must keep track of the requested inputs rather

Re: [RESEND PATCH v4 3/8] gpio: 104-dio-48e: Utilize for_each_set_clump macro

2018-10-15 Thread Rasmus Villemoes
On 2018-10-14 06:19, William Breathitt Gray wrote: > a bit value of 0 in the > bits array does not necessarily mean the input was not requested, but > may instead mean that the value at the input is 0; sure enough, but... > therefore, the caller > must keep track of the requested inputs rather

Re: [PATCH 2/3] staging: greybus: loopback.c: do insertion in O(n) instead of O(n lg n)

2018-10-11 Thread Rasmus Villemoes
On 2018-10-11 01:03, Bryan O'Donoghue wrote: > On 05/10/2018 15:28, Rasmus Villemoes wrote: >> Signed-off-by: Rasmus Villemoes >> --- >> I have no idea if the performance matters (it probably doesn't). Feel >> free to ignore this and the followup cleanup. > > What

Re: [PATCH 2/3] staging: greybus: loopback.c: do insertion in O(n) instead of O(n lg n)

2018-10-11 Thread Rasmus Villemoes
On 2018-10-11 01:03, Bryan O'Donoghue wrote: > On 05/10/2018 15:28, Rasmus Villemoes wrote: >> Signed-off-by: Rasmus Villemoes >> --- >> I have no idea if the performance matters (it probably doesn't). Feel >> free to ignore this and the followup cleanup. > > What

[PATCH v2 02/23] linux/device.h: use unique identifier for each struct _ddebug

2018-10-09 Thread Rasmus Villemoes
-by: Greg Kroah-Hartman Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/device.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/device.h b/include/linux/device.h index 0d8ed2adfc73..81108db013e4 100644 --- a/include/linux/device.h +++ b

[PATCH v2 01/23] linux/device.h: use DYNAMIC_DEBUG_BRANCH in dev_dbg_ratelimited

2018-10-09 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- include/linux/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/device.h b/include/linux/device.h index 8f882549edee..0d8ed2adfc73 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1503,7 +1503,7 @@ do

[PATCH v2 02/23] linux/device.h: use unique identifier for each struct _ddebug

2018-10-09 Thread Rasmus Villemoes
-by: Greg Kroah-Hartman Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/device.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/device.h b/include/linux/device.h index 0d8ed2adfc73..81108db013e4 100644 --- a/include/linux/device.h +++ b

[PATCH v2 01/23] linux/device.h: use DYNAMIC_DEBUG_BRANCH in dev_dbg_ratelimited

2018-10-09 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- include/linux/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/device.h b/include/linux/device.h index 8f882549edee..0d8ed2adfc73 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1503,7 +1503,7 @@ do

[PATCH v2 07/23] dynamic_debug: consolidate DEFINE_DYNAMIC_DEBUG_METADATA definitions

2018-10-09 Thread Rasmus Villemoes
. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/dynamic_debug.h | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2fd8006153c3..0a643316597c 100644 --- a/include

[PATCH v2 07/23] dynamic_debug: consolidate DEFINE_DYNAMIC_DEBUG_METADATA definitions

2018-10-09 Thread Rasmus Villemoes
. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/dynamic_debug.h | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2fd8006153c3..0a643316597c 100644 --- a/include

[PATCH v2 09/23] dynamic_debug: use pointer comparison in ddebug_remove_module

2018-10-09 Thread Rasmus Villemoes
core.c (incidentally, there is an in-tree module whose name is core, but I just tested this with an out-of-tree trivial one). Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- lib/dynamic_debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib

[PATCH v2 09/23] dynamic_debug: use pointer comparison in ddebug_remove_module

2018-10-09 Thread Rasmus Villemoes
core.c (incidentally, there is an in-tree module whose name is core, but I just tested this with an out-of-tree trivial one). Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- lib/dynamic_debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib

[PATCH v2 06/23] linux/printk.h: use unique identifier for each struct _ddebug

2018-10-09 Thread Rasmus Villemoes
-by: Petr Mladek Acked-by: Jason Baron Cc: Steven Rostedt Signed-off-by: Rasmus Villemoes --- include/linux/printk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index d3ba3245531d..70df2c578d40 100644 --- a/include/linux

[PATCH v2 06/23] linux/printk.h: use unique identifier for each struct _ddebug

2018-10-09 Thread Rasmus Villemoes
-by: Petr Mladek Acked-by: Jason Baron Cc: Steven Rostedt Signed-off-by: Rasmus Villemoes --- include/linux/printk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index d3ba3245531d..70df2c578d40 100644 --- a/include/linux

[PATCH v2 10/23] dynamic_debug: remove unused EXPORT_SYMBOLs

2018-10-09 Thread Rasmus Villemoes
Baron Signed-off-by: Rasmus Villemoes --- lib/dynamic_debug.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index ab81155f928d..f1de45a100fa 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -868,7 +868,6 @@ int ddebug_add_module(struct

[PATCH v2 13/23] dynamic_debug: refactor dynamic_pr_debug and friends

2018-10-09 Thread Rasmus Villemoes
- though the hex_dump case requires a slight variant, since print_hex_dump does not take the _ddebug descriptor. We'll also get to use that variant elsewhere (btrfs). Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/dynamic_debug.h | 72 +-- 1 file

[PATCH v2 10/23] dynamic_debug: remove unused EXPORT_SYMBOLs

2018-10-09 Thread Rasmus Villemoes
Baron Signed-off-by: Rasmus Villemoes --- lib/dynamic_debug.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index ab81155f928d..f1de45a100fa 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -868,7 +868,6 @@ int ddebug_add_module(struct

[PATCH v2 13/23] dynamic_debug: refactor dynamic_pr_debug and friends

2018-10-09 Thread Rasmus Villemoes
- though the hex_dump case requires a slight variant, since print_hex_dump does not take the _ddebug descriptor. We'll also get to use that variant elsewhere (btrfs). Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/dynamic_debug.h | 72 +-- 1 file

[PATCH v2 14/23] btrfs: implement btrfs_debug* in terms of helper macro

2018-10-09 Thread Rasmus Villemoes
the new _dynamic_func_call_no_desc helper macro from dynamic_debug.h takes care of both of these. Cc: linux-bt...@vger.kernel.org Acked-by: David Sterba Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- fs/btrfs/ctree.h | 34 ++ 1 file changed, 10

<    3   4   5   6   7   8   9   10   11   12   >