[PATCH 04/10] dynamic_debug: introduce accessors for string members of struct _ddebug

2019-04-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 03/10] linux/printk.h: use unique identifier for each struct _ddebug

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

Re: [PATCH v1 bitops] bitops: Fix UBSAN undefined behavior warning for rotation right

2019-04-09 Thread Rasmus Villemoes
On 09/04/2019 10.08, Rasmus Villemoes wrote: > one could do > > u32 ror32(u32 x, unsigned s) > { > return (x >> (s&31)) | (x << ((32-s)&31)); > } > > to make the shifts always well-defined and also work as expected for s > >= 32... if onl

Re: [PATCH v1 bitops] bitops: Fix UBSAN undefined behavior warning for rotation right

2019-04-09 Thread Rasmus Villemoes
On 09/04/2019 00.52, Andrew Morton wrote: > (resend, cc Andrey) > > On Sun, 7 Apr 2019 12:53:25 + Vadim Pasternak > wrote: > >> The warning is caused by call to rorXX(), if the second parameters of >> this function "shift" is zero. In such case UBSAN reports the warning >> for the next

Re: [PATCH] overflow.h: Rename __ab_c_size() to __calc_size()

2019-04-06 Thread Rasmus Villemoes
On 06/04/2019 11.32, Borislav Petkov wrote: > On Fri, Apr 05, 2019 at 09:25:27AM -0700, Matthew Wilcox wrote: >> I don't think that's a good idea; we should only document functions we >> want other people to use. > > Yap. Exactly, not kernel-doc'ing was a deliberate choice. >> I could also go

Re: [PATCH] overflow.h: Rename __ab_c_size() to __calc_size()

2019-04-05 Thread Rasmus Villemoes
On 05/04/2019 09.52, Borislav Petkov wrote: > On Fri, Apr 05, 2019 at 08:26:45AM +0200, Rasmus Villemoes wrote: >> It computes a*b+c with overflow checking at each step. calc_size >> is way too generic and doesn't say anything at all about how the >> calc(ulation) is do

Re: [PATCH] overflow.h: Rename __ab_c_size() to __calc_size()

2019-04-05 Thread Rasmus Villemoes
On 05/04/2019 06.57, Borislav Petkov wrote: > From: Borislav Petkov > > ... to make its name readable to humans so that it can denote what that > helper does. I like the current color. It computes a*b+c with overflow checking at each step. calc_size is way too generic and doesn't say anything

Re: [PATCH 1/5] lib: make bitmap_parselist_user() a wrapper on bitmap_parselist()

2019-04-03 Thread Rasmus Villemoes
On 03/04/2019 13.17, Andy Shevchenko wrote: > On Wed, Apr 03, 2019 at 02:15:22PM +0300, Andy Shevchenko wrote: >> On Wed, Apr 03, 2019 at 07:45:36AM +0300, Yury Norov wrote: >>> Currently we parse user data byte after byte which leads to >>> overcomplification of parsing algorithm. The only user

Re: [PATCH v2] ubsan: Avoid unnecessary 128-bit shifts

2019-04-03 Thread Rasmus Villemoes
On 03/04/2019 07.45, George Spelvin wrote: > > diff --git a/lib/ubsan.c b/lib/ubsan.c > index e4162f59a81c..a7eb55fbeede 100644 > --- a/lib/ubsan.c > +++ b/lib/ubsan.c > @@ -89,8 +89,8 @@ static bool is_inline_int(struct type_descriptor *type) > static s_max get_signed_val(struct type_descriptor

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Rasmus Villemoes
On 02/04/2019 17.48, Thomas Gleixner wrote: > On Tue, 2 Apr 2019, Josh Poimboeuf wrote: >> On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: >>> +/* >>> + * Array of exception stack page descriptors. If the stack is larger than >>> + * PAGE_SIZE, all pages covering a particular

Re: [RFC PATCH 0/4] spi: spi-fsl-spi: try to make cpu-mode transfers faster

2019-04-02 Thread Rasmus Villemoes
On 01/04/2019 09.34, Mark Brown wrote: > On Wed, Mar 27, 2019 at 02:30:48PM +0000, Rasmus Villemoes wrote: >> I doubt patches 3 and 4 are acceptable, but I'd still like to get >> comments and/or alternative suggestions for making large transfers >> faster. > > I se

Re: [RFCv2] string: Use faster alternatives when constant arguments are used

2019-04-02 Thread Rasmus Villemoes
On 02/04/2019 01.55, Sultan Alsawaf wrote: > On Mon, Apr 01, 2019 at 10:43:13PM +0200, Rasmus Villemoes wrote: >> No. First, these are concerns for all arches. Second, if you can find >> some particular place where string parsing/matching is in any way >> performance relev

Re: [PATCH 0/5] simple sort swap function usage improvements

2019-04-01 Thread Rasmus Villemoes
[trimming cc list] On 30/03/2019 18.16, George Spelvin wrote: > Great work; that is indeed a logical follow-on. > > Reviewed by: George Spelvin > > I you feel even more ambitious, you could try impementing Rasmus > Villemoes' idea of having generic *compare* functions. (

Re: [RFCv2] string: Use faster alternatives when constant arguments are used

2019-04-01 Thread Rasmus Villemoes
On 30/03/2019 23.59, Sultan Alsawaf wrote: > How can the memcmps cross a page boundary when memcmp itself will > only read in large buffers of data at word boundaries? Consider your patch replacing !strcmp(buf, "123") by !memcmp(buf, "123", 4). buf is known to point to a nul-terminated string.

Re: PATCH 2/2] lib/bitmap.c: guard exotic bitmap functions by CONFIG_NUMA

2019-04-01 Thread Rasmus Villemoes
On 30/03/2019 19.54, Yury Norov wrote: > Hi Rasmus! > >> From: Rasmus Villemoes >> Sent: Saturday, March 30, 2019 12:53:51 AM >> To: Rasmus Villemoes; Andrew Morton; Andy Shevchenko >> Cc: Yury Norov; linux-kernel@vger.kernel.org >> Subject: [PATCH 2/

[PATCH 1/2] lib/bitmap.c: remove unused EXPORT_SYMBOLs

2019-03-29 Thread Rasmus Villemoes
currently. Signed-off-by: Rasmus Villemoes --- lib/bitmap.c | 4 1 file changed, 4 deletions(-) diff --git a/lib/bitmap.c b/lib/bitmap.c index 98872e9025da..66421f304f7d 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -757,7 +757,6 @@ void bitmap_remap(unsigned long *dst, const unsigned long

[PATCH 2/2] lib/bitmap.c: guard exotic bitmap functions by CONFIG_NUMA

2019-03-29 Thread Rasmus Villemoes
% Signed-off-by: Rasmus Villemoes --- lib/bitmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/bitmap.c b/lib/bitmap.c index 66421f304f7d..3f3b8051f342 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -649,6 +649,7 @@ int bitmap_parselist_user(const char __user *ubuf, EXPORT_SYMBOL

Re: [PATCH v2 1/6] leds: netdev trigger: use memcpy in device_name_store

2019-03-27 Thread Rasmus Villemoes
On 27/03/2019 22.20, Jacek Anaszewski wrote: > Thanks for the heads-up. I must admit I'm hitting into that for the > first time. After "git am" it was all OK, but it got screwed up after > "git rebase -i". And having "commit.cleanup = scissors" set globally all > the time is annoying if one

Re: [PATCH v2 1/6] leds: netdev trigger: use memcpy in device_name_store

2019-03-27 Thread Rasmus Villemoes
On 26/03/2019 20.53, Jacek Anaszewski wrote: > Hi Rasmus, > > Thank you for the patch. > > On 3/14/19 3:06 PM, Rasmus Villemoes wrote: >> If userspace doesn't end the input with a newline (which can easily >> happen if the write happens from a C program that does write

[RFC PATCH 4/4] spi: spi-fsl-spi: automatically adapt bits-per-word in cpu mode

2019-03-27 Thread Rasmus Villemoes
tra fsl_spi_setup_transfer() calls this causes. Signed-off-by: Rasmus Villemoes --- drivers/spi/spi-fsl-spi.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index e2b341943796..b36ac6aa3b1f 100644 --- a/drivers/spi/spi-fsl-sp

[RFC PATCH 2/4] spi: spi-fsl-spi: relax message sanity checking a little

2019-03-27 Thread Rasmus Villemoes
we can change it to follow the same logic as is used by the actual transfer loop. Signed-off-by: Rasmus Villemoes --- drivers/spi/spi-fsl-spi.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 6d114daa1

[RFC PATCH 0/4] spi: spi-fsl-spi: try to make cpu-mode transfers faster

2019-03-27 Thread Rasmus Villemoes
not observed any problems, but to completely rule out the possibility of "glitches on SPI CLK" mentioned in patch 3 would of course require testing on a much wider set of hardware combinations. Rasmus Villemoes (4): spi: spi-fsl-spi: remove always-true conditional in fsl_spi_do_one_msg spi: s

[RFC PATCH 1/4] spi: spi-fsl-spi: remove always-true conditional in fsl_spi_do_one_msg

2019-03-27 Thread Rasmus Villemoes
__spi_validate() in the generic SPI code sets ->speed_hz and ->bits_per_word to non-zero values, so this condition is always true. Signed-off-by: Rasmus Villemoes --- This of course relies on no spi_message reaching ->transfer_one_message without having been through __spi_validate.

[RFC PATCH 3/4] spi: spi-fsl-spi: allow changing bits_per_word while CS is still active

2019-03-27 Thread Rasmus Villemoes
won't appear. The purpose of this change is to allow automatically optimizing large transfers to use 32 bits-per-word; taking one interrupt for every byte is extremely slow. Signed-off-by: Rasmus Villemoes --- drivers/spi/spi-fsl-spi.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions

Re: [PATCH v2 6/6] lib/vsprintf: Add %pfw conversion specifier for printing fwnode names

2019-03-26 Thread Rasmus Villemoes
On 26/03/2019 13.41, Sakari Ailus wrote: > Add support for %pfw conversion specifier (with "f" and "P" modifiers) to > support printing full path of the node, including its name ("f") and only > the node's name ("P") in the printk family of functions. The two flags > have equivalent functionality

Re: [PATCH 14/17] crypto: Don't mark AES tables const and cacheline_aligned

2019-03-26 Thread Rasmus Villemoes
On 21/03/2019 23.00, Andi Kleen wrote: > From: Andi Kleen > > cacheline_aligned is a special section. It cannot be const at the same > time because it's not read-only. It doesn't give any MMU protection. Urgh. Perhaps this instead just wanted to use the quadruple underscore version,

Re: [PATCH] Change in comment for the list_empty() routine.

2019-03-26 Thread Rasmus Villemoes
On 26/03/2019 07.21, Nitin U. Yewale wrote: > Hello, > > In one of the observations it was noticed that list_empty() routine > returns true when the list is empty (head->next == head) OR False > otherwise. Hence the proposed patch. Hm, does anything use that file? It's almost impossible to have

Re: [RFCv2] string: Use faster alternatives when constant arguments are used

2019-03-25 Thread Rasmus Villemoes
On 24/03/2019 23.32, Sultan Alsawaf wrote: > On Sun, Mar 24, 2019 at 10:17:49PM +0100, Rasmus Villemoes wrote: >> gcc already knows the semantics of these functions and can optimize >> accordingly. E.g. for strcpy() of a literal to a buffer, gcc readily >> compiles >

Re: [RFCv2] string: Use faster alternatives when constant arguments are used

2019-03-24 Thread Rasmus Villemoes
On 24/03/2019 03.24, Sultan Alsawaf wrote: > I messed up the return value for strcat in the first patch. Here's a fixed > version, ready for some scathing reviews. > > From: Sultan Alsawaf > > When strcpy, strcat, and strcmp are used with a literal string, they can > be optimized to memcpy or

[tip:timers/core] timekeeping: Consistently use unsigned int for seqcount snapshot

2019-03-23 Thread tip-bot for Rasmus Villemoes
Commit-ID: e1e41b6ce5f9c1a80bf4f2404ec5ab11c6c5a2ad Gitweb: https://git.kernel.org/tip/e1e41b6ce5f9c1a80bf4f2404ec5ab11c6c5a2ad Author: Rasmus Villemoes AuthorDate: Mon, 18 Mar 2019 20:55:56 +0100 Committer: Thomas Gleixner CommitDate: Sat, 23 Mar 2019 11:43:56 +0100 timekeeping

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

2019-03-22 Thread Rasmus Villemoes
On 21/03/2019 18.02, Nick Desaulniers wrote: > On Wed, Mar 20, 2019 at 7:11 PM Andrew Morton > wrote: >> > > Further, I can drop some of the __GNUC__ < 4 code in > arch/x86/include/asm/string_32.h. Already on its way to Linus:

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

2019-03-20 Thread Rasmus Villemoes
- 14 +14 ftrace_mod_callback 577 542 -35 tracing_mark_raw_write 444 374 -70 tracing_mark_write 616 540 -76 trace_default_header 600 406 -194 Signed-off-by:

Re: [RESEND PATCH v2 0/5] lib/sort & lib/list_sort: faster and smaller

2019-03-19 Thread Rasmus Villemoes
On 19/03/2019 09.15, George Spelvin wrote: > > Because CONFIG_RETPOLINE has made indirect calls much more expensive, > I thought I'd try to reduce the number made by the library sort > functions. For the series, Acked-by: Rasmus Villemoes and let's have more commits with s

[PATCH v2/resend] tracing: eliminate const char[] auto variables

2019-03-18 Thread Rasmus Villemoes
mark_write 616 540 -76 trace_default_header 600 523 -77 Signed-off-by: Rasmus Villemoes --- Hi Steven I didn't get any response to this; just let me know if you don't want this kind of microoptimization patches. v2: update change log with stac

[PATCH] timekeeping: consistently use unsigned int for seqcount snapshot

2019-03-18 Thread Rasmus Villemoes
The timekeeping code uses a random mix of "unsigned long" and "unsigned int" for the seqcount snapshots (ratio 14:12). Since the seqlock.h API is entirely based on unsigned (int), use that throughout. Signed-off-by: Rasmus Villemoes --- kernel/time/jiffies.c

Re: [PATCH] spi: spi-fsl-spi: support use of the SPISEL_BOOT signal on MPC8309

2019-03-18 Thread Rasmus Villemoes
ping On 06/03/2019 11.32, Rasmus Villemoes wrote: > The MPC8309 has a dedicated signal, SPISEL_BOOT, usually used as chip > select for the flash device from which the bootloader is loaded. It is > not an ordinary gpio, but is simply controlled via the SPI_CS register > in the system c

Re: [PATCH v2 6/6] leds: netdev trigger: allow setting initial values in device tree

2019-03-14 Thread Rasmus Villemoes
On 14/03/2019 15.24, Jacek Anaszewski wrote: > Rasmus, > > Thank you for the update. > Still, there is one thing to improve. > >>   static int netdev_trig_activate(struct led_classdev *led_cdev) >>   { >>   struct led_netdev_data *trigger_data; >> @@ -423,6 +451,8 @@ static int

[PATCH v2 3/6] leds: netdev trigger: move newline handling back to device_name_store

2019-03-14 Thread Rasmus Villemoes
have to stash the original value of size. Signed-off-by: Rasmus Villemoes --- drivers/leds/trigger/ledtrig-netdev.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index 21605033e322

[PATCH v2 6/6] leds: netdev trigger: allow setting initial values in device tree

2019-03-14 Thread Rasmus Villemoes
CONFIG_CAN_LEDS. The example added to common.txt corresponds to switching linux,default-trigger = "can0-rxtx" to "netdev" and adding the indicated netdev subnode. Signed-off-by: Rasmus Villemoes --- .../devicetree/bindings/leds/common.txt | 11 +++ drivers/leds/trig

[PATCH v2 1/6] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Rasmus Villemoes
to strip a trailing newline. This is also preparation for future patches. Signed-off-by: Rasmus Villemoes --- drivers/leds/trigger/ledtrig-netdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netde

[PATCH v2 4/6] leds: netdev trigger: move name length checking to netdev_trig_set_device

2019-03-14 Thread Rasmus Villemoes
by the set_baseline_state() call. Signed-off-by: Rasmus Villemoes --- drivers/leds/trigger/ledtrig-netdev.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index c35439291424..e4a76ce4e4c7 100644

[PATCH v2 5/6] leds: netdev trigger: add documentation to leds/common.txt

2019-03-14 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 | 3 +

[PATCH v2 2/6] leds: netdev trigger: factor out middle part of device_name_store

2019-03-14 Thread Rasmus Villemoes
. Signed-off-by: Rasmus Villemoes --- drivers/leds/trigger/ledtrig-netdev.c | 30 --- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index 8d476b92f58c..21605033e322 100644

[PATCH v2 0/6] leds: netdev trigger: allow setting initial values in device tree

2019-03-14 Thread Rasmus Villemoes
allowing echoing 15-character names to device_name * ensure the length checking is done in one place [Uwe] * drop hunk from CAN Kconfig file for now [Uwe] * don't mention CONFIG_CAN_LEDS in device tree binding [Uwe] * guard netdev_trig_of_init by LED_INIT_DEFAULT_TRIGGER bit [Jacek] Rasmus

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

2019-03-14 Thread Rasmus Villemoes
On 14/03/2019 10.57, David Laight wrote: > From: Nick Desaulniers >> Sent: 13 March 2019 21:14 > ... >> diff --git a/include/linux/string.h b/include/linux/string.h >> index 7927b875f80c..6ab0a6fa512e 100644 >> --- a/include/linux/string.h >> +++ b/include/linux/string.h >> @@ -150,6 +150,9 @@

Re: [PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Rasmus Villemoes
On 14/03/2019 11.14, Pavel Machek wrote: > Hi! > >> If userspace doesn't end the input with a newline (which can easily >> happen if the write happens from a C program that does write(fd, >> iface, strlen(iface))), we may end up including garbage from a >> previous, longer value in the

Re: [PATCH 2/4] leds: netdev trigger: factor out middle part of device_name_store

2019-03-14 Thread Rasmus Villemoes
On 14/03/2019 10.31, Uwe Kleine-König wrote: > Hello, > > On Wed, Mar 13, 2019 at 09:26:13PM +0100, Rasmus Villemoes wrote: >> +static void set_device(struct led_netdev_data *trigger_data, >> + const char *buf, size_t size) > > "set_device&

Re: [PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-14 Thread Rasmus Villemoes
On 14/03/2019 10.29, Uwe Kleine-König wrote: > Hello, > > On Wed, Mar 13, 2019 at 09:26:12PM +0100, Rasmus Villemoes wrote: >> --- a/drivers/leds/trigger/ledtrig-netdev.c >> +++ b/drivers/leds/trigger/ledtrig-netdev.c >> @@ -122,7 +122,8 @@ static ssize_t device_na

Re: [PATCH 2/5] lib/sort: Use more efficient bottom-up heapsort variant

2019-03-13 Thread Rasmus Villemoes
On 14/03/2019 01.03, George Spelvin wrote: > On Wed, 13 Mar 2019 at 23:29:40 +0100, Rasmus Villemoes wrote: > >> Nice! > > Thank you. May I translate that into Acked-by? > Sort-of. I prefer first seeing the full rerolled series for context etc., even if (the important

Re: [PATCH 5/5] lib/list_sort: Optimize number of calls to comparison function

2019-03-13 Thread Rasmus Villemoes
On 05/03/2019 06.58, George Spelvin wrote: > CONFIG_RETPOLINE has severely degraded indirect function call > performance, so it's worth putting some effort into reducing > the number of times cmp() is called. > > This patch avoids badly unbalanced merges on unlucky input sizes. > It slightly

Re: [PATCH 2/5] lib/sort: Use more efficient bottom-up heapsort variant

2019-03-13 Thread Rasmus Villemoes
On 21/02/2019 09.21, George Spelvin wrote: > > +/** > + * parent - given the offset of the child, find the offset of the parent. > + * @i: the offset of the heap element whose parent is sought. Non-zero. > + * @lsbit: a precomputed 1-bit mask, equal to "size & -size" > + * @size: size of each

Re: [PATCH 1/5] lib/sort: Make swap functions more generic

2019-03-13 Thread Rasmus Villemoes
On 21/02/2019 07.30, George Spelvin wrote: > Rather than u32_swap and u64_swap working on 4- and 8-byte objects > directly, let them handle any multiple of 4 or 8 bytes. This speeds > up most users of sort() by avoiding fallback to the byte copy loop. > > Despite what commit ca96ab859ab4

[PATCH 0/4] leds: netdev trigger: allow setting initial values in device tree

2019-03-13 Thread Rasmus Villemoes
away from the deprecated CONFIG_CAN_LEDS. Rasmus Villemoes (4): leds: netdev trigger: use memcpy in device_name_store leds: netdev trigger: factor out middle part of device_name_store leds: netdev trigger: add documentation to leds/common.txt leds: netdev trigger: allow setting initial values

[PATCH 1/4] leds: netdev trigger: use memcpy in device_name_store

2019-03-13 Thread Rasmus Villemoes
to strip a trailing newline. This is also preparation for future patches. Signed-off-by: Rasmus Villemoes --- drivers/leds/trigger/ledtrig-netdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netde

[PATCH 2/4] leds: netdev trigger: factor out middle part of device_name_store

2019-03-13 Thread Rasmus Villemoes
. Signed-off-by: Rasmus Villemoes --- drivers/leds/trigger/ledtrig-netdev.c | 30 --- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index ddc2b90ad7ec..55153a7e8433 100644

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

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

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:

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

2019-03-12 Thread Rasmus Villemoes
d vice 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

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

2019-03-12 Thread Rasmus Villemoes
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 7577755bdcf4

[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: Rasmus Villem

[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 0/4] irqchip/gic-v3-its: free_lpi_range tweaks

2019-03-12 Thread Rasmus Villemoes
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: fix comparison

replacement for CAN_LEDS

2019-03-11 Thread Rasmus Villemoes
Hi I'm in the process of upgrading an old BSP to a 4.19 kernel, and noticed that CAN_LEDS has been marked broken. The comments say that the netdev trigger can do everything, but doesn't provide much guidance on how to actually do the transition. In my case, I used to have a device tree node

Re: [PATCH] static_assert: move before people start using it

2019-03-10 Thread Rasmus Villemoes
On 10/03/2019 22.30, Alexey Dobriyan wrote: > and BUILD_BUG is bad). Once everything is converted to static_assert(), That will never happen, because the two are not interchangeable [ignoring the churn it would involve]. BUILD_BUG_ON can eat expressions which static_assert won't (e.g.

Re: [PATCH 4/5] lib/list_sort: Simplify and remove MAX_LIST_LENGTH_BITS

2019-03-10 Thread Rasmus Villemoes
On 05/03/2019 04.06, George Spelvin wrote: > * The comparison function @cmp must return a negative value if @a > * should sort before @b, and a positive value if @a should sort after > * @b. If @a and @b are equivalent, and their original relative > * ordering is to be preserved, @cmp

Re: [PATCH] static_assert: move before people start using it

2019-03-10 Thread Rasmus Villemoes
On 10/03/2019 11.51, Alexey Dobriyan wrote: > Userspace places static_assert() macro at > So? That seems a rather weak argument. We have lots of interfaces that also exist in userspace which are not declared in similar-named headers (e.g. we have no stdio.h, which is where snprintf lives). Not

Re: [PATCH v1 2/6] lib: scanf: handle integer overflows in vsscanf

2019-03-10 Thread Rasmus Villemoes
On 10/03/2019 17.56, Konstantin Khlebnikov wrote: > Traditional scanf implementations ignore integer overflows because > C language standard allows here undefined behavior (§7.21.6.2 #10). > > So, sane and safe behavior wouldn't harm anything. > > This patch carefully checks integer overflows

Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1

2019-03-08 Thread Rasmus Villemoes
On 08/03/2019 16.53, Leon Romanovsky wrote: > On Fri, Mar 08, 2019 at 09:09:46AM +0100, Rasmus Villemoes wrote: >> On 08/03/2019 08.01, Leon Romanovsky wrote: >>> >>> Mathematical therm for discrete numbers greater or equal to zero is >>> "normal numb

Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1

2019-03-08 Thread Rasmus Villemoes
On 08/03/2019 08.01, Leon Romanovsky wrote: > > Mathematical therm for discrete numbers greater or equal to zero is > "normal numbers". Sorry, WHAT? "Normal" is used and abused for a lot of things in mathematics, but I have never heard it used that way. When attached to the word "number", it

Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1

2019-03-07 Thread Rasmus Villemoes
On 08/03/2019 01.08, Bart Van Assche wrote: > On Thu, 2019-03-07 at 08:18 +0100, Rasmus Villemoes wrote: >> On 07/03/2019 03.14, Bart Van Assche wrote: >>> On 3/6/19 5:24 PM, Jason Gunthorpe wrote: >>>>> >>>>> diff --git a/include/linux/o

Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1

2019-03-07 Thread Rasmus Villemoes
On 07/03/2019 18.12, Kees Cook wrote: > On Thu, Mar 7, 2019 at 9:02 AM Leon Romanovsky wrote: >> >> On Thu, Mar 07, 2019 at 08:52:51AM -0800, Kees Cook wrote: >>> On Thu, Mar 7, 2019 at 7:40 AM Leon Romanovsky wrote: On Thu, Mar 07, 2019 at 06:53:54AM -0800, Bart Van Assche wrote:

[PATCH] can: flexcan: bump FLEXCAN_TIMEOUT_US to 250

2019-03-07 Thread Rasmus Villemoes
typically shows values around 12-14, i.e. suggesting that it takes about 110-130 us for the LPM_ACK bit to appear. So a timeout value of about twice that seems reasonable. Signed-off-by: Rasmus Villemoes --- drivers/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH] spi: work around clang bug in SPI_BPW_RANGE_MASK()

2019-03-07 Thread Rasmus Villemoes
On 07/03/2019 11.56, Arnd Bergmann wrote: > Clang-8 evaluates both sides of a ?: expression to check for > valid arithmetic even in the side that is never taken. This > results in a build warning: > > drivers/spi/spi-sh-msiof.c:1052:24: error: shift count >= width of type >

Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1

2019-03-06 Thread Rasmus Villemoes
On 07/03/2019 03.14, Bart Van Assche wrote: > On 3/6/19 5:24 PM, Jason Gunthorpe wrote: >>> >>> diff --git a/include/linux/overflow.h b/include/linux/overflow.h >>> index 40b48e2133cb..8afe0c0ada6f 100644 >>> +++ b/include/linux/overflow.h >>> @@ -202,6 +202,24 @@ >>>     #endif /*

[PATCH] spi: spi-fsl-spi: support use of the SPISEL_BOOT signal on MPC8309

2019-03-06 Thread Rasmus Villemoes
the sysdev/fsl_soc.h and use of get_immrbase() (spi-fsl-lib.c already contains similar ifdeffery). Googling suggests that the MPC8306 is similar, with the SPI_CS register at the same offset. Signed-off-by: Rasmus Villemoes --- .../devicetree/bindings/spi/fsl-spi.txt | 4 ++ drivers/spi/spi

Re: [RFC PATCH] net: dsa: mv88e6xxx: support single chip sw_addr offset

2019-03-05 Thread Rasmus Villemoes
On 04/03/2019 14.45, Andrew Lunn wrote: > On Mon, Mar 04, 2019 at 12:59:42PM +0000, Rasmus Villemoes wrote: >> From: Per Noergaard Christensen >> >> The 88e6250 does not support multi-chip addressing. However, one can >> still have two of them on the same mdio bus, si

[RFC PATCH] net: dsa: mv88e6xxx: support single chip sw_addr offset

2019-03-04 Thread Rasmus Villemoes
p; !chip->info->multi_chip case from returning -EINVAL, it should not break existing setups. Signed-off-by: Per Noergaard Christensen [RV: reword commit message] Signed-off-by: Rasmus Villemoes --- drivers/net/dsa/mv88e6xxx/chip.c | 15 --- 1 file changed, 8 insertions(+), 7 dele

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

2019-03-01 Thread Rasmus Villemoes
to 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

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 >

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

[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

[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
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 changed, 12

[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 0/4] soc/fsl/qe: qe.c: cleanups and support for MPC8309

2019-02-28 Thread Rasmus Villemoes
to 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

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

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

2019-02-26 Thread Rasmus Villemoes
DT. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index 2ef6fc6487c1..185da4be3509 100644 --- a/drivers/soc/fsl/qe/qe.c +++ b/drivers/soc/fsl/qe/qe.c @@ -306,12 +306,2

Re: [PATCH 5/6] lib: Fix function documentation for strncpy_from_user

2019-02-25 Thread Rasmus Villemoes
On 22/02/2019 00.03, Kees Cook wrote: > On Thu, Feb 21, 2019 at 6:58 AM Rasmus Villemoes > wrote: >> >> On 21/02/2019 07.02, Kees Cook wrote: >> > >>> ... snprintf returns what it WOULD have written, much like strlcpy >>> above. At least snprin

Re: [PATCH 5/6] lib: Fix function documentation for strncpy_from_user

2019-02-21 Thread Rasmus Villemoes
On 21/02/2019 07.02, Kees Cook wrote: > P.S. Here's C string API Rant (I just had to get this out, please feel > free to ignore): I'll bite. First, it's "linux kernel string API", only some of string.h interfaces are in std C. Sure, none of those satisfy all use cases, but adding Yet Another One

[PATCH v4 03/14] linux/printk.h: use DYNAMIC_DEBUG_BRANCH in pr_debug_ratelimited

2019-02-12 Thread Rasmus Villemoes
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 77740a506ebb..02b5c115d89b 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -461,7 +461,7 @@ do

[PATCH v4 04/14] dynamic_debug: consolidate DEFINE_DYNAMIC_DEBUG_METADATA definitions

2019-02-12 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 b3419da1a776..b17725400f75 100644 --- a/include

[PATCH v4 00/14] various dynamic_debug patches

2019-02-12 Thread Rasmus Villemoes
rnel.org/r/20181009112013.14238-1-li...@rasmusvillemoes.dk Rasmus Villemoes (14): linux/device.h: use DYNAMIC_DEBUG_BRANCH in dev_dbg_ratelimited linux/net.h: use DYNAMIC_DEBUG_BRANCH in net_dbg_ratelimited linux/printk.h: use DYNAMIC_DEBUG_BRANCH in pr_debug_ratelimited dynamic_debug: c

[PATCH v4 01/14] linux/device.h: use DYNAMIC_DEBUG_BRANCH in dev_dbg_ratelimited

2019-02-12 Thread Rasmus Villemoes
-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 6cb4640b6160..b49b142c5d6a 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1548,7 +1548,7 @@ do

[PATCH v4 02/14] linux/net.h: use DYNAMIC_DEBUG_BRANCH in net_dbg_ratelimited

2019-02-12 Thread Rasmus Villemoes
-by: Rasmus Villemoes --- include/linux/net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/net.h b/include/linux/net.h index e0930678c8bf..651fca72286c 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -263,7 +263,7 @@ do

[PATCH v4 07/14] dynamic_debug: remove unused EXPORT_SYMBOLs

2019-02-12 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 214828c65625..7b76f43edaef 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -868,7 +868,6 @@ int ddebug_add_module(struct

[PATCH v4 08/14] dynamic_debug: move pr_err from module.c to ddebug_add_module

2019-02-12 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 2ad1b5239910..7b1d437c1ea6 100644 --- a/kernel/module.c +++ b/kernel

[PATCH v4 12/14] ACPI: use proper DYNAMIC_DEBUG_BRANCH macro

2019-02-12 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 v4 09/14] dynamic_debug: add static inline stub for ddebug_add_module

2019-02-12 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 v4 10/14] dynamic_debug: refactor dynamic_pr_debug and friends

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

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