Re: [PATCH v2 04/12] module: Add printk format to add module build ID to stacktraces

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 03.04, Stephen Boyd wrote: > @@ -2778,6 +2793,10 @@ static inline void layout_symtab(struct module *mod, > struct load_info *info) > static void add_kallsyms(struct module *mod, const struct load_info *info) > { > } > + > +static void init_build_id(struct module *mod, const struc

Re: [PATCH v2] editorconfig: Add automatic editor configuration file

2021-03-24 Thread Rasmus Villemoes
On 03/07/2020 14.29, Jonathan Corbet wrote: [doing a bit of necromancy here] > On Fri, 3 Jul 2020 00:31:43 -0700 > Danny Lin wrote: > >> EditorConfig is a standard for defining basic editor configuration in >> projects. There is support available for 47 code editors as of writing, >> including

Re: [PATCH] static_call: fix function type mismatch

2021-03-24 Thread Rasmus Villemoes
On 23/03/2021 08.47, Peter Zijlstra wrote: > On Mon, Mar 22, 2021 at 05:29:21PM -0400, Steven Rostedt wrote: >> On Mon, 22 Mar 2021 22:18:17 +0100 >> Arnd Bergmann wrote: >> >>> I think the code works correctly on all architectures we support because >>> both 'int' and 'long' are returned in a reg

Re: [PATCH] [v2] hinic: avoid gcc -Wrestrict warning

2021-03-24 Thread Rasmus Villemoes
-qualified argument 1 was declared here > 464 | char set_link_str[SET_LINK_STR_MAX_LEN] = {0}; > > Rewrite this to avoid the nested sprintf and instead use separate > buffers, which is simpler. > This looks much better. Thanks. > Cc: Rasmus Villemoes > Signed-off-by: Arnd Be

Re: [PATCH] amdgpu: fix gcc -Wrestrict warning

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 14.33, Arnd Bergmann wrote: > On Tue, Mar 23, 2021 at 4:57 PM Rasmus Villemoes > wrote: >> On 23/03/2021 14.04, Arnd Bergmann wrote: >>> if (securedisplay_cmd->status == >>> TA_SECUREDISPLAY_STATUS__SUCCESS) { >>>

Re: [PATCH v3 02/17] cfi: add __cficanonical

2021-03-24 Thread Rasmus Villemoes
On 23/03/2021 21.39, Sami Tolvanen wrote: > With CONFIG_CFI_CLANG, the compiler replaces a function address taken > in C code with the address of a local jump table entry, which passes > runtime indirect call checks. However, the compiler won't replace > addresses taken in assembly code, which will

Re: [PATCH] static_call: fix function type mismatch

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 17.01, Sami Tolvanen wrote: > On Wed, Mar 24, 2021 at 5:46 AM Rasmus Villemoes > wrote: >> >> On 23/03/2021 08.47, Peter Zijlstra wrote: >>> On Mon, Mar 22, 2021 at 05:29:21PM -0400, Steven Rostedt wrote: >>>> On Mon, 22 Mar 2021 2

Re: [RFC patch] vsprintf: Allow %pe to print non PTR_ERR %pe uses as decimal

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 18.20, Joe Perches wrote: > On Wed, 2021-03-24 at 09:52 -0700, Joe Perches wrote: >> On Wed, 2021-03-24 at 17:42 +0100, Arnd Bergmann wrote: >>> On Wed, Mar 24, 2021 at 3:20 PM Joe Perches wrote: >> [] > diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c >

Re: [RFC patch] vsprintf: Allow %pe to print non PTR_ERR %pe uses as decimal

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 20.24, Joe Perches wrote: > On Wed, 2021-03-24 at 18:33 +0100, Rasmus Villemoes wrote: >> On 24/03/2021 18.20, Joe Perches wrote: >> >>> >>> Maybe it's better to output non PTR_ERR %pe uses as decimal so this >>> sort of code would work

Re: [PATCH] static_call: fix function type mismatch

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 18.33, Peter Zijlstra wrote: > On Wed, Mar 24, 2021 at 05:45:52PM +0100, Rasmus Villemoes wrote: >> Sorry, I think I misread the code. The static calls are indeed >> initialized with a function with the right prototype. Try adding >> "preempt=full"

Re: [PATCH v2 04/12] module: Add printk format to add module build ID to stacktraces

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 20.11, Stephen Boyd wrote: > Quoting Rasmus Villemoes (2021-03-24 02:57:13) >> >> Is there any reason you didn't just make b an optional flag that could >> be specified with or without R? I suppose the parsing is more difficult >> with several orth

Re: [RFC patch] vsprintf: Allow %pe to print non PTR_ERR %pe uses as decimal

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 23.18, Joe Perches wrote: > On Wed, 2021-03-24 at 22:27 +0100, Rasmus Villemoes wrote: >> On 24/03/2021 20.24, Joe Perches wrote: >>> On Wed, 2021-03-24 at 18:33 +0100, Rasmus Villemoes wrote: >>>> On 24/03/2021 18.20, Joe Perches wrote: >>>&g

Re: [PATCH] static_call: fix function type mismatch

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 23.34, Sami Tolvanen wrote: > On Wed, Mar 24, 2021 at 2:51 PM Rasmus Villemoes > wrote: >> >> On 24/03/2021 18.33, Peter Zijlstra wrote: >>> On Wed, Mar 24, 2021 at 05:45:52PM +0100, Rasmus Villemoes wrote: >>>> Sorry, I think I misrea

Re: [PATCH] static_call: fix function type mismatch

2021-03-24 Thread Rasmus Villemoes
On 25/03/2021 00.40, Sami Tolvanen wrote: > On Wed, Mar 24, 2021 at 3:53 PM Rasmus Villemoes > wrote: >> >> On 24/03/2021 23.34, Sami Tolvanen wrote: >>> On Wed, Mar 24, 2021 at 2:51 PM Rasmus Villemoes >>> wrote: >>>> >>>> On 24/03/202

[PATCH 1/2] sched: stop using magic values in sched_dynamic_mode

2021-03-24 Thread Rasmus Villemoes
Use the enum names which are also what is used in the switch() in sched_dynamic_update(). Signed-off-by: Rasmus Villemoes --- kernel/sched/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 98191218d891..3959481261bb

[PATCH 2/2] sched: use -EINVAL in sched_dynamic_mode

2021-03-24 Thread Rasmus Villemoes
-1 is -EPERM which is a somewhat odd error to return from sched_dynamic_write(). No other callers care about which negative value is used. Signed-off-by: Rasmus Villemoes --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel

Re: [PATCH] static_call: fix function type mismatch

2021-03-25 Thread Rasmus Villemoes
On 25/03/2021 08.42, Peter Zijlstra wrote: > On Thu, Mar 25, 2021 at 01:42:41AM +0100, Rasmus Villemoes wrote: >>> Actually, it looks like I can't select PREEMPT_DYNAMIC> and tweaking Kconfig >> >> Ah, there's no prompt on the "bool" line, so it

Re: [RFC PATCH] devres: better type safety with devm_*_action()

2021-03-18 Thread Rasmus Villemoes
On 10/03/2021 00.59, Rasmus Villemoes wrote: [quoting in full for context to the new CCs] > With a little MacroMagic(tm), we can allow users to pass a pointer to > a function that actually takes the type of the data argument, instead > of forcing the function to have prototype void

Re: [PATCH 2/3] static_call: Align static_call_is_init() patching condition

2021-03-19 Thread Rasmus Villemoes
On 18/03/2021 12.31, Peter Zijlstra wrote: > The intent is to avoid writing init code after init (because the text > might have been freed). The code is needlessly different between > jump_label and static_call and not obviously correct. > > The existing code relies on the fact that the module loa

Re: [PATCH 2/3] static_call: Align static_call_is_init() patching condition

2021-03-19 Thread Rasmus Villemoes
On 19/03/2021 15.13, Peter Zijlstra wrote: >> Dunno, probably overkill, but perhaps we could have an atomic_t (or >> refcount, whatever) init_ref inited to 1, with init_ref_get() doing an >> inc_unless_zero, and iff you get a ref, you're free to call (/patch) >> __init functions and access __initd

Re: [PATCH 2/3] static_call: Align static_call_is_init() patching condition

2021-03-19 Thread Rasmus Villemoes
On 19/03/2021 15.40, Rasmus Villemoes wrote: > On 19/03/2021 15.13, Peter Zijlstra wrote: > >>> Dunno, probably overkill, but perhaps we could have an atomic_t (or >>> refcount, whatever) init_ref inited to 1, with init_ref_get() doing an >>> inc_unless_zero, and

[PATCH] clkdev: remove unnecessary __ref annotations

2021-03-22 Thread Rasmus Villemoes
ea17c9d868c1 (sh: Use generic clkdev.h header). Signed-off-by: Rasmus Villemoes --- drivers/clk/clkdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 0f2e3fcf0f19..d446c2c697d5 100644 --- a/drivers/clk/clkdev.c +++ b

[PATCH] USB: gadget: legacy: remove left-over __ref annotations

2021-03-23 Thread Rasmus Villemoes
;usb: gadget: remove incorrect __init/__exit annotations"). It really never makes sense for a function to be marked __ref unless it (1) has some conditional that chooses whether to call an __init function (or access __initdata) or not and (2) has a comment explaining why the __ref is there and why

Re: [kbuild-all] Re: include/linux/compiler_types.h:315:38: error: call to '__compiletime_assert_536' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct can_frame, len) != offsetof(st

2021-03-23 Thread Rasmus Villemoes
On 23/03/2021 08.45, Oliver Hartkopp wrote: > IMO we facing a compiler problem here - and we should be very happy that > the BUILD_BUG_ON() triggered an issue after years of silence. > > I do not have a good feeling about what kind of strange effects this > compiler issue might have in other code

Re: [PATCH] Input: analog - fix invalid snprintf() call

2021-03-23 Thread Rasmus Villemoes
On 23/03/2021 14.14, Arnd Bergmann wrote: > From: Arnd Bergmann > > overlapping input and output arguments to snprintf() are > undefined behavior in C99: > Good luck: https://lore.kernel.org/lkml/1457469654-17059-1-git-send-email-li...@rasmusvillemoes.dk/ At least 5 years ago the consensus fro

Re: [kbuild-all] Re: include/linux/compiler_types.h:315:38: error: call to '__compiletime_assert_536' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct can_frame, len) != offsetof(st

2021-03-23 Thread Rasmus Villemoes
On 23/03/2021 13.49, Oliver Hartkopp wrote: > > > On 23.03.21 12:36, Rasmus Villemoes wrote: >> >> and more directly from the horse's mouth: >> >> https://developer.arm.com/documentation/dui0067/d/arm-compiler-reference/c-and-c---implementation-details

[PATCH] printk: rename vprintk_func to vprintk

2021-03-23 Thread Rasmus Villemoes
xor%eax,%eax 332: c3 ret 333: 8d b4 26 00 00 00 00lea0x0(%esi,%eiz,1),%esi 33a: 8d b6 00 00 00 00 lea0x0(%esi),%esi Signed-off-by: Rasmus Villemoes --- kernel/printk/internal.h| 3 --- kernel/printk/printk.c | 8 +---

Re: [PATCH] amdgpu: fix gcc -Wrestrict warning

2021-03-23 Thread Rasmus Villemoes
On 23/03/2021 14.04, Arnd Bergmann wrote: > From: Arnd Bergmann > > gcc warns about an sprintf() that uses the same buffer as source > and destination, which is undefined behavior in C99: > > drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c: In function > 'amdgpu_securedisplay_debugfs_write':

Re: [kbuild-all] Re: include/linux/compiler_types.h:315:38: error: call to '__compiletime_assert_536' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct can_frame, len) != offsetof(st

2021-03-23 Thread Rasmus Villemoes
On 23/03/2021 19.59, Oliver Hartkopp wrote: > > > On 23.03.21 15:00, Rasmus Villemoes wrote: >> Now what CONFIG_* knobs are responsible for putting -mabi=apcs-gnu in >> CFLAGS is left as an exercise for the reader. Regardless, it is not a >> bug in the compiler. The e

Re: [PATCH net-next] hinic: avoid gcc -Wrestrict warning

2021-03-23 Thread Rasmus Villemoes
On 23/03/2021 13.56, Arnd Bergmann wrote: > From: Arnd Bergmann > > With extra warnings enabled, gcc complains that snprintf should not > take the same buffer as source and destination: > > drivers/net/ethernet/huawei/hinic/hinic_ethtool.c: In function > 'hinic_set_settings_to_hw': > drivers/ne

Re: [PATCH v2 02/12] buildid: Add method to get running kernel's build ID

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 03.04, Stephen Boyd wrote: > Add vmlinux_build_id() so that callers can print a hex format string > representation of the running kernel's build ID. This will be used in > the kdump and dump_stack code so that developers can easily locate the > vmlinux debug symbols for a crash/stackt

[PATCH v2 1/3] clk: add devm_clk_prepare_enable() helper

2021-03-04 Thread Rasmus Villemoes
Add a managed wrapper for clk_prepare_enable(). Signed-off-by: Rasmus Villemoes --- .../driver-api/driver-model/devres.rst| 1 + drivers/clk/clk-devres.c | 29 +++ include/linux/clk.h | 13 + 3 files changed, 43

[PATCH v2 2/3] dt-bindings: watchdog: add optional "delay" clock to gpio-wdt binding

2021-03-04 Thread Rasmus Villemoes
is enabled, and since linux by default disables unused clocks, that effectively renders the watchdog useless. So add an optional "delay" clock binding. Suggested-by: Arnd Bergmann Signed-off-by: Rasmus Villemoes --- Documentation/devicetree/bindings/watchdog/gpio-wdt.txt | 6 +

[PATCH v2 3/3] watchdog: gpio_wdt: implement support for optional "delay" clock

2021-03-04 Thread Rasmus Villemoes
is enabled, and since linux by default disables unused clocks, that effectively renders the watchdog useless. Add driver support for an optional "delay" clock, as documented in the preceding patch. Signed-off-by: Rasmus Villemoes --- drivers/watchdog/gpio_wdt.c | 9 + 1 file c

[PATCH v2 0/3] add "delay" clock support to gpio_wdt

2021-03-04 Thread Rasmus Villemoes
;s already above what the spec says, and other random changes in the future might make the gap even wider. So I don't know. The hardware is obviously misdesigned, and I don't know how far the mainline kernel should stretch to support this; OTOH the kernel does contain lots of workarounds for

Re: [PATCH] kbuild: add CONFIG_VMLINUX_MAP expert option

2021-03-04 Thread Rasmus Villemoes
On 24/02/2021 11.52, Rasmus Villemoes wrote: > It can be quite useful to have ld emit a link map file, in order to > debug or verify that special sections end up where they are supposed > to, and to see what LD_DEAD_CODE_DATA_ELIMINATION manages to get rid > of. > > The only r

Re: [PATCH 5/7] printk: Make %pS and friends print module build ID

2021-03-04 Thread Rasmus Villemoes
On 04/03/2021 20.15, Stephen Boyd wrote: > Quoting Matthew Wilcox (2021-03-04 09:00:52) >> On Mon, Mar 01, 2021 at 09:47:47AM -0800, Stephen Boyd wrote: >>> Example: >>> >>> WARNING: CPU: 4 PID: 3255 at drivers/misc/lkdtm/bugs.c:83 >>> lkdtm_WARNING+0x28/0x30 [lkdtm] (ed5019fdf5e53be37cb1ba789929

[PATCH] clk: use clk_core_enable_lock() a bit more

2021-03-04 Thread Rasmus Villemoes
Use clk_core_enable_lock() and clk_core_disable_lock() in a few places rather than open-coding them. Signed-off-by: Rasmus Villemoes --- drivers/clk/clk.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index

[PATCH v2] kbuild: add CONFIG_VMLINUX_MAP expert option

2021-03-05 Thread Rasmus Villemoes
an be rather large (several MB), and that's a waste of space when one isn't interested in these things. Also make it depend on CONFIG_EXPERT. Signed-off-by: Rasmus Villemoes --- .gitignore | 1 + Documentation/dontdiff | 1 + lib/Kconfig.debug | 10 +

[PATCH] kbuild: apply fixdep logic to link-vmlinux.sh

2021-03-05 Thread Rasmus Villemoes
dependency. To fix this, make link-vmlinux.sh emit a .vmlinux.d file in the same format as the dependency files generated by gcc, and apply the fixdep logic to that. I've tested that this correctly works with both in-tree and out-of-tree builds. Signed-off-by: Rasmus Villemoes --- Mak

Re: linux-kernel janitorial RFP: Mark static arrays as const

2021-03-03 Thread Rasmus Villemoes
On 02/03/2021 18.42, Joe Perches wrote: > Here is a possible opportunity to reduce data usage in the kernel. > > $ git grep -P -n '^static\s+(?!const|struct)(?:\w+\s+){1,3}\w+\s*\[\s*\]' > drivers/ | \ > grep -v __initdata | \ > wc -l > 3250 > > Meaning there are ~3000 declarations of arrays

Re: [PATCH 06/12] tools: sync small_const_nbits() macro with the kernel

2021-03-22 Thread Rasmus Villemoes
l_const_nbits(size)) { + unsigned long val = *addr & GENMASK(size - 1, 0); blow up at run-time. Other than that (and the above commit log typo), consider the series Acked-by: Rasmus Villemoes

Re: [PATCH] powerpc/vdso32: Add missing _restgpr_31_x to fix build failure

2021-03-15 Thread Rasmus Villemoes
On 12/03/2021 03.29, Segher Boessenkool wrote: > Hi! > > On Tue, Mar 09, 2021 at 06:19:30AM +, Christophe Leroy wrote: >> With some defconfig including CONFIG_CC_OPTIMIZE_FOR_SIZE, >> (for instance mvme5100_defconfig and ps3_defconfig), gcc 5 >> generates a call to _restgpr_31_x. > >> I don't

Re: [PATCH v3 1/2] init/initramfs.c: do unpacking asynchronously

2021-03-15 Thread Rasmus Villemoes
On 15/03/2021 22.33, Andrew Morton wrote: > On Sat, 13 Mar 2021 22:25:27 +0100 Rasmus Villemoes > wrote: > >> Most of the boot process doesn't actually need anything from the >> initramfs, until of course PID1 is to be executed. So instead of doing >> the dec

Re: [PATCH 01/13] tools: disable -Wno-type-limits

2021-03-16 Thread Rasmus Villemoes
On 16/03/2021 02.54, Yury Norov wrote: > GENMASK(h, l) may be passed with unsigned types. In such case, type-limits > warning is generated for example in case of GENMASK(h, 0). > > Signed-off-by: Yury Norov > --- > tools/scripts/Makefile.include | 1 + > 1 file changed, 1 insertion(+) > > diff

Re: [PATCH 02/13] tools: bitmap: sync function declarations with the kernel

2021-03-16 Thread Rasmus Villemoes
On 16/03/2021 02.54, Yury Norov wrote: > Some functions in tools/include/linux/bitmap.h declare nbits as int. In the > kernel nbits is declared as unsigned int. > > Signed-off-by: Yury Norov Acked-by: Rasmus Villemoes

Re: [PATCH 04/13] lib: introduce BITS_{FIRST,LAST} macro

2021-03-16 Thread Rasmus Villemoes
On 16/03/2021 02.54, Yury Norov wrote: > BITMAP_{LAST,FIRST}_WORD_MASK() in linux/bitmap.h duplicates the > functionality of GENMASK(). The scope of BITMAP* macros is wider > than just bitmaps. This patch defines 4 new macros: BITS_FIRST(), > BITS_LAST(), BITS_FIRST_MASK() and BITS_LAST_MASK() in l

Re: [PATCH 06/13] lib: extend the scope of small_const_nbits() macro

2021-03-16 Thread Rasmus Villemoes
On 16/03/2021 02.54, Yury Norov wrote: > find_bit would also benefit from small_const_nbits() optimizations. > > Signed-off-by: Yury Norov > --- > include/asm-generic/bitsperlong.h | 9 + > include/linux/bitmap.h| 3 --- > 2 files changed, 9 insertions(+), 3 deletions(-) > >

Re: [PATCH v5] printk: Userspace format enumeration support

2021-03-16 Thread Rasmus Villemoes
On 10/03/2021 03.30, Chris Down wrote: > --- > MAINTAINERS | 5 + > arch/arm/kernel/entry-v7m.S | 2 +- > arch/arm/lib/backtrace-clang.S | 2 +- > arch/arm/lib/backtrace.S | 2 +- > arch/arm/mach-rpc/io-acorn.S | 2 +- > arch/a

Re: [PATCH v2 6/9] debugfs: Implement debugfs_create_str()

2021-03-26 Thread Rasmus Villemoes
On 26/03/2021 12.38, Peter Zijlstra wrote: > Implement debugfs_create_str() to easily display names and such in > debugfs. Patches 7-9 don't seem to add any users of this. What's it for precisely? > + > +again: > + rcu_read_lock(); > + str = rcu_dereference(*(char **)file->private_data);

Re: [PATCH v2 6/9] debugfs: Implement debugfs_create_str()

2021-03-26 Thread Rasmus Villemoes
On 26/03/2021 13.57, Greg KH wrote: > On Fri, Mar 26, 2021 at 01:53:59PM +0100, Rasmus Villemoes wrote: >> On 26/03/2021 12.38, Peter Zijlstra wrote: >> >>> Implement debugfs_create_str() to easily display names and such in >>> debugfs. >> >> Patches 7-

Re: [PATCH v2 6/9] debugfs: Implement debugfs_create_str()

2021-03-26 Thread Rasmus Villemoes
On 26/03/2021 15.22, Peter Zijlstra wrote: > On Fri, Mar 26, 2021 at 01:53:59PM +0100, Rasmus Villemoes wrote: >> On 26/03/2021 12.38, Peter Zijlstra wrote: > >>> + >>> +again: >>> + rcu_read_lock(); >>> + str = rcu_dereference(*(char **)fi

[PATCH] debugfs: drop pointless nul-termination in debugfs_read_file_bool()

2021-03-26 Thread Rasmus Villemoes
simple_read_from_buffer() doesn't care about any bytes in the buffer beyond "available". Making the buffer nul-terminated is therefore completely pointless. Signed-off-by: Rasmus Villemoes --- fs/debugfs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --g

[PATCH] greybus: remove stray nul byte in apb_log_enable_read output

2021-03-26 Thread Rasmus Villemoes
Including a nul byte in the otherwise human-readable ascii output from this debugfs file is probably not intended. Signed-off-by: Rasmus Villemoes --- drivers/greybus/es2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c index

Re: [greybus-dev] [PATCH] greybus: remove stray nul byte in apb_log_enable_read output

2021-03-26 Thread Rasmus Villemoes
On 26/03/2021 17.31, Alex Elder wrote: > On 3/26/21 10:22 AM, Rasmus Villemoes wrote: >> Including a nul byte in the otherwise human-readable ascii output >> from this debugfs file is probably not intended. > > Looking only at the comments above simple_read_from_buffer(), &

Re: [PATCH 1/2] workqueue: Have 'alloc_workqueue()' like macros accept a format specifier

2021-04-18 Thread Rasmus Villemoes
On 18/04/2021 23.26, Christophe JAILLET wrote: > Improve 'create_workqueue', 'create_freezable_workqueue' and > 'create_singlethread_workqueue' so that they accept a format > specifier and a variable number of arguments. > > This will put these macros more in line with 'alloc_ordered_workqueue' an

Re: [PATCH v5] printk: Userspace format enumeration support

2021-04-19 Thread Rasmus Villemoes
On 16/04/2021 15.56, Chris Down wrote: > Hey Petr, Rasmus, >> This is great point! There are many other subsystem specific wrappers, >> e,g, ata_dev_printk(), netdev_printk(), snd_printk(), dprintk(). >> We should make it easy to index them as well. > > These would be nice to have, but we should

Re: [PATCH 05/15] x86: Implement function_nocfi

2021-04-19 Thread Rasmus Villemoes
On 17/04/2021 00.28, Kees Cook wrote: > On Fri, Apr 16, 2021 at 03:06:17PM -0700, Andy Lutomirski wrote: >> The >> foo symbol would point to whatever magic is needed. > > No, the symbol points to the jump table entry. Direct calls get minimal > overhead and indirect calls can add the "is this fun

[PATCH] driver core: make device_set_deferred_probe_reason a no-op when !CONFIG_DEBUG_FS

2021-04-19 Thread Rasmus Villemoes
loc()) for the minimal amount of ifdeffery. Signed-off-by: Rasmus Villemoes --- drivers/base/dd.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 37a5e5f8b221..6a197336c6a4 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -216,9 +216,

Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-20 Thread Rasmus Villemoes
On 17/04/2021 01.07, Matthew Wilcox (Oracle) wrote: > 32-bit architectures which expect 8-byte alignment for 8-byte integers > and need 64-bit DMA addresses (arc, arm, mips, ppc) had their struct > page inadvertently expanded in 2019. When the dma_addr_t was added, > it forced the alignment of the

[PATCH] docs: admin-guide: update description for kernel.hotplug sysctl

2021-04-20 Thread Rasmus Villemoes
uot;Driver-Core: disable /sbin/hotplug by default") Signed-off-by: Rasmus Villemoes --- Documentation/admin-guide/sysctl/kernel.rst | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rs

Re: [PATCH v5] printk: Userspace format enumeration support

2021-03-17 Thread Rasmus Villemoes
On 17/03/2021 09.40, Petr Mladek wrote: > On Tue 2021-03-16 14:28:12, Chris Down wrote: >> Rasmus Villemoes writes: >>> I think it's pointless renaming the symbol to _printk, with all the >>> churn and reduced readability that involves (especially when reading

Re: [PATCH v2] Increase page and bit waitqueue hash size

2021-03-17 Thread Rasmus Villemoes
On 17/03/2021 08.54, Nicholas Piggin wrote: > +#if CONFIG_BASE_SMALL > +static const unsigned int page_wait_table_bits = 4; > static wait_queue_head_t page_wait_table[PAGE_WAIT_TABLE_SIZE] > __cacheline_aligned; > > + if (!CONFIG_BASE_SMALL) { > + page_wait_table = alloc_large

Re: [PATCH 04/13] lib: introduce BITS_{FIRST,LAST} macro

2021-03-17 Thread Rasmus Villemoes
On 17/03/2021 06.40, Yury Norov wrote: > On Tue, Mar 16, 2021 at 01:42:45PM +0200, Andy Shevchenko wrote: >>> It would also be much easier to review if you just redefined the >>> BITMAP_LAST_WORD_MASK macros etc. in terms of these new things, so you >>> wouldn't have to do a lot of mechanical chan

Re: [PATCH v5] printk: Userspace format enumeration support

2021-03-18 Thread Rasmus Villemoes
On 18/03/2021 11.46, Petr Mladek wrote: > BTW: Is the trick with int (printk)(const char *s, ...) documented > somewhere? Is it portable? It is completely standard and portable C, explicitly spelled out in the C standard itself. C99: === 6.10.3 Macro replacement 10 [...] Each subsequent instanc

Re: [PATCH 1/2] devtmpfs: fix placement of complete() call

2021-03-18 Thread Rasmus Villemoes
On 12/03/2021 11.30, Rasmus Villemoes wrote: > Calling complete() from within the __init function is wrong - > theoretically, the init process could proceed all the way to freeing > the init mem before the devtmpfsd thread gets to execute the return > instruction in devtmpfs_setup().

Re: [PATCH] ARM: decompressor: remove unused global variable output_data

2021-03-18 Thread Rasmus Villemoes
On 08/03/2021 15.29, Rasmus Villemoes wrote: > output_data seems to have been write-only since the flush_window() > callback was removed in commit e7db7b4270ed ("arm: add support for > LZO-compressed kernels"). Ping.

Re: [PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-09 Thread Rasmus Villemoes
On 05/12/2020 22.27, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 22:11:39 +0100 Rasmus Villemoes wrote: >>> Looks like a nice clean up on a quick look. >>> >>> Please separate patches 1 and 11 (which are the two bug fixes I see) >> >> I think patch 2

[PATCH net-next v2] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250

2020-12-10 Thread Rasmus Villemoes
method, use the existence of the ->port_setup_message_port method as a proxy for determining whether the learn2all bit exists (and should be set). Signed-off-by: Rasmus Villemoes --- v2: add comment explaining why ->port_setup_message_port is being used. This doesn't fix anything from what

Re: [PATCH 0/2] rtc: pcf2127: only use watchdog when explicitly available

2020-11-30 Thread Rasmus Villemoes
On 24/09/2020 12.52, Uwe Kleine-König wrote: > Hello, > > now that there are two people stumbling over the pcf2127 driver > providing a non-functional watchdog device, here comes an RFC patch to > address this. I just want to add a "me too" here, as I'm also now affected by the pcf2127 exposing a

Re:

2020-12-05 Thread Rasmus Villemoes
On 03/12/2020 19.46, Yury Norov wrote: > I would prefer to avoid changing the find*bit() semantics. As for now, > if any of find_*_bit() > finds nothing, it returns the size of the bitmap it was passed. Yeah, we should actually try to fix that, it causes bad code generation. It's hard, because ca

[PATCH net-next] net: dsa: print the MTU value that could not be set

2020-12-05 Thread Rasmus Villemoes
These warnings become somewhat more informative when they include the MTU value that could not be set and not just the errno. Signed-off-by: Rasmus Villemoes --- net/dsa/master.c | 7 --- net/dsa/slave.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/net/dsa

[PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-05 Thread Rasmus Villemoes
tch 2, someone in NXP should check how the hardware actually works and make an updated reference manual available. Rasmus Villemoes (20): ethernet: ucc_geth: set dev->max_mtu to 1518 ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram ethernet: ucc_geth: remove unused read of

[PATCH 03/20] ethernet: ucc_geth: remove unused read of temoder field

2020-12-05 Thread Rasmus Villemoes
In theory, such a read-after-write might be required by the hardware, but nothing in the data sheet suggests that to be the case. The name test also suggests that it's some debug leftover. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 3 --- 1 file chang

[PATCH 04/20] soc: fsl: qe: make cpm_muram_offset take a const void* argument

2020-12-05 Thread Rasmus Villemoes
Allow passing const-qualified pointers without requiring a cast in the caller. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe_common.c | 2 +- include/soc/fsl/qe/qe.h| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_common.c b

[PATCH 02/20] ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram

2020-12-05 Thread Rasmus Villemoes
t could be attributed to this, but it seems to be the kind of thing that would be extremely hard to debug. So extend the struct definition so that we do allocate 192 bytes. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.h | 9 - 1 file changed, 8 insertions(+),

[PATCH 09/20] ethernet: ucc_geth: replace kmalloc+memset by kzalloc

2020-12-05 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index f854ff90f238..e1574c14b7e5 100644 --- a/drivers/net

[PATCH 07/20] ethernet: ucc_geth: use qe_muram_free_addr()

2020-12-05 Thread Rasmus Villemoes
This removes the explicit NULL checks, and allows us to stop storing at least some of the _offset values separately. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 77 ++- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a

[PATCH 06/20] soc: fsl: qe: add cpm_muram_free_addr() helper

2020-12-05 Thread Rasmus Villemoes
Add a helper that takes a virtual address rather than the muram offset. This will be used in a couple of places to avoid having to store both the offset and the virtual address, as well as removing NULL checks from the callers. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe_common.c

[PATCH 10/20] ethernet: ucc_geth: remove {rx,tx}_glbl_pram_offset from struct ucc_geth_private

2020-12-05 Thread Rasmus Villemoes
fixes the problems with using IS_ERR_VALUE() on a u32 as explained in commit 800cd6fb76f0 ("soc: fsl: qe: change return type of cpm_muram_alloc() to s32"). Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 21 + drivers/net/ethernet

[PATCH 12/20] ethernet: ucc_geth: factor out parsing of {rx,tx}-clock{,-name} properties

2020-12-05 Thread Rasmus Villemoes
Reduce the code duplication a bit by moving the parsing of rx-clock-name and the fallback handling to a helper function. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 79 ++- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a

[PATCH 15/20] ethernet: ucc_geth: use UCC_GETH_{RX,TX}_BD_RING_ALIGNMENT macros directly

2020-12-05 Thread Rasmus Villemoes
These macros both have the value 32, there's no point first initializing align to a lower value. If anything, one could throw in a BUILD_BUG_ON(UCC_GETH_TX_BD_RING_ALIGNMENT < 4), but it's not worth it - lots of code depends on named constants having sensible values. Signed-o

[PATCH 11/20] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-05 Thread Rasmus Villemoes
ugeth is the netdiv_priv() part of the netdevice. Accessing the memory pointed to by ugeth (such as done by ucc_geth_memclean() and the two of_node_puts) after free_netdev() is thus use-after-free. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 4 ++-- 1 file

[PATCH 08/20] ethernet: ucc_geth: remove unnecessary memset_io() calls

2020-12-05 Thread Rasmus Villemoes
These buffers have all just been handed out from qe_muram_alloc(), aka cpm_muram_alloc(), and the helper cpm_muram_alloc_common() already does memset_io(cpm_muram_addr(start), 0, size); Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 19

[PATCH 18/20] ethernet: ucc_geth: add helper to replace repeated switch statements

2020-12-05 Thread Rasmus Villemoes
The translation from the ucc_geth_num_of_threads enum value to the actual count can be written somewhat more compactly with a small lookup table, allowing us to replace the four switch statements. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 100

[PATCH 19/20] ethernet: ucc_geth: inform the compiler that numQueues is always 1

2020-12-05 Thread Rasmus Villemoes
that are not really loops by creating static inline helpers. If and when the numQueuesTx/numQueuesRx fields are re-introduced, it suffices to update those helper to return the appropriate field. This cuts the .text segment of ucc_geth.o by 8%. Signed-off-by: Rasmus Villemoes --- drivers/net/eth

[PATCH 16/20] ethernet: ucc_geth: remove bd_mem_part and all associated code

2020-12-05 Thread Rasmus Villemoes
a lot of dead code, this is also motivated by wanting to clean up the "store result from kmalloc() in a u32" mess. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 106 ++ include/soc/fsl/qe/qe.h | 6 -- inc

[PATCH 17/20] ethernet: ucc_geth: replace kmalloc_array()+for loop by kcalloc()

2020-12-05 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index c9f619908561..3aebea191b52 100644 --- a

[PATCH 20/20] ethernet: ucc_geth: simplify rx/tx allocations

2020-12-05 Thread Rasmus Villemoes
ery elegant and certainly makes a reader of the code pause for a while. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 50 --- drivers/net/ethernet/freescale/ucc_geth.h | 2 - 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/drive

[PATCH 14/20] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info

2020-12-05 Thread Rasmus Villemoes
k was dead code, as the address of some static array element can obviously never be NULL. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 32 +-- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc

[PATCH 13/20] ethernet: ucc_geth: constify ugeth_primary_info

2020-12-05 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 700eafef4921..a06744d8b4af 100644 --- a/drivers/net

[PATCH 05/20] soc: fsl: qe: store muram_vbase as a void pointer instead of u8

2020-12-05 Thread Rasmus Villemoes
d-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 0fbdc965c4cb..303cc2f5eb4a 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/f

[PATCH 01/20] ethernet: ucc_geth: set dev->max_mtu to 1518

2020-12-05 Thread Rasmus Villemoes
Vladimir Oltean Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 714b501be7d0..380c1f09adaf 100644 --- a/drivers/net/eth

Re: [RFC PATCH v1 07/12] efi: Replace strstarts() by str_has_prefix().

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 20.36, Ard Biesheuvel wrote: > On Fri, 4 Dec 2020 at 19:02, James Bottomley > wrote: >> >> On Fri, 2020-12-04 at 18:07 +0100, Ard Biesheuvel wrote: >>> On Fri, 4 Dec 2020 at 18:06, >>> wrote: From: Francis Laniel The two functions indicates if a string begins with a

Re: [PATCH 11/20] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 21.48, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 20:17:34 +0100 Rasmus Villemoes wrote: >> -unregister_netdev(dev); >> -free_netdev(dev); >> ucc_geth_memclean(ugeth); >> if (of_phy_is_fixed_link(np)) >>

Re: [PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 21.53, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 20:17:23 +0100 Rasmus Villemoes wrote: >> While trying to figure out how to allow bumping the MTU with the >> ucc_geth driver, I fell into a rabbit hole and stumbled on a whole >> bunch of issues of varying

Re: [PATCH 11/20] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 22.19, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 22:04:28 +0100 Rasmus Villemoes wrote: >> On 05/12/2020 21.48, Jakub Kicinski wrote: >>> On Sat, 5 Dec 2020 20:17:34 +0100 Rasmus Villemoes wrote: >>>> - unregister_netdev(dev); >>>> - f

Re: [PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 22.27, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 22:11:39 +0100 Rasmus Villemoes wrote: >>> rebase (retest) and post them against the net tree: >>> >>> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/ >> >> So I thought th

Re: [PATCH 11/20] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-05 Thread Rasmus Villemoes
> I only noticed because I needed to add a free of the ug_info in a later > patch. Where, ironically, I add a use-after-free bug by freeing ug_info before the ucc_geth_memclean() call. :facepalm:

Re: [PATCH v2 1/3] dt-bindings: rtc: add reset-source property

2020-12-17 Thread Rasmus Villemoes
On 17/12/2020 19.12, Uwe Kleine-König wrote: > On Thu, Dec 17, 2020 at 10:51:08AM -0600, Rob Herring wrote: >> On Fri, Dec 11, 2020 at 5:10 PM Rasmus Villemoes >> wrote: >> I'm wondering how you solve which wdog to ping when there are multiple >> without rely

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