[PATCH v3 16/23] ACPI: remove unused __acpi_handle_debug macro

2018-11-09 Thread Rasmus Villemoes
If CONFIG_DYNAMIC_DEBUG is not set, acpi_handle_debug directly invokes acpi_handle_printk (if DEBUG) or does a no-printk (if !DEBUG). So this macro is never used. Cc: linux-a...@vger.kernel.org Acked-by: Jason Baron Acked-by: Rafael J. Wysocki Signed-off-by: Rasmus Villemoes --- include/linux

[PATCH v3 08/23] dynamic_debug: don't duplicate modname in ddebug_add_module

2018-11-09 Thread Rasmus Villemoes
as long as the struct ddebug_table, since free_module() calls ddebug_remove_module(). Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- lib/dynamic_debug.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index c7

[PATCH v3 12/23] dynamic_debug: add static inline stub for ddebug_add_module

2018-11-09 Thread Rasmus Villemoes
For symmetry with ddebug_remove_module, and to avoid a bit of ifdeffery in module.c, move the declaration of ddebug_add_module inside #if defined(CONFIG_DYNAMIC_DEBUG) and add a corresponding no-op stub in the #else branch. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include

[PATCH v3 23/23] x86_64: use relative pointers with dynamic debug

2018-11-09 Thread Rasmus Villemoes
ifier. To prevent such a problem from going unnoticed, we use a guard symbol in assembly whose value is unique per DEFINE_DYNAMIC_DEBUG_METADATA invocation. Cc: x...@kernel.org Cc: Ingo Molnar Cc: Jason Baron Signed-off-by: Rasmus Villemoes --- arch/x86/Kconfig | 1 + arc

[PATCH v3 22/23] x86: jump_label: introduce asm macros STATIC_KEY_INIT{,_TRUE,_FALSE}

2018-11-09 Thread Rasmus Villemoes
These will be useful when defining the contents of (a struct containing) a static key in assembly. Cc: x...@kernel.org Cc: Ingo Molnar Cc: Jason Baron Signed-off-by: Rasmus Villemoes --- arch/x86/include/asm/jump_label.h | 17 + 1 file changed, 17 insertions(+) diff --git a

[PATCH v3 20/23] dynamic_debug: introduce CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS

2018-11-09 Thread Rasmus Villemoes
suitable DEFINE_DYNAMIC_DEBUG_METADATA macro in . Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/dynamic_debug.h | 14 ++ lib/Kconfig.debug | 3 +++ lib/dynamic_debug.c | 20 3 files changed, 37 insertions(+) diff

[PATCH v3 18/23] dynamic_debug: introduce accessors for string members of struct _ddebug

2018-11-09 Thread Rasmus Villemoes
When we introduce compact versions of these pointers (a la CONFIG_GENERIC_BUG_RELATIVE_POINTERS), all access to these members must go via appropriate accessors. This just mass-converts dynamic_debug.c to use the new accessors. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- lib

[PATCH v3 21/23] jump_label: move JUMP_TYPE_* constants to new asm-generic file

2018-11-09 Thread Rasmus Villemoes
I'm going to need to refer to the JUMP_TYPE_FALSE and JUMP_TYPE_TRUE constants from asm code. In order to do that, move them to an asm-generic header and define them using the UL() helper macro. Cc: Ingo Molnar Cc: Jason Baron Signed-off-by: Rasmus Villemoes --- include/asm-ge

[PATCH v3 17/23] ACPI: implement acpi_handle_debug in terms of _dynamic_func_call

2018-11-09 Thread Rasmus Villemoes
With coming changes on x86-64, all dynamic debug descriptors in a translation unit must have distinct names. The macro _dynamic_func_call takes care of that. No functional change. Cc: linux-a...@vger.kernel.org Acked-by: Rafael J. Wysocki Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes

[PATCH v3 19/23] dynamic_debug: drop use of bitfields in struct _ddebug

2018-11-09 Thread Rasmus Villemoes
four byte hole after these fields, so we could just give flags and lineno each their own u32. But I don't think that's worth the ifdeffery. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/dynamic_debug.h | 12 -- lib/dynamic_debug.c

[PATCH v3 11/23] dynamic_debug: move pr_err from module.c to ddebug_add_module

2018-11-09 Thread Rasmus Villemoes
]. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- kernel/module.c | 4 +--- lib/dynamic_debug.c | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 49a405891587..80ede55db25a 100644 --- a/kernel/module.c +++ b/kernel

[PATCH v3 15/23] ACPI: use proper DYNAMIC_DEBUG_BRANCH macro

2018-11-09 Thread Rasmus Villemoes
dynamic debug may be implemented via static keys, but ACPI is missing out on that runtime benefit since it open-codes one possible definition of DYNAMIC_DEBUG_BRANCH. Cc: linux-a...@vger.kernel.org Acked-by: Jason Baron Acked-by: Rafael J. Wysocki Signed-off-by: Rasmus Villemoes --- include

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

2018-11-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 v3 07/23] dynamic_debug: consolidate DEFINE_DYNAMIC_DEBUG_METADATA definitions

2018-11-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 v3 13/23] dynamic_debug: refactor dynamic_pr_debug and friends

2018-11-09 Thread Rasmus Villemoes
_func_call - 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 +---

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

2018-11-09 Thread Rasmus Villemoes
: 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 061cd83ac64c..6e0909db6dda 100644 --- a/include/linux/device.h +++ b

[PATCH v3 00/23] various dynamic_debug patches

2018-11-09 Thread Rasmus Villemoes
thout at least one arch opting in to use DYNAMIC_DEBUG_RELATIVE_POINTERS). Rasmus Villemoes (23): linux/device.h: use DYNAMIC_DEBUG_BRANCH in dev_dbg_ratelimited linux/device.h: use unique identifier for each struct _ddebug linux/net.h: use DYNAMIC_DEBUG_BRANCH in net_dbg_ratelimited linux/net.h: use u

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

2018-11-09 Thread Rasmus Villemoes
Baron 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 1b25c7a43f4c..061cd83ac64c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1538,7 +1538,7

[PATCH v3 05/23] linux/printk.h: use DYNAMIC_DEBUG_BRANCH in pr_debug_ratelimited

2018-11-09 Thread Rasmus Villemoes
teven Rostedt Signed-off-by: Rasmus Villemoes --- include/linux/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index cf3eccfe1543..d3ba3245531d 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -466,7 +

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

2018-11-09 Thread Rasmus Villemoes
: 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] perf: disable parallelism for 'make clean'

2018-07-05 Thread Rasmus Villemoes
pens in combination with a O=... parameter. In any case, we don't lose much by explicitly disabling the parallelism for the clean target, and it makes automated builds much more reliable. Signed-off-by: Rasmus Villemoes --- Another option is to add -ignore_readdir_race to all find commands, b

Re: [PATCH] perf: disable parallelism for 'make clean'

2018-08-15 Thread Rasmus Villemoes
On 2018-07-05 15:49, Jiri Olsa wrote: > On Thu, Jul 05, 2018 at 03:15:27PM +0200, Rasmus Villemoes wrote: >> this only happens in combination with a O=... parameter. In any case, we >> don't lose much by explicitly disabling the parallelism for the clean >> target, and

[PATCH] linux/bitmap.h: (buildbot-only) check if we have any compile-time zero-size bitmaps

2018-08-15 Thread Rasmus Villemoes
bitmap should turn up. Not-really-signed-off-by: Rasmus Villemoes --- include/linux/bitmap.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 1ee46f492267..a5879cb45687 100644 --- a/include/linux/bitmap.h +++ b/include/l

[PATCH 0/3] Kbuild: Some fixdep tweaks

2018-08-15 Thread Rasmus Villemoes
These patches eliminate two (albeit tiny and shortlived) processes from the cmd_and_fixdep rule, i.e. from every TU being compiled. Whether the diffstat below is worth it I'll leave to Kbuild maintainers to decide. Rasmus Villemoes (3): Kbuild: refactor fixdep to use getopt() Kbuild:

[PATCH 2/3] Kbuild: teach fixdep to optionally remove the depfile

2018-08-15 Thread Rasmus Villemoes
behaviour of keeping the depfile if fixdep exits prematurely. Signed-off-by: Rasmus Villemoes --- scripts/Kbuild.include | 7 +++ scripts/basic/fixdep.c | 10 -- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d

[PATCH 3/3] Kbuild: let fixdep do the renaming to .cmd

2018-08-15 Thread Rasmus Villemoes
Avoid spawning one more process per TU by having fixdep open the tmpfile and rename to its final name. The only change in behaviour is that if fixdep fails, the tmpfile we leave behind is $(dot-target).cmd.tmp rather than $(dot-target).tmp . Signed-off-by: Rasmus Villemoes --- scripts

[PATCH 1/3] Kbuild: refactor fixdep to use getopt()

2018-08-15 Thread Rasmus Villemoes
As preparation for teaching an old dog a few new tricks. Signed-off-by: Rasmus Villemoes --- scripts/basic/fixdep.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 850966f3d602..666041841200 100644

[PATCH] ia64/sn/hwperf: check seq_open return value to avoid NULL deref

2018-08-16 Thread Rasmus Villemoes
This code should check the return value of seq_open(); if it failed, file->private_data is NULL. But in that case we then need to dispose of objbuf to prevent a resource leak. Signed-off-by: Rasmus Villemoes --- arch/ia64/sn/kernel/sn2/sn_hwperf.c | 8 ++-- 1 file changed, 6 inserti

Re: [PATCH] linux/bitmap.h: (buildbot-only) check if we have any compile-time zero-size bitmaps

2018-08-17 Thread Rasmus Villemoes
On 2018-08-17 01:21, Yury Norov wrote: > Hi Rasmus, > > On Wed, Aug 15, 2018 at 10:55:39AM +0200, Rasmus Villemoes wrote: >> Most of the inline bitmap functions are buggy if passed a compile-time >> constant nbits==0. > > I think it's bad wording. Functions are O

[PATCH] linux/compiler.h: don't use bool

2018-08-17 Thread Rasmus Villemoes
7;bool'; did you >> mean '_Bool'? bool __cond = !(condition);\ for something I'm working on. Rather than contributing to the #include madness and including linux/types.h from compiler.h, just use int. Signed-off-by: Rasmus Villemoes --- include/linux/compiler.h

[PATCH 0/7] assorted minor bitmap patches

2018-08-18 Thread Rasmus Villemoes
A recent LKML thread had me look into bitmap.{h,c} again, and I stumbled on/rediscovered a few things. Rasmus Villemoes (7): lib/bitmap.c: remove wrong documentation linux/bitmap.h: handle constant zero-size bitmaps correctly linux/bitmap.h: remove redundant uses of small_const_nbits

[PATCH 1/7] lib/bitmap.c: remove wrong documentation

2018-08-18 Thread Rasmus Villemoes
This promise is violated in a number of places, e.g. already in the second function below this paragraph. Since I don't think anybody relies on this being true, and since actually honouring it would hurt performance and code size in various places, just remove the paragraph. Signed-off-by: R

[PATCH 7/7] lib/bitmap.c: simplify bitmap_print_to_pagebuf

2018-08-18 Thread Rasmus Villemoes
0' to that final byte in the page, but that's an improvement: We now guarantee that after the call, buf is a properly terminated C string of length exactly the return value. Signed-off-by: Rasmus Villemoes --- lib/bitmap.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff

[PATCH 6/7] lib/bitmap.c: fix remaining space computation in bitmap_print_to_pagebuf

2018-08-18 Thread Rasmus Villemoes
huge, scnprintf() ends up writing beyond the page boundary. I don't think any current callers actually write anything before bitmap_print_to_pagebuf, but the API seems to be designed to allow it. Signed-off-by: Rasmus Villemoes --- lib/bitmap.c | 9 + 1 file changed, 5 insertions(

[PATCH 5/7] linux/bitmap.h: relax comment on compile-time constant nbits

2018-08-18 Thread Rasmus Villemoes
It's not clear what's so horrible about emitting a function call to handle a run-time sized bitmap. Moreover, gcc also emits a function call for a compile-time-constant-but-huge nbits, so the comment isn't even accurate. Signed-off-by: Rasmus Villemoes --- include/linux/bitma

[PATCH 3/7] linux/bitmap.h: remove redundant uses of small_const_nbits()

2018-08-18 Thread Rasmus Villemoes
0020 : 20: 48 8b 06mov(%rsi),%rax 23: 48 89 07mov%rax,(%rdi) 26: c3 retq Signed-off-by: Rasmus Villemoes --- include/linux/bitmap.h | 24 ++-- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git

[PATCH 4/7] linux/bitmap.h: fix type of nbits in bitmap_shift_right()

2018-08-18 Thread Rasmus Villemoes
Most other bitmap API, including the OOL version __bitmap_shift_right, take unsigned nbits. This was accidentally left out from 2fbad29917c98. Fixes: 2fbad29917c98 (lib: bitmap: change bitmap_shift_right to take unsigned parameters) Reported-by: Yury Norov Signed-off-by: Rasmus Villemoes

[PATCH 2/7] linux/bitmap.h: handle constant zero-size bitmaps correctly

2018-08-18 Thread Rasmus Villemoes
n teaching all the static inlines an "if (zero_const_nbits())", and since we don't have any current instances, this doesn't affect existing code at all. [1] lkml.kernel.org/r/20180815085539.27485-1-li...@rasmusvillemoes.dk Signed-off-by: Rasmus Villemoes --- include/linu

[PATCH v2 5/8] nfsd: use seq_open_data() in exports_net_open()

2018-08-18 Thread Rasmus Villemoes
Using the seq_open_data() helper, exports_net_open() essentially becomes a oneliner. Signed-off-by: Rasmus Villemoes --- Depends on 1/8 introducing seq_open_data. fs/nfsd/nfsctl.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c

[PATCH v2 8/8] PCI: tegra: use seq_open_data

2018-08-18 Thread Rasmus Villemoes
Simplify the code slightly by having seq_open_data do the ->private assignment. Signed-off-by: Rasmus Villemoes --- Depends on 1/8 introducing seq_open_data. Not including Thierry's ack/reviewed-by since it's been half a year since v1. drivers/pci/controller/pci-tegra.c | 11 +

[PATCH v2 4/8] proc: use seq_open_data() in proc_id_map_open()

2018-08-18 Thread Rasmus Villemoes
Simplify the code slightly by using the seq_open_data helper. Signed-off-by: Rasmus Villemoes --- Depends on 1/8 introducing seq_open_data. fs/proc/base.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index aaffc0c30216

[PATCH v2 3/8] seq_file: use seq_open_data in __seq_open_private

2018-08-18 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- fs/seq_file.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/seq_file.c b/fs/seq_file.c index 518a72e444d9..5cc4670294e7 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -632,18 +632,15 @@ void *__seq_open_private(struct file *f

[PATCH v2 2/8] seq_file: use seq_open_data in single_open

2018-08-18 Thread Rasmus Villemoes
Avoid the somewhat hard to grok assignment by using the seq_open_data helper. Signed-off-by: Rasmus Villemoes --- fs/seq_file.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/seq_file.c b/fs/seq_file.c index c8c86660f6db..518a72e444d9 100644 --- a/fs/seq_file.c

[RFC PATCH] scripts: add header bloat measuring script

2018-08-18 Thread Rasmus Villemoes
s those). On a positive note, maybe 4.19 will be a rare exception; as of 1f7a4c73a739, the median bloat factor is down to 236.0, the average .c file has increased by 0.4% but the average total translation unit is nevertheless 1.2% smaller, compared to v4.18. Signed-off-by: Rasmus Villemoes --- For some s

Re: [PATCH 6/7] lib/bitmap.c: fix remaining space computation in bitmap_print_to_pagebuf

2018-08-20 Thread Rasmus Villemoes
On 2018-08-19 14:37, Andy Shevchenko wrote: > On Sat, Aug 18, 2018 at 4:17 PM Rasmus Villemoes > wrote: >> >> int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long >> *maskp, >> int nmaskbits) >> { >> -

Re: linux-next: build failure after merge of the nfs-anna tree

2018-12-17 Thread Rasmus Villemoes
On 17/12/2018 00.16, Stephen Rothwell wrote: > Hi all, > > After merging the nfs-anna tree, today's linux-next build (arm > multi_v7_defconfig) failed like this: > > /home/sfr/next/next/fs/nfs/nfsroot.c: In function 'root_nfs_data': > /home/sfr/next/next/fs/nfs/nfsroot.c:264:5: error: implicit de

Re: [for-next][PATCH 23/24] string.h: Add strncmp_prefix() helper macro

2018-12-23 Thread Rasmus Villemoes
On 21/12/2018 23.20, Joe Perches wrote: > On Fri, 2018-12-21 at 16:08 -0500, Steven Rostedt wrote: >> On Fri, 21 Dec 2018 21:58:32 +0100 >> Andreas Schwab wrote: >> >> Well, perhaps I can just remove the ending ones. I get paranoid with macro variables, and tend to over do it so that the

Re: [for-next][PATCH 23/24] string.h: Add strncmp_prefix() helper macro

2018-12-23 Thread Rasmus Villemoes
On 23/12/2018 23.56, Steven Rostedt wrote: > On Sun, 23 Dec 2018 23:01:52 +0100 > Rasmus Villemoes wrote: > >> On 21/12/2018 23.20, Joe Perches wrote: >>> >>> Using >>> >>> static inline bool str_has_prefix(const char *str, const char prefix[]

[PATCH v2 05/23] linux/printk.h: use DYNAMIC_DEBUG_BRANCH in pr_debug_ratelimited

2018-10-09 Thread Rasmus Villemoes
teven Rostedt Signed-off-by: Rasmus Villemoes --- include/linux/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index cf3eccfe1543..d3ba3245531d 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -466,7 +

[PATCH v2 08/23] dynamic_debug: don't duplicate modname in ddebug_add_module

2018-10-09 Thread Rasmus Villemoes
as long as the struct ddebug_table, since free_module() calls ddebug_remove_module(). Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- lib/dynamic_debug.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index c7

[PATCH v2 12/23] dynamic_debug: add static inline stub for ddebug_add_module

2018-10-09 Thread Rasmus Villemoes
For symmetry with ddebug_remove_module, and to avoid a bit of ifdeffery in module.c, move the declaration of ddebug_add_module inside #if defined(CONFIG_DYNAMIC_DEBUG) and add a corresponding no-op stub in the #else branch. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include

[PATCH v2 11/23] dynamic_debug: move pr_err from module.c to ddebug_add_module

2018-10-09 Thread Rasmus Villemoes
]. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- kernel/module.c | 4 +--- lib/dynamic_debug.c | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 6746c85511fe..381f9bf282fe 100644 --- a/kernel/module.c +++ b/kernel

[PATCH v2 00/23] various dynamic_debug patches

2018-10-09 Thread Rasmus Villemoes
nder virtme and that the dynamic_debug control file has the expected contents. Rasmus Villemoes (23): linux/device.h: use DYNAMIC_DEBUG_BRANCH in dev_dbg_ratelimited linux/device.h: use unique identifier for each struct _ddebug linux/net.h: use DYNAMIC_DEBUG_BRANCH in net_dbg_ratelimite

[PATCH v2 17/23] ACPI: implement acpi_handle_debug in terms of _dynamic_func_call

2018-10-09 Thread Rasmus Villemoes
With coming changes on x86-64, all dynamic debug descriptors in a translation unit must have distinct names. The macro _dynamic_func_call takes care of that. No functional change. Cc: linux-a...@vger.kernel.org Acked-by: Rafael J. Wysocki Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes

[PATCH v2 23/23] x86: dynamic_debug: protect against dynamic debug identifier reuse

2018-10-09 Thread Rasmus Villemoes
descriptor, "bla") - even with a helpful error message saying that '"descriptor" used as _ddebug identifer more than once'. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- arch/x86/include/asm/dynamic_debug.h | 7 ++- 1 file changed, 6 insertions(+), 1 de

[PATCH v2 18/23] dynamic_debug: introduce accessors for string members of struct _ddebug

2018-10-09 Thread Rasmus Villemoes
When we introduce compact versions of these pointers (a la CONFIG_GENERIC_BUG_RELATIVE_POINTERS), all access to these members must go via appropriate accessors. This just mass-converts dynamic_debug.c to use the new accessors. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- lib

[PATCH v2 22/23] x86_64: use relative pointers with dynamic debug

2018-10-09 Thread Rasmus Villemoes
same descriptor object is the right thing to do; that is also what happens when it is the compiler that defines a static object inside an inline(d) function. Cc: x...@kernel.org Reviewed-by: Ingo Molnar Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- arch/x86/Kconfig

[PATCH v2 21/23] x86: jump_label: introduce ASM_STATIC_KEY_INIT_{TRUE,FALSE}

2018-10-09 Thread Rasmus Villemoes
These will be useful when defining the contents of (a struct containing) a static key in inline assembly. Cc: x...@kernel.org Reviewed-by: Ingo Molnar Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- arch/x86/include/asm/jump_label.h | 18 ++ include/linux

[PATCH v2 20/23] dynamic_debug: introduce CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS

2018-10-09 Thread Rasmus Villemoes
suitable DEFINE_DYNAMIC_DEBUG_METADATA macro in . Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/dynamic_debug.h | 14 ++ lib/Kconfig.debug | 3 +++ lib/dynamic_debug.c | 20 3 files changed, 37 insertions(+) diff

[PATCH v2 19/23] dynamic_debug: drop use of bitfields in struct _ddebug

2018-10-09 Thread Rasmus Villemoes
four byte hole after these fields, so we could just give flags and lineno each their own u32. But I don't think that's worth the ifdeffery. Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/dynamic_debug.h | 12 -- lib/dynamic_debug.c

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

2018-10-09 Thread Rasmus Villemoes
Using 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 change

[PATCH v2 16/23] ACPI: remove unused __acpi_handle_debug macro

2018-10-09 Thread Rasmus Villemoes
If CONFIG_DYNAMIC_DEBUG is not set, acpi_handle_debug directly invokes acpi_handle_printk (if DEBUG) or does a no-printk (if !DEBUG). So this macro is never used. Cc: linux-a...@vger.kernel.org Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/acpi.h | 3 --- 1 file

[PATCH v2 15/23] ACPI: use proper DYNAMIC_DEBUG_BRANCH macro

2018-10-09 Thread Rasmus Villemoes
dynamic debug may be implemented via static keys, but ACPI is missing out on that runtime benefit since it open-codes one possible definition of DYNAMIC_DEBUG_BRANCH. Cc: linux-a...@vger.kernel.org Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- include/linux/acpi.h | 2 +- 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
_func_call - 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 +---

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

2018-10-09 Thread Rasmus Villemoes
: 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 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 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 02/23] linux/device.h: use unique identifier for each struct _ddebug

2018-10-09 Thread Rasmus Villemoes
: 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
Baron 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

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 at l

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

2018-10-29 Thread Rasmus Villemoes
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 insertion

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

2018-10-29 Thread Rasmus Villemoes
the declaration 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/tra

[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

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 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 *new_ns;

[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 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: R

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

2018-10-17 Thread Rasmus Villemoes
8902e9b1 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 11/12] x86-64: implement _rai_bucket_shift

2018-10-17 Thread Rasmus Villemoes
%rcx 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

[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 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 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 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 07/12] x86-64: rai: implement _rai_load

2018-10-17 Thread Rasmus Villemoes
eated "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 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 01/12] Accessing __ro_after_init variables as immediates

2018-10-17 Thread Rasmus Villemoes
riable sufficiently rarely that it's no longer in L1, that extra 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/l

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. >

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 t

[PATCH 1/3] staging: greybus: loopback.c: remove unused gb_loopback::lbid

2018-10-05 Thread Rasmus Villemoes
, and the lbid field is entirely unused outside of this function, so it seems we can just drop it entirely. Signed-off-by: Rasmus Villemoes --- Since lbid isn't mentioned anywhere else in greybus/, it's hard to figure out how it was meant to be used. It does seem like entirely dead (wri

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

2018-10-05 Thread Rasmus Villemoes
"Append to the list and do a merge sort" is not really an insertion sort. While a few more lines of code, we can keep the list sorted doing at most n comparisons by iterating until we find the first element strictly greater than gb. Signed-off-by: Rasmus Villemoes --- I have no i

[PATCH 3/3] staging: greybus: loopback.c: simplify prototype of gb_loopback_bus_id_compare

2018-10-05 Thread Rasmus Villemoes
gb_loopback_bus_id_compare only has a single caller, and it no longer needs to have a prototype compatible with being a callback for list_sort. Signed-off-by: Rasmus Villemoes --- drivers/staging/greybus/loopback.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a

Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions

2018-10-05 Thread Rasmus Villemoes
On 2018-10-04 21:33, H. Peter Anvin wrote: > Here is the horrible code I mentioned yesterday. This is about > implementing the immediate-patching framework that Linus and others have > discussed (it helps both performance and kernel hardening): Heh, I did a POC in userspace some years ago for lo

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

[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 del

[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 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

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 >> +:

<    1   2   3   4   5   6   7   8   9   10   >