Re: [PATCH v16] sys_membarrier(): system-wide memory barrier (generic, x86)

2015-04-23 Thread Rasmus Villemoes
On Fri, Apr 17 2015, Mathieu Desnoyers wrote: > + */ > +SYSCALL_DEFINE2(membarrier, int, cmd, int, flags) > +{ > + switch (cmd) { > + case MEMBARRIER_CMD_QUERY: > + return MEMBARRIER_CMD_BITMASK; > + case MEMBARRIER_CMD_SHARED: > + if (num_online_cpus() > 1) >

Re: [PATCH] x86_64: use -mskip-rax-setup when available

2015-04-23 Thread Rasmus Villemoes
On Mon, Apr 20 2015, Borislav Petkov wrote: > On Mon, Apr 20, 2015 at 10:24:44PM +0200, Rasmus Villemoes wrote: >> Hadn't seen that, so I wrongly assumed everybody had forgotten about >> it. I don't care about the S-o-b on the trivial Makefile patch, but my >> req

Re: [PATCH] x86_64: use -mskip-rax-setup when available

2015-04-23 Thread Rasmus Villemoes
On Thu, Apr 23 2015, Borislav Petkov wrote: > On Thu, Apr 23, 2015 at 01:00:26PM +0200, Rasmus Villemoes wrote: >> > or you want attribution or ...? >> >> That would be nice. > > I fail to see for what - I see H.J. Lu's patch from Dec. 2014 and you > rep

Re: [PATCH 2/2] lib/lcm.c: lcm(n,0)=lcm(0,n) is 0, not n

2015-03-30 Thread Rasmus Villemoes
On Sun, Mar 29 2015, Mike Snitzer wrote: > On Tue, Dec 9, 2014 at 4:03 PM, Rasmus Villemoes > wrote: >> Return the mathematically correct answer when an argument is 0. >> >> Signed-off-by: Rasmus Villemoes > > This change is the source of 3.19 regression for

[PATCH] mm/mmap.c: use while instead of if+goto

2015-03-30 Thread Rasmus Villemoes
The creators of the C language gave us the while keyword. Let's use that instead of synthesizing it from if+goto. Made possible by 6597d783397a ("mm/mmap.c: replace find_vma_prepare() with clearer find_vma_links()"). Signed-off-by: Rasmus Villemoes --- mm/mmap.c | 8 ++-- 1

[PATCH] linux/cpumask.h: add typechecking to cpumask_test_cpu

2015-03-30 Thread Rasmus Villemoes
nline, so let's add type checking and get rid of the ghost reference. Signed-off-by: Rasmus Villemoes --- include/linux/cpumask.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 086549a665e2..972c30e0714e

Re: [PATCH] mm/mmap.c: use while instead of if+goto

2015-03-31 Thread Rasmus Villemoes
On Mon, Mar 30 2015, Andrew Morton wrote: > On Mon, 30 Mar 2015 23:54:13 +0300 "Kirill A. Shutemov" > wrote: > >> On Mon, Mar 30, 2015 at 09:40:35PM +0200, Rasmus Villemoes wrote: >> > The creators of the C language gave us the while keyword. Let's use &g

[PATCH 3/3] tty: remove buf parameter from tty_name()

2015-03-31 Thread Rasmus Villemoes
tty) ...+> allmodconfig compiles, so I'm fairly confident the stack buffers weren't used for other purposes as well. Signed-off-by: Rasmus Villemoes --- drivers/input/serio/serport.c| 5 ++--- drivers/tty/amiserial.c | 8 ++-- drivers/tty/cyclades.c | 8 +

[PATCH 1/3] tty: constify return type of tty_name

2015-03-31 Thread Rasmus Villemoes
r*. While at it, we can also constify the tty parameter. Signed-off-by: Rasmus Villemoes --- drivers/tty/tty_io.c | 2 +- include/linux/tty.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 2bb4dfc02873..5d4a9fd7510a 100644

[PATCH 0/3] tty: eliminate 64 byte stack buffers passed to tty_name

2015-03-31 Thread Rasmus Villemoes
All users of tty_name pass the return value directly to a printf function, so we might as well use tty->name directly instead of copying it to a user-supplied (stack) buffer. allmodconfig compile-tested only. Rasmus Villemoes (3): tty: constify return type of tty_name tty: return tty-&g

[PATCH 2/3] tty: return tty->name directly from tty_name

2015-03-31 Thread Rasmus Villemoes
All users of tty_name pass the return value (the provided buffer) to some printf-like function. We can thus avoid the strcpy and, more importantly, later remove the buf parameter completely, eliminating the need for some 64 byte stack buffers. Signed-off-by: Rasmus Villemoes --- drivers/tty

[PATCH] caif: remove unused struct member

2015-03-31 Thread Rasmus Villemoes
The tty_name member of struct ser_device is never set or used, so it can be removed. (The definition of struct ser_device is private to this .c file, and the identifier tty_name only occurs in this one place.) Signed-off-by: Rasmus Villemoes --- drivers/net/caif/caif_serial.c | 1 - 1 file

Re: [PATCH 2/2] mm: __free_pages batch up 0-order pages for freeing

2015-04-01 Thread Rasmus Villemoes
On Wed, Apr 01 2015, Sasha Levin wrote: > Rather than calling free_hot_cold_page() for every page, batch them up in a > list and pass them on to free_hot_cold_page_list(). This will let us defer > them to a workqueue. > > Signed-off-by: Sasha Levin > --- > mm/page_alloc.c |6 +- > 1 fil

Re: [RFC v3 04/45] vfs: Shrink struct posix_acl

2015-04-25 Thread Rasmus Villemoes
On Fri, Apr 24 2015, Andreas Gruenbacher wrote: > There is a hole in struct posix_acl because its struct rcu_head member is too > large; at least on on 64-bit architectures, the hole cannot be closed by > changing the definition of struct posix_acl. So instead, remove the struct > rcu_head member

Re: [PATCH] lib/sort: Add 64 bit swap function

2015-04-27 Thread Rasmus Villemoes
On Mon, Apr 27 2015, Daniel Wagner wrote: > static int cmp_32(const void *a, const void *b) > { > return (int) (*(u32 *)a - *(u32 *)b); > } > > static int cmp_64(const void *a, const void *b) > { > return (int) (*(u64 *)a - *(u64 *)b); > } > Please [1] don't [2] do [3] this [4]. [1]

[PATCH] x86_64: use -mskip-rax-setup when available

2015-04-20 Thread Rasmus Villemoes
defconfig kernel, the .text saving is around 26 kB: $ size /tmp/vmlinux.{old,new} textdata bss dec hex filename 122218501735352 1077248 15034450 e56852 /tmp/vmlinux.old 121959551735352 1077248 15008555 e5032b /tmp/vmlinux.new Signed-off-by: Rasmus

Re: [PATCH] x86_64: use -mskip-rax-setup when available

2015-04-20 Thread Rasmus Villemoes
On Mon, Apr 20 2015, Borislav Petkov wrote: > On Mon, Apr 20, 2015 at 02:28:16PM +0200, Rasmus Villemoes wrote: >> >> Nothing seems to have happened on the kernel side since H.J. Lu >> implemented this in December. Since gcc 5 is officially released > > I see the s

[PATCH v3 1/2] cxl: Add explicit precision specifiers

2015-06-11 Thread Rasmus Villemoes
ed. Even if the kernel followed C99 to the letter, I don't think that would be particularly useful in these cases. For consistency with most other format strings in the file, use an explicit precision of 16 and add a 0x prefix. Signed-off-by: Rasmus Villemoes --- v3: same as v2, just re

Re: [PATCH] kbuild: include core debug info when DEBUG_INFO_REDUCED

2015-06-11 Thread Rasmus Villemoes
On Sat, Mar 21 2015, Rasmus Villemoes wrote: > With CONFIG_DEBUG_INFO_REDUCED, we do get quite a lot of debug info > (around 22.7 MB for a defconfig+DEBUG_INFO_REDUCED). However, the > "basenames must match" rule used by -femit-struct-debug-baseonly > option means that

[PATCH 1/2] futex: eliminate cache miss from futex_hash()

2015-06-22 Thread Rasmus Villemoes
nopl (%rax) Signed-off-by: Rasmus Villemoes --- If this is worth applying, one could consider giving dentry_hashtable, inode_hashtable and their friends the same treatment. The variables are all __read_mostly, but may still end up in separate cache lines (even if the linker places them

[not-a-PATCH 2/2] futex: eliminate instruction from hash_futex

2015-06-22 Thread Rasmus Villemoes
05 84 61 e4 00add0xe46184(%rip),%rax# 81eff9f0 <__futex_data> +: 48 03 05 8c 61 e4 00add0xe4618c(%rip),%rax# 81eff9f0 <__futex_data> : c3 retq Not-signed-off-by: Rasmus Villemoes --- kernel/futex.c | 11 ++-

Re: [PATCH 1/2] futex: eliminate cache miss from futex_hash()

2015-06-22 Thread Rasmus Villemoes
On Mon, Jun 22 2015, Peter Zijlstra wrote: > On Mon, Jun 22, 2015 at 03:16:18PM +0200, Rasmus Villemoes wrote: >> +static struct { >> +struct futex_hash_bucket *queues; >> +unsigned longhashsize; >> +} __futex_data __read_mostly __aligned(16);

Re: [RFC 1/4] scripts: add stackusage script

2015-06-25 Thread Rasmus Villemoes
On Tue, Jun 23 2015, Michal Marek wrote: > > EXTRA_CFLAGS is reserved for use by Makefiles, please use KCFLAGS > instead. Will do, thanks. Maybe Documentation/SubmitChecklist and Documentation/development-process/4.Coding wants to be updated. > I wonder whether it worked at all, because EXTRA_C

[RFC v2 2/4] .gitignore: add *.su pattern

2015-06-25 Thread Rasmus Villemoes
Ignore the *.su files generated by using the gcc option -fstack-usage. Signed-off-by: Rasmus Villemoes --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4ad4a98b884b..9e51ead66a55 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7

[RFC v2 1/4] scripts: add stackusage script

2015-06-25 Thread Rasmus Villemoes
5.0 doesn't have this problem; it uses the full name as seen in the object file. [1] Since gcc encodes that by 48 83 c4 80 add$0xff80,%rsp and not 48 81 ec 80 00 00 00 sub $0x80,%rsp since -128 fits in an imm8. Signed-off-by: Rasmus Villemoes --- scri

[RFC v2 3/4] kbuild: remove *.su files generated by -fstack-usage

2015-06-25 Thread Rasmus Villemoes
Make sure 'make clean' removes *.su files generated by the gcc option -fstack-usage. Signed-off-by: Rasmus Villemoes --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 6c6f14628f32..81f1d74848cc 100644 --- a/Makefile +++ b/Makefile @@ -1429

[RFC v2 4/4] scripts: add stackdelta script

2015-06-25 Thread Rasmus Villemoes
,new}.su | sort -k5,5g shows that gcc 5.0 generally produces less stack-hungry code than gcc 4.7. Obviously, the script can also be used for measuring the effect of commits, .config tweaks or whatnot. Signed-off-by: Rasmus Villemoes --- scripts/stackdelta | 59

[PATCH v2 5/8] drivers/base/core.c: Use strreplace

2015-06-08 Thread Rasmus Villemoes
This eliminates a little .text and avoids repeating the strchr call when we meet a '!' (which will happen at least once). Signed-off-by: Rasmus Villemoes --- v2: Avoid ugly (char *) cast. drivers/base/core.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git

[PATCH v2 2/8] kernel/trace/trace_events_filter.c: Use strreplace

2015-06-08 Thread Rasmus Villemoes
There's no point in starting over every time we see a ','... Signed-off-by: Rasmus Villemoes Acked-by: Steven Rostedt --- v2: same patch, added Ack. kernel/trace/trace_events_filter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_

[PATCH v2 6/8] drivers/md/md.c: Use strreplace

2015-06-08 Thread Rasmus Villemoes
There's no point in starting over when we meet a '/'. This also eliminates a stack variable and a little .text. Signed-off-by: Rasmus Villemoes --- v2: no changes. drivers/md/md.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/md/md.c b/driver

[PATCH v2 7/8] fs/jbd2/journal.c: Use strreplace

2015-06-08 Thread Rasmus Villemoes
In one case, we eliminate a local variable; in the other a strlen() call and some .text. Signed-off-by: Rasmus Villemoes --- v2: no changes. fs/jbd2/journal.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index b96bd8076b70

[PATCH v2 8/8] fs/ext4/super.c: Use strreplace in ext4_fill_super

2015-06-08 Thread Rasmus Villemoes
This makes a very large function a little smaller. Signed-off-by: Rasmus Villemoes --- v2: no changes. fs/ext4/super.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ca9d4a2fed41..5f3c43a66937 100644 --- a/fs/ext4/super.c +++ b/fs

[PATCH v2 4/8] lib/kobject.c: Use strreplace

2015-06-08 Thread Rasmus Villemoes
There's probably not many slashes in the name, but starting over when we see one feels wrong. Signed-off-by: Rasmus Villemoes --- v2: Original code relied on the const laundering done by strchr; v1 had a corresponding explicit (char*) cast. Avoid this altogether. lib/kobject.c

[PATCH v2 3/8] blktrace: use strreplace in do_blk_trace_setup

2015-06-08 Thread Rasmus Villemoes
al strlen() call and then the open-coded loop. Let's simply use strreplace() instead. Signed-off-by: Rasmus Villemoes Acked-by: Steven Rostedt --- v2: same patch, added Ack. kernel/trace/blktrace.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/tra

[PATCH v2 1/8] lib: string: Introduce strreplace

2015-06-08 Thread Rasmus Villemoes
he caller to avoid a strlen call). Signed-off-by: Rasmus Villemoes --- v2: spello fixed, parameters renamed 'old' and 'new' (just so the kernel doc aligns nicely, and because that's what python -c 'help(str.replace)' uses). Still EXPORT_SYMBOL, not inline (tried it,

[PATCH v2 0/8] Introduce strreplace

2015-06-08 Thread Rasmus Villemoes
what the easiest path is for the remaining patches. Rasmus Villemoes (8): lib: string: Introduce strreplace kernel/trace/trace_events_filter.c: Use strreplace blktrace: use strreplace in do_blk_trace_setup lib/kobject.c: Use strreplace drivers/base/core.c: Use strreplace drivers/md/md.c

Re: [PATCH] checkpatch: Make the output better readable

2015-06-02 Thread Rasmus Villemoes
On Tue, Jun 02 2015, Petr Mladek wrote: > I sent a patch that helped me a lot with parsing. FWIW, me too. I've always been bothered by the empty line between the statistics line and the summary, and the lack of vertical separation before the output for the next file. Rasmus -- To unsubscribe fr

[PATCH] trivial: fix comment mentioning abandoned ASSIGN_ONCE

2015-06-02 Thread Rasmus Villemoes
Commit 43239cbe79fc ("kernel: Change ASSIGN_ONCE(val, x) to WRITE_ONCE(x, val)") left behind this reference. Signed-off-by: Rasmus Villemoes --- include/linux/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/compiler.h b/include/linux/compil

[PATCH] net: tulip: rearrange order of searching for substrings

2015-06-03 Thread Rasmus Villemoes
Currently, two of the branches are dead code, since an earlier smaller substring would have been found ("TP" in the "TP_NW" case and either of "BNC" and "AUI" in the "BNC_AUI" case). Rearrange the strstr() calls so that the longer strings are se

[PATCH] ASoC: Intel: mrfld: simplify sst_fill_widget_module_info

2015-06-04 Thread Rasmus Villemoes
to w->name. Signed-off-by: Rasmus Villemoes --- sound/soc/intel/atom/sst-atom-controls.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c index 90aa5c0476f3..16670f

[RFC/PATCH 3/8] blktrace: use strreplace in do_blk_trace_setup

2015-06-04 Thread Rasmus Villemoes
al strlen() call and then the open-coded loop. Let's simply use strreplace() instead. Signed-off-by: Rasmus Villemoes --- kernel/trace/blktrace.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 483cecf

[RFC/PATCH 7/8] fs/jbd2/journal.c: Use strreplace

2015-06-04 Thread Rasmus Villemoes
In one case, we eliminate a local variable; in the other a strlen() call and some .text. Signed-off-by: Rasmus Villemoes --- fs/jbd2/journal.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index b96bd8076b70..5c187ded12d6

[RFC/PATCH 8/8] fs/ext4/super.c: Use strreplace in ext4_fill_super

2015-06-04 Thread Rasmus Villemoes
This makes a very large function a little smaller. Signed-off-by: Rasmus Villemoes --- fs/ext4/super.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ca9d4a2fed41..5f3c43a66937 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c

[RFC/PATCH 0/8] Introduce strreplace

2015-06-04 Thread Rasmus Villemoes
Doing single-character substitution on an entire string is open-coded in a few places, sometimes in a rather suboptimal way. This introduces a trivial helper, strreplace, for this task along with a few example conversions. Rasmus Villemoes (8): lib: string: Introduce strreplace kernel/trace

[RFC/PATCH 4/8] lib/kobject.c: Use strreplace

2015-06-04 Thread Rasmus Villemoes
There's probably not many slashes in kobj->name, but starting over when we see one feels wrong. Signed-off-by: Rasmus Villemoes --- lib/kobject.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/kobject.c b/lib/kobject.c index 3b841b97fccd..597d962d3d4d 1006

[RFC/PATCH 6/8] drivers/md/md.c: Use strreplace

2015-06-04 Thread Rasmus Villemoes
There's no point in starting over when we meet a '/'. This also eliminates a stack variable and a little .text. Signed-off-by: Rasmus Villemoes --- drivers/md/md.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c ind

[RFC/PATCH 5/8] drivers/base/core.c: Use strreplace

2015-06-04 Thread Rasmus Villemoes
This eliminates a local variable and a little .text. Signed-off-by: Rasmus Villemoes --- drivers/base/core.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 21d13038534e..01f2c1214f06 100644 --- a/drivers/base/core.c +++ b

[RFC/PATCH 1/8] lib: string: Introduce strreplace

2015-06-04 Thread Rasmus Villemoes
he caller to avoid a strlen call). Signed-off-by: Rasmus Villemoes --- include/linux/string.h | 1 + lib/string.c | 17 + 2 files changed, 18 insertions(+) diff --git a/include/linux/string.h b/include/linux/string.h index e40099e585c9..4f09e41c7169 100644 --- a/include/

[RFC/PATCH 2/8] kernel/trace/trace_events_filter.c: Use strreplace

2015-06-04 Thread Rasmus Villemoes
There's no point in starting over every time we see a ','... Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_events_filter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events

Re: [PATCH v2 1/8] lib: string: Introduce strreplace

2015-06-09 Thread Rasmus Villemoes
On Tue, Jun 09 2015, Joe Perches wrote: > On Tue, 2015-06-09 at 01:26 +0200, Rasmus Villemoes wrote: >> Strings are sometimes sanitized by replacing a certain character >> (often '/') by another (often '!'). > [] >> v2: spello fixed, parameters rename

Re: [PATCH v2 0/8] Introduce strreplace

2015-06-09 Thread Rasmus Villemoes
On Tue, Jun 09 2015, Theodore Ts'o wrote: > On Tue, Jun 09, 2015 at 01:26:48AM +0200, Rasmus Villemoes wrote: >> Doing single-character substitution on an entire string is open-coded >> in a few places, sometimes in a rather suboptimal way. This introduces >> a trivi

[PATCH] drivers/video/fbdev/sis/sis_main.c: avoid repeated strlen() calls

2015-06-09 Thread Rasmus Villemoes
gcc is not smart enough to realize that strlen(strbuf1) cannot be changed by the loop body, so it is forced to recompute it, at least in the branch containing the assignment. Avoid this by using an equivalent stopping condition. Signed-off-by: Rasmus Villemoes --- drivers/video/fbdev/sis

[PATCH] libata: finally use __initconst in ata_parse_force_one()

2015-06-09 Thread Rasmus Villemoes
Just six days after this FIXME was added seven years ago, Sam Ravnborg added the missing feature (37c514e3dfc8 "Add missing init section definitions"), though it ended up being called __initconst. Let's use it; better late than never. Signed-off-by: Rasmus Villemoes --- dri

isdn: pcbit: another off-by-one issue?

2015-06-10 Thread Rasmus Villemoes
Hi Dan You were last to touch drivers/isdn/pcbit/drv.c (7bcc6738eef), but I think there may still be an off-by-one in pcbit_set_msn: At the end of the loop, sp is incremented by len, but if the string contained a comma, sp will now point at that. At that point, we seem to be stuck in an infinite l

[PATCH] ext4: mballoc: avoid 20-argument function call

2015-06-10 Thread Rasmus Villemoes
Making a function call with 20 arguments is rather expensive in both stack and .text. In this case, doing the formatting manually doesn't make it any less readable, so we might as well save 155 bytes of .text and 112 bytes of stack. Signed-off-by: Rasmus Villemoes --- fs/ext4/mballoc.

Re: isdn: pcbit: another off-by-one issue?

2015-06-11 Thread Rasmus Villemoes
[adding some emails I should Cc'ed in the first place] On Thu, Jun 11 2015, Dan Carpenter wrote: > On Wed, Jun 10, 2015 at 09:50:53PM +0200, Rasmus Villemoes wrote: >> Hi Dan >> >> You were last to touch drivers/isdn/pcbit/drv.c (7bcc6738eef), but I >> think the

Re: [PATCH 0/5] kernel/cpu.c: eliminate some indirection

2015-06-11 Thread Rasmus Villemoes
On Thu, May 07 2015, Rasmus Villemoes wrote: > The four cpumasks cpu_{possible,online,present,active}_bits are > exposed readonly via the corresponding const variables > cpu_xyz_mask. But they are also accessible for arbitrary writing via > the exposed functions set_cpu_xyz. There&#

[PATCH] linux/types.h: remove prehistoric ifndefs

2015-06-11 Thread Rasmus Villemoes
Whatever the "historical reasons" were back around 1996 when this comment was added, git grep -E '\b_(S?SIZE|TIME|CLOCK|PTRDIFF|CADDR)_T\b' seems to say that they are no longer relevant. Relieve the preprocessor from a little work. Signed-off-by: Rasmus Villemoes --- i

[PATCH v3 2/2] cxl: use more common format specifier

2015-06-11 Thread Rasmus Villemoes
A precision of 16 (%.16llx) has the same effect as a field width of 16 along with passing the 0 flag (%016llx), but the latter is much more common in the kernel tree. Update cxl to use that. Signed-off-by: Rasmus Villemoes --- So, maybe this on top? drivers/misc/cxl/irq.c| 32

[RFC 2/4] .gitignore: add *.su pattern

2015-06-20 Thread Rasmus Villemoes
Ignore the *.su files generated by using the gcc option -fstack-usage. Signed-off-by: Rasmus Villemoes --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4ad4a98b884b..9e51ead66a55 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7

[RFC 1/4] scripts: add stackusage script

2015-06-20 Thread Rasmus Villemoes
at by 48 83 c4 80 add$0xff80,%rsp and not 48 81 ec 80 00 00 00sub$0x80,%rsp since -128 fits in an imm8. Signed-off-by: Rasmus Villemoes --- scripts/stackusage | 40 1 file changed, 40 insertions(+) create mode 100755

[RFC 4/4] scripts: add stackdelta script

2015-06-20 Thread Rasmus Villemoes
/{old,new}.su | sort -k5,5g shows that gcc 5.0 generally produces less stack-hungry code than gcc 4.7. Obviously, the script can also be used for measuring the effect of commits, .config tweaks or whatnot. Signed-off-by: Rasmus Villemoes --- scripts/stackdelta | 55

[RFC 3/4] kbuild: remove *.su files generated by -fstack-usage

2015-06-20 Thread Rasmus Villemoes
Make sure 'make clean' removes *.su files generated by the gcc option -fstack-usage. Signed-off-by: Rasmus Villemoes --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 40a8b068ac26..5cd04968d914 100644 --- a/Makefile +++ b/Makefile @@ -1430

Re: [RFC 4/4] scripts: add stackdelta script

2015-06-22 Thread Rasmus Villemoes
On Sun, Jun 21 2015, Rasmus Villemoes wrote: > + > +my $old = read_stack_usage_file($ARGV[0]); > +my $new = read_stack_usage_file($ARGV[1]); > +my @common = grep {exists $new->{$_}} keys %$old; > +print join(",", keys %old) . "\n"; Bah, that print is leftov

[PATCH 1/3] fixdep: remove stale references to uml-config.h

2018-02-28 Thread Rasmus Villemoes
user-mode-linux-de...@lists.sourceforge.net Signed-off-by: Rasmus Villemoes --- scripts/basic/fixdep.c | 9 - 1 file changed, 9 deletions(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index fa3d39b6f23b..d7fbe545dd5d 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/

[PATCH 2/3] fixdep: remove some false CONFIG_ matches

2018-02-28 Thread Rasmus Villemoes
...) lines from the .o.cmd files. Signed-off-by: Rasmus Villemoes --- scripts/basic/fixdep.c | 5 + 1 file changed, 5 insertions(+) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index d7fbe545dd5d..1b21870d6e7f 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c

[PATCH 3/3] fixdep: do not ignore kconfig.h

2018-02-28 Thread Rasmus Villemoes
/booger.h - we could change that to FOO if we care [2] https://lkml.org/lkml/2018/2/22/838 Cc: Linus Torvalds Signed-off-by: Rasmus Villemoes --- scripts/basic/fixdep.c | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 1b21870d6e7f..449b68c4c90c

[PATCH] vfs: make sure struct filename->iname is word-aligned

2018-02-28 Thread Rasmus Villemoes
nter to strncpy_from_user. Instead of explicit padding, simply swap the refcnt and aname members, as suggested by Al Viro. Signed-off-by: Rasmus Villemoes --- fs/namei.c | 2 ++ include/linux/fs.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/n

[PATCH resend] drivers/char/random.c: remove unused dont_count_entropy

2018-02-28 Thread Rasmus Villemoes
inux/kernel/git/tglx/history.git/commit/?id=c1c48e61c251f57e7a3f1bf11b3c462b2de9dcb5 Signed-off-by: Rasmus Villemoes --- drivers/char/random.c | 53 --- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/drivers/char/random.c b/drivers

[RFC 5/5] PCI: tegra: use seq_open_data

2018-03-01 Thread Rasmus Villemoes
Simplify the code slightly by having seq_open_data do the ->private assignment. Signed-off-by: Rasmus Villemoes --- drivers/pci/host/pci-tegra.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c in

[RFC 1/5] seq_file: introduce seq_open_data helper

2018-03-01 Thread Rasmus Villemoes
There are quite a few callers of seq_open that could be simplified by setting the ->private member via the seq_open call instead of fetching file->private_data afterwards. Signed-off-by: Rasmus Villemoes --- I've just included a few examples of possible users of this helper, there ar

[RFC 2/5] ia64/sn/hwperf: use seq_open_data

2018-03-01 Thread Rasmus Villemoes
This code should check the return value of seq_open(); if it failed, file->private_data is NULL. But we can avoid the issue entirely and simplify the code by letting seq_open_data() set the ->private member to objbuf. Signed-off-by: Rasmus Villemoes --- arch/ia64/sn/kernel/sn2/sn_hwperf

[RFC 4/5] fm10k: use seq_open_data()

2018-03-01 Thread Rasmus Villemoes
Simplify the code slightly by having seq_open_data do the ->private assignment. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c

[RFC 3/5] powerpc/pseries: use seq_open_data in hcall_inst_seq_open

2018-03-01 Thread Rasmus Villemoes
This code should check the return value of seq_open(); if it failed, file->private_data is NULL. But we can avoid the issue entirely and simplify the code by letting seq_open_data() set the ->private member. Signed-off-by: Rasmus Villemoes --- arch/powerpc/platforms/pseries/hvCall_inst

Re: [PATCHv3] gpio: Remove VLA from gpiolib

2018-04-05 Thread Rasmus Villemoes
On 2018-03-28 20:18, Laura Abbott wrote: > The new challenge is to remove VLAs from the kernel > (see https://lkml.org/lkml/2018/3/7/621) to eventually > turn on -Wvla. > > Using a kmalloc array is the easy way to fix this but kmalloc is still > more expensive than stack allocation. Introduce a fa

Re: [PATCH?] reiserfs: prevent panic: don't allow %-char in journal dev. name

2018-04-05 Thread Rasmus Villemoes
On 2018-04-05 03:45, Andrew Morton wrote: > On Wed, 4 Apr 2018 18:25:16 -0700 Randy Dunlap wrote: > >> From: Randy Dunlap >> >> If the reiserfs mount option's journal name contains a '%' character, >> it can lead to a WARN_ONCE() in lib/vsprintf.c::format_decode(), >> saying: "Please remove unsu

Re: [PATCH v4 3/9] vsprintf: Do not check address of well-known strings

2018-04-05 Thread Rasmus Villemoes
On 2018-04-04 10:58, Petr Mladek wrote: > We are going to check the address using probe_kernel_address(). It will > be more expensive and it does not make sense for well known address. > > This patch splits the string() function. The variant without the check > is then used on locations that handl

Re: [PATCH v4 4/9] vsprintf: Consolidate handling of unknown pointer specifiers

2018-04-05 Thread Rasmus Villemoes
On 2018-04-04 10:58, Petr Mladek wrote: > There are few printk formats that make sense only with two or more > specifiers. Also some specifiers make sense only when a kernel feature > is enabled. > > The handling of unknown specifiers is strange, inconsistent, and > even leaking the address. For e

Re: [PATCH v4 8/9] vsprintf: Prevent crash when dereferencing invalid pointers

2018-04-05 Thread Rasmus Villemoes
On 2018-04-04 10:58, Petr Mladek wrote: > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > index 3551b7957d9e..1a080a75a825 100644 > --- a/lib/vsprintf.c > +++ b/lib/vsprintf.c > @@ -599,12 +599,46 @@ char *__string(char *buf, char *end, const char *s, > struct printf_spec spec) > return wide

Re: [PATCH 2/2] mm: Add kvmalloc_ab_c and kvzalloc_struct

2018-04-30 Thread Rasmus Villemoes
On 2018-04-30 22:16, Matthew Wilcox wrote: > On Mon, Apr 30, 2018 at 12:02:14PM -0700, Kees Cook wrote: >> >> Getting the constant ordering right could be part of the macro >> definition, maybe? i.e.: >> >> static inline void *kmalloc_ab(size_t a, size_t b, gfp_t flags) >> { >> if (__builtin_co

Re: [PATCH v5 10/11] vsprintf: WARN() on invalid pointer access

2018-04-25 Thread Rasmus Villemoes
On 2018-04-25 13:12, Petr Mladek wrote: > > diff --git a/lib/test_printf.c b/lib/test_printf.c > index 45c33143fb4a..74dff6c44ec6 100644 > --- a/lib/test_printf.c > +++ b/lib/test_printf.c > @@ -285,12 +285,19 @@ null_pointer(void) > > #define PTR_INVALID ((void *)0x00ab) > > +extern in

Re: [RFC PATCH] soc/fsl/qe: support MPC8309

2019-02-28 Thread Rasmus Villemoes
On 28/02/2019 08.14, Qiang Zhao wrote: > On Tue, Feb 26, 2019 at 2:49 AM Rasmus Villemoes > wrote: >> -Original Message----- >> From: Rasmus Villemoes >> Sent: 2019年2月26日 16:48 >> To: Qiang Zhao ; Leo Li >> Cc: linux-kernel@vger.kernel.org; Valentin L

[PATCH 0/4] soc/fsl/qe: qe.c: cleanups and support for MPC8309

2019-02-28 Thread Rasmus Villemoes
the snums array. This should make it easier to support all of the QE variants out there, instead of teaching the qe driver some magic mapping from qe-num-snums to actual snum values. Rasmus Villemoes (4): soc/fsl/qe: qe.c: drop useless static qualifier soc/fsl/qe: qe.c: reduce static memory

[PATCH 1/4] soc/fsl/qe: qe.c: drop useless static qualifier

2019-02-28 Thread Rasmus Villemoes
The local variable snum_init has no reason to have static storage duration. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index 2ef6fc6487c1..4b6aa6b3b685 100644

[PATCH 3/4] soc/fsl/qe: qe.c: introduce qe_get_device_node helper

2019-02-28 Thread Rasmus Villemoes
The 'try of_find_compatible_node(NULL, NULL, "fsl,qe"), fall back to of_find_node_by_type(NULL, "qe")' pattern is repeated five times. Factor it into a common helper. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe.c | 71 +--

[PATCH 2/4] soc/fsl/qe: qe.c: reduce static memory footprint by 1.7K

2019-02-28 Thread Rasmus Villemoes
acked in a 32 byte bitmap. So this reduces the .data footprint by 1760 bytes. It also serves as preparation for introducing another DT binding for specifying the snum values. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe.c | 37 - 1 file change

[PATCH 4/4] soc/fsl/qe: qe.c: support fsl,qe-snums property

2019-02-28 Thread Rasmus Villemoes
< 0x88 0x89 0x98 0x99 0xa8 0xa9 0xb8 0xb9 0xc8 0xc9 0xd8 0xd9 0xe8 0xe9>; Signed-off-by: Rasmus Villemoes --- .../devicetree/bindings/soc/fsl/cpm_qe/qe.txt | 8 +++- drivers/soc/fsl/qe/qe.c| 14 +- 2

Re: [PATCH 4/4] soc/fsl/qe: qe.c: support fsl,qe-snums property

2019-02-28 Thread Rasmus Villemoes
On 01/03/2019 04.36, Qiang Zhao wrote: > On 2019年2月28日 18:31,Rasmus Villemoes wrote: > >> -Original Message----- >> From: Rasmus Villemoes >> Sent: 2019年2月28日 18:31 >> To: Qiang Zhao ; Leo Li >> Cc: Scott Wood ; linux-kernel@vger.kernel.org; Timur Ta

Re: [PATCH 4/4] soc/fsl/qe: qe.c: support fsl,qe-snums property

2019-03-01 Thread Rasmus Villemoes
On 01/03/2019 10.43, Qiang Zhao wrote: > On 01/03/2019 15.50,Rasmus Villemoes wrote: >> -Original Message- >> From: Rasmus Villemoes >> Sent: 2019年3月1日 15:50 >> To: Qiang Zhao ; Leo Li >> Cc: Scott Wood ; linux-kernel@vger.kernel.org; Timur Tabi >

[PATCH 5/4] soc/fsl/qe: qe.c: fold qe_get_num_of_snums into qe_snums_init

2019-03-01 Thread Rasmus Villemoes
attempt to copy 4GB from snum_init_46[] to the snum[] array. So fold the handling of the legacy fsl,qe-num-snums into qe_snums_init, and make sure we do not end up using the snum_init_46 array in cases other than the two where we know it makes sense. Signed-off-by: Rasmus Villemoes --- Qiang: Some

[PATCH] kernel/user.c: clean up some leftover code

2019-04-24 Thread Rasmus Villemoes
The out_unlock label is misleading; no unlocking happens after it, so just return NULL directly. Also, nothing between the kmem_cache_zalloc() that creates new and the two key_put() can initialize new->uid_keyring or new->session_keyring, so those calls are no-ops. Signed-off-by: Rasmus Vil

[PATCH] mod_devicetable.h: reduce sizeof(struct of_device_id) by 80 bytes

2019-04-25 Thread Rasmus Villemoes
r. Signed-off-by: Rasmus Villemoes --- include/linux/mod_devicetable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 448621c32e4d..502629bdac2e 100644 --- a/include/linux/mod_devicetable.h +++ b/inc

[PATCH 0/4] irqchip/gic-v3-its: free_lpi_range tweaks

2019-03-12 Thread Rasmus Villemoes
ticed that the cmp callback I was removing was actually buggy, so I went back and added a patch in front suitable for -stable. I'll leave it to others to decide if it's important enough for that. Please note that this is only compile-tested. Rasmus Villemoes (4): irqchip/gic-v3-its:

[PATCH 2/4] irqchip/gic-v3-its: move allocation outside mutex

2019-03-12 Thread Rasmus Villemoes
it's probably not worth complicating the code for that. Signed-off-by: Rasmus Villemoes --- drivers/irqchip/irq-gic-v3-its.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 75

[PATCH 3/4] irqchip/gic-v3-its: drop redundant initialization in mk_lpi_range

2019-03-12 Thread Rasmus Villemoes
There's no reason to ask kmalloc() to zero the allocation, since all the fields get initialized immediately afterwards. Except that there's also not any reason to initialize the ->entry member, since the element gets added to the lpi_range_list immediately. Signed-off-by: Ras

[PATCH 4/4] irqchip/gic-v3-its: make free_lpi_range a little cheaper

2019-03-12 Thread Rasmus Villemoes
that only the just-inserted element may be merged with its neighbours. Signed-off-by: Rasmus Villemoes --- drivers/irqchip/irq-gic-v3-its.c | 61 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq

[PATCH 1/4] irqchip/gic-v3-its: fix comparison logic in lpi_range_cmp

2019-03-12 Thread Rasmus Villemoes
ce versa, of course. Fixes: 880cb3cddd16 (irqchip/gic-v3-its: Refactor LPI allocator) Cc: sta...@vger.kernel.org (v4.19+) Signed-off-by: Rasmus Villemoes --- drivers/irqchip/irq-gic-v3-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers

Re: [PATCH] Makefile: Add '-fno-builtin-bcmp' to CLANG_FLAGS

2019-03-13 Thread Rasmus Villemoes
On 12/03/2019 22.52, Nathan Chancellor wrote: > After LLVM revision r355672 [1], all known working kernel configurations > fail to link [2]: > > ld: init/do_mounts.o: in function `prepare_namespace': > do_mounts.c:(.init.text+0x5ca): undefined reference to `bcmp' > ld: do_mounts.c:(.init.text+0x5e

Re: [PATCH v2] lib/string.c: implement a basic bcmp

2019-03-13 Thread Rasmus Villemoes
On 13/03/2019 20.01, Steven Rostedt wrote: > On Wed, 13 Mar 2019 11:51:09 -0700 > Nick Desaulniers wrote: > >>> >>> or have a better comment explaining why its the same. >> >> I could add something about "the signedness of the return code not >> providing any meaning." What would you like to s

[PATCH 3/4] leds: netdev trigger: add documentation to leds/common.txt

2019-03-13 Thread Rasmus Villemoes
The various sysfs files used to configure a netdev-triggered LED are already documented, but let's also add "netdev" to the list of things one can reasonably set linux,default-trigger to. Signed-off-by: Rasmus Villemoes --- Documentation/devicetree/bindings/leds/common.txt

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