Re: [PATCH] socket.7: add description for SO_BUSY_POLL

2013-07-10 Thread Rasmus Villemoes
Eliezer Tamir writes: > +While busy polling my improve latency of some application, care must be > +taken when using it since this will increase both CPU utilization power > usage. s/my/may/; missing 'and' before 'power usage'. [And should 'application' be plural?] Rasmus -- To unsubscribe fr

Re: [git pull] vfs.git part 2

2013-07-12 Thread Rasmus Villemoes
Al Viro writes: > On Thu, Jul 11, 2013 at 02:42:54PM -0700, Linus Torvalds wrote: >> But with an *old* kernel, O_TMPFILE will just silently be ignored as >> an unrecognized flag, and things won't work. If you do >> >> fd = open("dirname", O_CREAT | O_TMPFILE | O_RDWR, 0666); >> >> it may be t

Re: [git pull] vfs.git part 2

2013-07-12 Thread Rasmus Villemoes
Al Viro writes: > On Fri, Jul 12, 2013 at 12:02:45PM +0000, Rasmus Villemoes wrote: > >> But isn't the problem the case where dirname does not exist? I.e., the >> application has to make sure that "/some/where" exists and is a directory >> before open(&quo

[PATCH] fs: Properly pair fget_light/fput_light in fdget/fdput

2013-06-05 Thread Rasmus Villemoes
fdget() is implemented using fget_light(). Its companion fdput() currently open-codes the behaviour of fput_light(). This is slightly confusing. To follow the documentation in fs/file.c:688ff to the letter, use fput_light() in fdput(). Signed-off-by: Rasmus Villemoes --- include/linux/file.h

[PATCH] drivers: use IS_ERR_VALUE() in memory_lseek()

2013-06-05 Thread Rasmus Villemoes
Use IS_ERR_VALUE() instead of comparing the new offset to a hard-coded value of -MAX_ERRNO (which is also off-by-one due to the use of ~ instead of -). Signed-off-by: Rasmus Villemoes --- drivers/char/mem.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char

Re: [PATCH] mm: mremap: validate input before taking lock

2013-06-05 Thread Rasmus Villemoes
Ping... Rasmus Villemoes writes: > This patch is very similar to 84d96d897671: Perform some basic > validation of the input to mremap() before taking the > ¤t->mm->mmap_sem lock. This also makes the MREMAP_FIXED => > MREMAP_MAYMOVE dependency slightly more explicit. >

Re: [PATCH v2 1/3] mfd: Add irq domain support for max8998 interrupts

2013-06-21 Thread Rasmus Villemoes
8997_dev *max8998 = d->host_data; I may be wrong, but this sure looks like a typo (or copy-pasto). -- Rasmus Villemoes <http://rasmusvillemoes.dk/> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger

Re: [git pull] vfs.git part 2

2013-07-15 Thread Rasmus Villemoes
Linus Torvalds writes: > On Fri, Jul 12, 2013 at 12:39 PM, Al Viro wrote: >> >> [suggested by Rasmus Villemoes] make O_DIRECTORY | O_RDWR part of O_TMPFILE; >> that will fail on old kernels in a lot more cases than what I came up with. > > So see earlier about why I&#

Re: [PATCH] Add per-process flag to control thp

2013-08-04 Thread Rasmus Villemoes
Alex Thorlton writes: > This patch implements functionality to allow processes to disable the use of > transparent hugepages through the prctl syscall. A few comments: Is there a reason it shouldn't be possible for a process to un-disable/reenable thp? > +static inline int transparent_hugep

[PATCH 0/4] asm-generic: fix minor include guard issues

2013-08-08 Thread Rasmus Villemoes
cific, the _ASM_POWERPC_RWSEM_H and #ifdef CONFIG_PPC64 seem malplaced. Rasmus Villemoes (4): asm-generic: Make sure include guards contain the substring ASM_GENERIC asm-generic: Use different include guards asm-generic: Add missing include guards asm-generic: Fix typo in comment

[PATCH 1/4] asm-generic: Make sure include guards contain the substring ASM_GENERIC

2013-08-08 Thread Rasmus Villemoes
-hits are: arch/mn10300/include/asm/rtc.h uses _ASM_RTC_H and includes asm-generic/rtc.h which uses __ASM_RTC_H__ arch/hexagon/include/asm/cacheflush.h uses _ASM_CACHEFLUSH_H and includes asm-generic/cacheflush.h which uses __ASM_CACHEFLUSH_H Signed-off-by: Rasmus Villemoes --- include/asm-generic

[PATCH 3/4] asm-generic: Add missing include guards

2013-08-08 Thread Rasmus Villemoes
Add include guards to include/asm-generic/{ide_iops,unistd,xor}.h. Signed-off-by: Rasmus Villemoes --- include/asm-generic/ide_iops.h |4 include/asm-generic/unistd.h |5 + include/asm-generic/xor.h |4 3 files changed, 13 insertions(+) diff --git a/include/asm

[PATCH 4/4] asm-generic: Fix typo in comment after #endif

2013-08-08 Thread Rasmus Villemoes
Fix the comment so that it matches the actual name of the include guard used. Signed-off-by: Rasmus Villemoes --- include/asm-generic/bitops/arch_hweight.h |2 +- include/asm-generic/bitops/atomic.h |2 +- include/asm-generic/pci_iomap.h |2 +- include/asm-generic

[PATCH 2/4] asm-generic: Use different include guards

2013-08-08 Thread Rasmus Villemoes
For consistency, use different include guards in include/asm-generic/dma-mapping-{broken,common}.h, even though it is unlikely (if not outright a bug) to ever include both. Signed-off-by: Rasmus Villemoes --- include/asm-generic/dma-mapping-broken.h |6 +++--- include/asm-generic/dma

[PATCH/RFC] coccinelle: replace 0/1 with false/true in functions returning bool

2013-08-09 Thread Rasmus Villemoes
1; + return false;return true; } Is there a way to prevent this, or is this the kind of thing which must be handled in post-processing? Signed-off-by: Rasmus Villemoes --- scripts/coccinelle/misc/boolreturn.cocci | 51 ++ 1 file changed, 51 insertions

[PATCH v2] coccinelle: replace 0/1 with false/true in functions returning bool

2013-08-09 Thread Rasmus Villemoes
This semantic patch replaces "return {0,1};" with "return {false,true};" in functions returning bool. Signed-off-by: Rasmus Villemoes --- v2: Simplified script, and eliminate whitespace mangling at the same time. Thanks to Julia Lawall. scripts/coccinelle/misc/boo

[PATCH v3] coccinelle: replace 0/1 with false/true in functions returning bool

2013-08-11 Thread Rasmus Villemoes
This semantic patch replaces "return {0,1};" with "return {false,true};" in functions returning bool. Signed-off-by: Rasmus Villemoes --- v2: Simplified script, and eliminate whitespace mangling at the same time. Thanks to Julia Lawall. v3: Further improvements from Julia. I

[PATCH] mm: madvise: complete input validation before taking lock

2013-04-10 Thread Rasmus Villemoes
In madvise(), there doesn't seem to be any reason for taking the ¤t->mm->mmap_sem before start and len_in have been validated. Incidentally, this removes the need for the out: label. Signed-off-by: Rasmus Villemoes --- diff --git a/mm/madvise.c b/mm/madvise.c index c58c94b..d2a

Re: [PATCH 3/3] watchdog: bcm2835_wdt: set WDOG_HW_RUNNING bit when appropriate

2016-07-20 Thread Rasmus Villemoes
On 2016-07-15 15:46, Guenter Roeck wrote: On 07/15/2016 01:15 AM, Rasmus Villemoes wrote: +static bool bcm2835_wdt_is_running(struct bcm2835_wdt *wdt) +{ +uint32_t cur; + +cur = readl(wdt->base + PM_RSTC); + +return !!(cur & PM_RSTC_WRCFG_FULL_RESET); +} + sta

Re: [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE

2016-07-20 Thread Rasmus Villemoes
On 2016-07-15 16:29, Guenter Roeck wrote: On 07/15/2016 12:32 AM, Rasmus Villemoes wrote: The initial timeout should be specified as module option or as devicetree parameter, and there should be no additional configuration option. I was under the impression that device tree was exclusively

[PATCH] fs/proc/array.c: slightly improve render_sigset_t

2016-09-20 Thread Rasmus Villemoes
fd = open("/proc/self/status", O_RDONLY); read(fd, buf, sizeof(buf)); close(fd); } Signed-off-by: Rasmus Villemoes --- fs/proc/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/array.c b/fs/proc/array.c index

[PATCH] ecryptfs: remove private bin2hex implementation

2016-09-20 Thread Rasmus Villemoes
bin2hex doesn't. [All but one user of ecryptfs_to_hex explicitly nul-terminates the result anyway.] Signed-off-by: Rasmus Villemoes --- fs/ecryptfs/crypto.c | 15 --- fs/ecryptfs/ecryptfs_kernel.h | 8 +++- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git

Re: [PATCH] fs/proc/array.c: slightly improve render_sigset_t

2016-09-21 Thread Rasmus Villemoes
On Wed, Sep 21 2016, Kees Cook wrote: > On Tue, Sep 20, 2016 at 3:28 PM, Rasmus Villemoes > wrote: >> format_decode and vsnprintf occasionally show up in perf top, so I >> went looking for places that might not need the full printf >> power. With the help of kprobes, I

Re: [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE

2016-07-27 Thread Rasmus Villemoes
On 2016-07-21 02:31, Guenter Roeck wrote: On Thu, Jul 21, 2016 at 12:08:52AM +0200, Rasmus Villemoes wrote: I hear you. "configure hardware" is a slippery term, though. After all, one would typically configure the initial timeout in hardware, just as any "normal" timeout.

[PATCH] mm/shmem.c: constify anon_ops

2016-09-14 Thread Rasmus Villemoes
Every other dentry_operations instance is const, and this one might as well be. Signed-off-by: Rasmus Villemoes --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index fd8b2b5741b1..693ffdc5899a 100644 --- a/mm/shmem.c +++ b/mm/shmem.c

[PATCH] fs/internal.h: add const to ns_dentry_operations declaration

2016-09-14 Thread Rasmus Villemoes
The actual definition in fs/nsfs.c is already const. Signed-off-by: Rasmus Villemoes --- Maybe fs/nsfs.c (and fs/buffer.c) should grow includes of internal.h. I think they are the only two providing stuff declared there but not including it. fs/internal.h | 2 +- 1 file changed, 1 insertion

[PATCH] fs/aio.c: eliminate redundant loads in put_aio_ring_file

2016-09-14 Thread Rasmus Villemoes
Using a local variable we can prevent gcc from reloading aio_ring_file->f_inode->i_mapping twice, eliminating 2x2 dependent loads. Signed-off-by: Rasmus Villemoes --- fs/aio.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index fb8e45

[PATCH] usb: musb: remove redundant stack buffers

2016-08-04 Thread Rasmus Villemoes
aDate is always the empty string, so entirely pointless. The aRevision formatting might as well be done as part of the pr_debug() call - that also avoids it altogether if pr_debug is compiled out. Signed-off-by: Rasmus Villemoes --- drivers/usb/musb/musb_core.c | 12 +--- 1 file changed

[PATCH] mm/page_alloc.c: eliminate unsigned confusion in __rmqueue_fallback

2017-06-21 Thread Rasmus Villemoes
, change the two variables to signed, making the counting-down for loop look more familiar, and apparently also making gcc generate slightly smaller code. [1] https://lkml.org/lkml/2016/6/20/493 [2] https://lkml.org/lkml/2017/6/19/345 Signed-off-by: Rasmus Villemoes --- Michal, something like this

Re: [PATCH v5 2/3] watchdog: introduce watchdog.open_timeout commandline parameter

2017-05-30 Thread Rasmus Villemoes
On 2017-05-25 02:56, Guenter Roeck wrote: > On 05/22/2017 07:06 AM, Rasmus Villemoes wrote: >> diff --git a/Documentation/watchdog/watchdog-parameters.txt >> b/Documentation/watchdog/watchdog-parameters.txt >> index 914518a..4801ec6 100644 >> --- a/Documentation/watch

[PATCH v6 1/3] watchdog: introduce watchdog_worker_should_ping helper

2017-05-30 Thread Rasmus Villemoes
This will be useful when the condition becomes slightly more complicated in the next patch. Reviewed-by: Guenter Roeck Reviewed-by: Esben Haabendal Signed-off-by: Rasmus Villemoes --- drivers/watchdog/watchdog_dev.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff

[PATCH v6 0/3] watchdog: allow setting deadline for opening /dev/watchdogN

2017-05-30 Thread Rasmus Villemoes
, and the ability to set the default value for the watchdog.open_timeout command line parameter via Kconfig is split into a separate patch. Compared to v2/v3, this drops the ability to set the open_timeout via a device property; I'll leave implementing that to those who actually need it. R

[PATCH v6 2/3] watchdog: introduce watchdog.open_timeout commandline parameter

2017-05-30 Thread Rasmus Villemoes
more than 5 seconds after the bootloader hands control to the kernel (250 ms until the driver gets registered and kernel handling starts, 4500 ms of kernel handling, and then up to 250 ms from the last ping until userspace takes over). Signed-off-by: Rasmus Villemoes --- Documentation/watchdog

[PATCH v6 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_TIMEOUT

2017-05-30 Thread Rasmus Villemoes
, and is of course immensely useful for development purposes while one has console acccess, as well as usable in the cases where one can make a permanent update of the kernel command line. Signed-off-by: Rasmus Villemoes --- Documentation/watchdog/watchdog-parameters.txt | 3 ++- drivers/wat

Re: [PATCH v7] printk: hash addresses printed with %p

2017-10-25 Thread Rasmus Villemoes
On 25 October 2017 at 01:57, Tobin C. Harding wrote: > On Tue, Oct 24, 2017 at 09:25:20PM +0200, Rasmus Villemoes wrote: >> >> I haven't followed the discussion too closely, but has it been >> considered to exempt NULL from hashing? > [snip] > >

[PATCH 5/5] USB: Add format_template attribute to struct usb_class_driver

2017-11-12 Thread Rasmus Villemoes
This serves as human-readable documentation as well as allowing the format_template plugin to complain about any static initializers of this struct member that do not have the same set of printf specifiers. Signed-off-by: Rasmus Villemoes --- include/linux/usb.h | 2 +- 1 file changed, 1

[PATCH 1/5] plugins: implement format_template attribute

2017-11-12 Thread Rasmus Villemoes
is attribute to smp_hotplug_thread::thread_comm and modifying kernel/watchdog.c slightly, an example of the error message produced for violations is: kernel/watchdog.c:528:1: error: initializer string 'watchdog/%u %d' contains extra format specifier '%d' compared to format templ

[PATCH 3/5] staging: speakup: Apply format_template attribute

2017-11-12 Thread Rasmus Villemoes
This serves as human-readable documentation as well as allowing the format_template plugin to complain about any static initializers of this struct member that do not have the same set of printf specifiers. Signed-off-by: Rasmus Villemoes --- drivers/staging/speakup/spk_types.h | 2 +- 1 file

[PATCH 2/5] hwmon: (applesmc) Apply format_template attribute

2017-11-12 Thread Rasmus Villemoes
This serves as human-readable documentation as well as allowing the format_template plugin to complain about any static initializers of this struct member that do not have the same set of printf specifiers. Signed-off-by: Rasmus Villemoes --- drivers/hwmon/applesmc.c | 2 +- 1 file changed, 1

[PATCH 4/5] linux/smpboot.h: Apply format_template attribute

2017-11-12 Thread Rasmus Villemoes
This serves as human-readable documentation as well as allowing the format_template plugin to complain about any static initializers of this struct member that do not have the same set of printf specifiers. Signed-off-by: Rasmus Villemoes --- include/linux/smpboot.h | 2 +- 1 file changed, 1

[PATCH] irqdomain: drop pointless NULL check in virq_debug_show_one

2017-11-12 Thread Rasmus Villemoes
We've already done data->irq and data->hwirq, and also unconditionally dereference data in the irq_data_get_irq_chip_data() call. Signed-off-by: Rasmus Villemoes --- kernel/irq/irqdomain.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/irq/irqdomain.c b

[PATCH 0/7] net: core: devname allocation cleanups

2017-11-12 Thread Rasmus Villemoes
in this series. Rasmus Villemoes (7): net: core: improve sanity checking in __dev_alloc_name net: core: move dev_alloc_name_ns a little higher net: core: eliminate dev_alloc_name{,_ns} code duplication net: core: drop pointless check in __dev_alloc_name net: core: check dev_valid_name in _

[PATCH 7/7] net: core: dev_get_valid_name is now the same as dev_alloc_name_ns

2017-11-12 Thread Rasmus Villemoes
t_by_name using that buffer rather than name. Signed-off-by: Rasmus Villemoes --- net/core/dev.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 7c08b4ca7b76..e29eea26f9c1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -

[PATCH 5/7] net: core: check dev_valid_name in __dev_alloc_name

2017-11-12 Thread Rasmus Villemoes
We currently only exclude non-sysfs-friendly names via dev_get_valid_name; there doesn't seem to be a reason to allow such names when we're called via dev_alloc_name. This does duplicate the dev_valid_name check in the dev_get_valid_name() case; we'll fix that shortly. Signed

[PATCH 2/7] net: core: move dev_alloc_name_ns a little higher

2017-11-12 Thread Rasmus Villemoes
No functional change. Signed-off-by: Rasmus Villemoes --- net/core/dev.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 87e19804757b..240ae6bc1097 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1105,6

[PATCH 6/7] net: core: maybe return -EEXIST in __dev_alloc_name

2017-11-12 Thread Rasmus Villemoes
If we're given format string with no %d, -EEXIST is a saner error code. Signed-off-by: Rasmus Villemoes --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index c0a92cf27566..7c08b4ca7b76 100644 --- a/net/core/dev.c +++

[PATCH 4/7] net: core: drop pointless check in __dev_alloc_name

2017-11-12 Thread Rasmus Villemoes
The only caller passes a stack buffer as buf, so it won't equal the passed-in name. Moreover, we're already using buf as a scratch buffer inside the if (p) {} block, so if buf and name were the same, that snprintf() call would be overwriting its own format string. Signed-off-by: Rasmus

[PATCH 3/7] net: core: eliminate dev_alloc_name{,_ns} code duplication

2017-11-12 Thread Rasmus Villemoes
dev_alloc_name contained a BUG_ON(), which I moved to dev_alloc_name_ns; the only other caller of that already has the same BUG_ON. Signed-off-by: Rasmus Villemoes --- net/core/dev.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/net/core/dev.c b/net/core

[PATCH 1/7] net: core: improve sanity checking in __dev_alloc_name

2017-11-12 Thread Rasmus Villemoes
sily crash the kernel (using an appropriate %p extension, we'll likely dereference some completely bogus pointer). In the normal case where strlen() is sane, we don't even save anything by limiting to IFNAMSIZ, so just use strchr(). Signed-off-by: Rasmus Villemoes --- net/core/dev.c |

[PATCH] arm: dts: ls1021a: add reboot node to .dtsi

2017-11-13 Thread Rasmus Villemoes
The LS1021A can be reset via the dcfg regmap in the same way as the arm64 layerscape SoCs, so add the corresponding DT node. Signed-off-by: Rasmus Villemoes --- arch/arm/boot/dts/ls1021a.dtsi | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm

[PATCH] arm: dts: ls1021a: add "fsl,ls1021a-esdhc" compatible string to esdhc node

2017-11-13 Thread Rasmus Villemoes
that. Signed-off-by: Rasmus Villemoes --- arch/arm/boot/dts/ls1021a.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi index 3ff2b8a9f01a..9cdec545decc 100644 --- a/arch/arm/boot/dts/ls1021a.dtsi +++ b/arch/arm/boo

bit tweaks [was: Re: [nfsd4] potentially hardware breaking regression in 4.14-rc and 4.13.11]

2017-11-13 Thread Rasmus Villemoes
On Thu, Nov 09 2017, Linus Torvalds wrote: > The code disassembles to > >0: 83 c9 08 or $0x8,%ecx >3: 40 f6 c6 04 test $0x4,%sil >7: 0f 45 d1 cmovne %ecx,%edx >a: 89 d1mov%edx,%ecx >c: 80 cd 04 or $0

Re: [PATCH] lib: Avoid redundant sizeof checking in __bitmap_weight() calculation.

2017-11-13 Thread Rasmus Villemoes
On 14 November 2017 at 07:57, Rakib Mullick wrote: > Currently, during __bitmap_weight() calculation hweight_long() is used. > Inside a hweight_long() a check has been made to figure out whether a > hweight32() or hweight64() version to use. > > diff --git a/lib/bitmap.c b/lib/bitmap.c > index d8f

[PATCH] arm: dts: ls1021a: Add label to USB controllers

2017-11-14 Thread Rasmus Villemoes
From: Esben Haabendal Add usb2 and usb3 labels to USB2 and USB3 controller device tree nodes, for easier modification in board dts files. Signed-off-by: Esben Haabendal Signed-off-by: Rasmus Villemoes --- arch/arm/boot/dts/ls1021a.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH] arm: dts: ls1021a: Specify interrupt-affinity for pmu node

2017-11-14 Thread Rasmus Villemoes
From: Esben Haabendal This avoids the warning hw perfevents: no interrupt-affinity property for /pmu, guessing. Signed-off-by: Esben Haabendal [RV: adapt commit log to the warning emitted in current mainline] Signed-off-by: Rasmus Villemoes --- arch/arm/boot/dts/ls1021a.dtsi | 1 + 1 file

Re: bit tweaks [was: Re: [nfsd4] potentially hardware breaking regression in 4.14-rc and 4.13.11]

2017-11-14 Thread Rasmus Villemoes
On 14 November 2017 at 00:54, Linus Torvalds wrote: > On Mon, Nov 13, 2017 at 3:30 PM, Linus Torvalds > wrote: >> >> So let's just rewrite that mnt_flags conversion that way, justr to get >> gcc to generate the obvious code. > > Oh wow. I tried to do the same thing in fs/namespace.c where it does

Re: bit tweaks [was: Re: [nfsd4] potentially hardware breaking regression in 4.14-rc and 4.13.11]

2017-11-14 Thread Rasmus Villemoes
On 14 November 2017 at 23:43, Linus Torvalds wrote: > On Tue, Nov 14, 2017 at 2:24 PM, Rasmus Villemoes > wrote: >> >> Can you be more specific? That's not what I see with gcc 7.1. > > I have gcc-7.2.1, and it made a horrible mess of the do_mount() code. Odd. 7.

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

2017-10-27 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

[PATCH] genirq: __setup_irq(): fix type of literal 1 in shift

2017-10-30 Thread Rasmus Villemoes
d_mask being a single bit; it's all whole-sale |= and &=). However, a sufficiently aggressive optimizer may use the UB of 1<<31 to decide that doesn't happen, and hence elide the sign-extension code, so that subsequent calls can indeed get ffz > 31. In any case, this is the righ

Re: [PATCH] string: Improve the generic strlcpy() implementation

2015-10-05 Thread Rasmus Villemoes
On Mon, Oct 05 2015, Ingo Molnar wrote: > * Linus Torvalds wrote: > >> So I finally pulled it. I like the patch, I like the new interface, >> but despite that I wasn't really sure if I wanted to pull it in - thus >> the long delay of me just seeing this in my list of pending pulls for >> almost

[PATCH v2 2/6] kernel/cpu.c: change type of cpu_possible_bits and friends

2015-10-06 Thread Rasmus Villemoes
indirection through the cpu_xyz_mask variables. Acked-by: Rusty Russell Signed-off-by: Rasmus Villemoes --- kernel/cpu.c | 44 ++-- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 82cf9dff4295..fea4a3ce3011

[PATCH v2 5/6] kernel/cpu.c: eliminate cpu_*_mask

2015-10-06 Thread Rasmus Villemoes
Replace the variables cpu_possible_mask, cpu_online_mask, cpu_present_mask and cpu_active_mask with macros expanding to expressions of the same type and value, eliminating some indirection. Acked-by: Rusty Russell Signed-off-by: Rasmus Villemoes --- include/linux/cpumask.h | 8 kernel

[PATCH v2 4/6] drivers/base/cpu.c: use __cpu_*_mask directly

2015-10-06 Thread Rasmus Villemoes
Russell Acked-by: Greg Kroah-Hartman Signed-off-by: Rasmus Villemoes --- drivers/base/cpu.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 91bbb1959d8d..691eeea2f19a 100644 --- a/drivers/base/cpu.c +++ b/drivers/base

[PATCH v2 6/6] kernel/cpu.c: make set_cpu_* static inlines

2015-10-06 Thread Rasmus Villemoes
Almost all callers of the set_cpu_* functions pass an explicit true or false. Making them static inline thus replaces the function calls with a simple set_bit/clear_bit, saving some .text. Acked-by: Rusty Russell Signed-off-by: Rasmus Villemoes --- include/linux/cpumask.h | 43

[PATCH v2 3/6] kernel/cpu.c: export __cpu_*_mask

2015-10-06 Thread Rasmus Villemoes
Exporting the cpumasks __cpu_possible_mask and friends will allow us to remove the extra indirection through the cpu_*_mask variables. It will also allow the set_cpu_* functions to become static inlines, which will give a .text reduction. Acked-by: Rusty Russell Signed-off-by: Rasmus Villemoes

[PATCH v2 0/6] kernel/cpu.c: eliminate some indirection

2015-10-06 Thread Rasmus Villemoes
riate immediate address into %rdi before each call. [1] See Rusty's kind explanation http://thread.gmane.org/gmane.linux.kernel/2047078/focus=2047722 for some historic context. Rasmus Villemoes (6): powerpc/fadump: rename cpu_online_mask member of struct fadump_crash_info_header kernel/c

Re: [PATCH 1/2] scsi: move Additional Sense Codes to separate file

2015-10-06 Thread Rasmus Villemoes
On Mon, Oct 05 2015, Bart Van Assche wrote: > On 10/05/15 02:26, Rasmus Villemoes wrote: >> -{0x041A, "Logical unit not ready, start stop unit command in " >> - "progress"}, >> -{0x041B, "Logical unit not ready, sanitize in progre

Re: [PATCH 2/2] scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k

2015-10-06 Thread Rasmus Villemoes
On Mon, Oct 05 2015, Bart Van Assche wrote: > On 10/05/15 02:26, Rasmus Villemoes wrote: >> struct error_info { >> unsigned short code12; /* 0x0302 looks better than 0x03,0x02 */ >> -const char * text; >> +unsigned short size; >> }; >

Re: RFC: reduce CONFIG_SCSI_CONSTANTS impact by 4k

2015-10-06 Thread Rasmus Villemoes
On Tue, Oct 06 2015, Julian Calaby wrote: > Hi Rasmus, > >> >> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c >> index 47aaccd5e68e..ccd34b0481cd 100644 >> --- a/drivers/scsi/constants.c >> +++ b/drivers/scsi/constants.c >> @@ -292,17 +292,31 @@ bool scsi_opcode_sa_name(int opco

[PATCH v2 1/6] powerpc/fadump: rename cpu_online_mask member of struct fadump_crash_info_header

2015-10-06 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- arch/powerpc/include/asm/fadump.h | 2 +- arch/powerpc/kernel/fadump.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h index 493e72f64b35..b4407d0add27 100644

Re: [PATCH 1/2] x86: dumpstack, use pr_cont

2015-10-06 Thread Rasmus Villemoes
On Tue, Oct 06 2015, Jiri Slaby wrote: > When dumping flags with which the kernel was built, we print them one > by one in separate printks. Let's use pr_cont as they are > continuation prints. > > Signed-off-by: Jiri Slaby > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > Cc:

[PATCH 1/2] linux/kconfig.h: generalize IS_ENABLED logic

2015-10-06 Thread Rasmus Villemoes
suggest better names, and/or to flame this idea to death. Signed-off-by: Rasmus Villemoes --- include/linux/kconfig.h | 75 + 1 file changed, 75 insertions(+) diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index b33c7797eb57..ac209

[PATCH 2/2] x86: dumpstack: eliminate some #ifdefs

2015-10-06 Thread Rasmus Villemoes
Jiri Slaby noted that these #ifdef protected printks should really be pr_cont. However, we might as well get completely rid of both the multiple printk calls and the tiny #ifdef sections by just building an appropriate string and passing that to the first printk call. Signed-off-by: Rasmus

Re: [PATCH] string: Improve the generic strlcpy() implementation

2015-10-06 Thread Rasmus Villemoes
On Tue, Oct 06 2015, Ingo Molnar wrote: > * Rasmus Villemoes wrote: > >> >> I'm not against making strlcpy more robust, but I think the theoretical race >> is >> far more likely to manifest through a member of the printf family. > > So the printf fa

Re: [PATCH] string: Improve the generic strlcpy() implementation

2015-10-07 Thread Rasmus Villemoes
On Wed, Oct 07 2015, Ingo Molnar wrote: > We have procfs and sysfs as well, where format strings are indeed dominant, > but > are you sure this race exists in snprintf() in that form? I.e. can the return > value of snprintf() be different from the true length of the output string, > if the >

Re: [PATCH 1/2] linux/kconfig.h: generalize IS_ENABLED logic

2015-10-07 Thread Rasmus Villemoes
On Wed, Oct 07 2015, Michal Marek wrote: > On 2015-10-06 23:05, Rasmus Villemoes wrote: >> It's not hard to generalize the macro magic used to build the >> IS_ENABLED macro and friends to produce a few other potentially useful >> macros: >> >> CHOOSE_EXPR(C

Re: [PATCH] lib: Make _find_next_bit helper function inline

2015-08-30 Thread Rasmus Villemoes
I've lost track of what's up and down in this, but now that I look at this again let me throw in my two observations of stupid gcc behaviour: For the current code, both debian's gcc (4.7) and 5.1 partially inlines _find_next_bit, namely the "if (!nbits || start >= nbits)" test. I know it does it to

[PATCH] linux/clock_cooling.h: use unique include guard

2015-10-12 Thread Rasmus Villemoes
Using the same include guard as linux/cpu_cooling.h will cause build breakage if those headers are ever used from the same TU. Signed-off-by: Rasmus Villemoes --- include/linux/clock_cooling.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux

[PATCH 1/4] net: cavium: liquidio: use kzalloc in setup_glist()

2015-09-09 Thread Rasmus Villemoes
We save a little .text and get rid of the sizeof(...) style inconsistency. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/cavium/liquidio/lio_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net

[PATCH 3/4] net: mv643xx_eth: use kzalloc

2015-09-09 Thread Rasmus Villemoes
The double memset is a little ugly; using kzalloc avoids it altogether. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/marvell/mv643xx_eth.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet

[PATCH 0/4] net: a few kzalloc/memset cleanups

2015-09-09 Thread Rasmus Villemoes
These are just a few k[czm]alloc/memset related cleanups. Rasmus Villemoes (4): net: cavium: liquidio: use kzalloc in setup_glist() net: jme: use kzalloc() instead of kmalloc+memset net: mv643xx_eth: use kzalloc net: qlcnic: delete redundant memsets drivers/net/ethernet/cavium/liquidio

[PATCH 2/4] net: jme: use kzalloc() instead of kmalloc+memset

2015-09-09 Thread Rasmus Villemoes
Using kzalloc saves a tiny bit on .text. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/jme.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 6e9a792097d3..060dd3922974 100644 --- a/drivers/net

[PATCH 4/4] net: qlcnic: delete redundant memsets

2015-09-09 Thread Rasmus Villemoes
In all cases, mbx->req.arg and mbx->rsp.arg have just been allocated using kcalloc(), so these six memsets are redundant. Signed-off-by: Rasmus Villemoes --- I cranked $context_lines to 11 to make the kcallocs visible. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 2 -- d

Re: [PATCH 3/4] net: mv643xx_eth: use kzalloc

2015-09-09 Thread Rasmus Villemoes
On Wed, Sep 09 2015, Joe Perches wrote: > On Wed, 2015-09-09 at 10:38 +0200, Rasmus Villemoes wrote: >> The double memset is a little ugly; using kzalloc avoids it altogether. > [] >> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c >> b/drivers/net/ethern

Re: [PATCH] lib/vsprintf.c: increase the size of the field_width variable

2015-09-09 Thread Rasmus Villemoes
On Wed, Sep 09 2015, Joe Perches wrote: > On Wed, 2015-09-09 at 12:13 +0200, Maurizio Lombardi wrote: >> When printing a bitmap using the "%*pb[l]" printk format >> a 16 bit variable (field_width) is used to store the size of the bitmap. >> In some cases 16 bits are not sufficient, the variable o

[PATCH] tracing: use kstrdup_const instead of private implementation

2015-09-09 Thread Rasmus Villemoes
f a static char (but non-const) array. Signed-off-by: Rasmus Villemoes --- kernel/trace/trace_events.c | 24 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 7ca09cdc20c2..ae97d73b31fa 100644 ---

[PATCH] trace/ftrace.c: remove redundant swap function

2015-09-09 Thread Rasmus Villemoes
let sort() pick an appropriate and fast swap callback. Signed-off-by: Rasmus Villemoes --- kernel/trace/ftrace.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index b0623ac785a2..186bafa9935d 100644 --- a/kernel

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

2015-09-09 Thread Rasmus Villemoes
__futex_data> : c3 retq : 0f 1f 00nopl (%rax) Signed-off-by: Rasmus Villemoes --- Resending since this was never picked up - and I assume it's actually ok. Also, this time the alignment is spelled 2*sizeof(long) to avoid wasting 8 bytes

[PATCH] lib/dynamic_debug.c: use kstrdup_const

2015-09-09 Thread Rasmus Villemoes
Using kstrdup_const, thus reusing .rodata when possible, saves around 2 kB of runtime memory on my laptop/.config combination. Signed-off-by: Rasmus Villemoes --- lib/dynamic_debug.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib

[PATCH] PM / wakeup: wakeup_source_create: use kstrdup_const

2015-09-09 Thread Rasmus Villemoes
Using kstrdup_const allows us to save a little runtime memory (and a string copy) in the common case where name is a string literal. Signed-off-by: Rasmus Villemoes --- drivers/base/power/wakeup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power

[PATCH 1/2] lib: introduce kvasprintf_const

2015-09-09 Thread Rasmus Villemoes
nstead use kstrdup_const directly (which would also require one to change all corresponding kfree calls to kfree_const). Signed-off-by: Rasmus Villemoes --- include/linux/kernel.h | 2 ++ lib/kasprintf.c| 16 2 files changed, 18 insertions(+) diff --git a/include/linux/kernel.h

[PATCH 2/2] kobject: use kvasprintf_const for formatting ->name

2015-09-09 Thread Rasmus Villemoes
be quadrupled when KMALLOC_SHIFT_LOW==5. Whether these numbers are sufficient to justify the ugliness I'll leave to others to decide. Signed-off-by: Rasmus Villemoes --- lib/kobject.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/kob

[PATCH 3/3] ACPI / scan: use kstrdup_const in acpi_add_id()

2015-09-09 Thread Rasmus Villemoes
Empirically, acpi_add_id is mostly called with string literals, so using kstrdup_const for initializing struct acpi_hardware_id::id saves a little run-time memory and a string copy. Signed-off-by: Rasmus Villemoes --- drivers/acpi/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH 2/3] ACPI: constify struct acpi_hardware_id::id

2015-09-09 Thread Rasmus Villemoes
This is preparation for using kstrdup_const to initialize that member. Signed-off-by: Rasmus Villemoes --- drivers/acpi/scan.c| 4 ++-- drivers/pnp/pnpacpi/core.c | 4 ++-- include/acpi/acpi_bus.h| 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/acpi

[PATCH 1/3] ACPI: constify first argument of struct acpi_scan_handler::match

2015-09-09 Thread Rasmus Villemoes
stifying struct acpi_hardware_id::id. Signed-off-by: Rasmus Villemoes --- drivers/acpi/acpi_pnp.c | 4 ++-- include/acpi/acpi_bus.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c index c58940b231d6..48fc3ad13a4b 100644 --- a/drivers/

[PATCH] x86: wmi: Remove private %pUL implementation

2015-09-09 Thread Rasmus Villemoes
so we can eliminate some stack buffers and quite a bit of code by just using %pUL directly. In wmi_dev_uevent I'm not sure whether there's room for a nul-terminator in env->buf, so I've just replaced wmi_gtoa with the equivalent sprintf call. Signed-off-by: Rasmus Villemoes ---

[PATCH] drm: sti: remove redundant sign extensions

2015-10-16 Thread Rasmus Villemoes
arg is long int, so arg = (arg << 22) >> 22 makes the upper 22 bits of arg equal to bit 9 (or bit 41). But we then mask away all but bits 0-9, so this is entirely redundant. Signed-off-by: Rasmus Villemoes --- gcc seems to be smart enough to realize this - the generated code is the s

[PATCH] mm/maccess.c: actually return -EFAULT from strncpy_from_unsafe

2015-10-17 Thread Rasmus Villemoes
, destination string. Signed-off-by: Rasmus Villemoes --- Probably not -stable-worthy. I can only find two callers, one of which ignores the return value. mm/maccess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/maccess.c b/mm/maccess.c index 34fe24759ed1..d318db246826 100644

[PATCH] intel: i40e: fix confused code

2015-10-17 Thread Rasmus Villemoes
at least we get rid of the dead code which pretended to check for access faults. Signed-off-by: Rasmus Villemoes --- There are other things worth looking at. i40e_dbg_netdev_ops_buf is a static buffer of size 256, which can be filled from user space (in i40e_dbg_netdev_ops_write). That function c

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

2015-10-17 Thread Rasmus Villemoes
On Tue, Oct 06 2015, Rasmus Villemoes wrote: > v2: fix build failure on ppc, add acks. Does anyone want to take these through their tree? Rasmus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More m

  1   2   3   4   5   6   7   8   9   10   >