[PATCH v2 6/6] riscv: ftrace: support PREEMPT

2024-06-28 Thread Andy Chiu
Now, we can safely enable dynamic ftrace with kernel preemption. Signed-off-by: Andy Chiu --- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 55c70efbad0a..881ea466ff52 100644 --- a/arch/riscv/Kconfig +++ b

[PATCH v2 5/6] riscv: vector: Support calling schedule() for preemptible Vector

2024-06-28 Thread Andy Chiu
schedule(). Besides, we currently don't pass argument through vector register, so we don't have to save/restore V-regs in ftrace trampoline. Signed-off-by: Andy Chiu --- arch/riscv/include/asm/processor.h | 5 + arch/riscv/include/asm/vector.h| 22 +++--- 2 files changed

[PATCH v2 4/6] riscv: ftrace: do not use stop_machine to update code

2024-06-28 Thread Andy Chiu
Now it is safe to remove dependency from stop_machine() for us to patch code in ftrace. Signed-off-by: Andy Chiu --- arch/riscv/kernel/ftrace.c | 53 -- 1 file changed, 4 insertions(+), 49 deletions(-) diff --git a/arch/riscv/kernel/ftrace.c b/arch

[PATCH v2 3/6] riscv: ftrace: prepare ftrace for atomic code patching

2024-06-28 Thread Andy Chiu
, then perform the jump. This enable the kernel to update the target atomically. The ordering of reading/updating the targert address should be guarded by generic ftrace code, where it sends smp_rmb ipi. Signed-off-by: Andy Chiu --- arch/riscv/include/asm/ftrace.h | 4 +++ arch/riscv/kernel/ftrace.c

[PATCH v2 2/6] riscv: ftrace: align patchable functions to 4 Byte boundary

2024-06-28 Thread Andy Chiu
functions properly on newer versions of gcc. So, we add a cc-option to test if the toolchain supports it. Suggested-by: Evgenii Shatokhin Signed-off-by: Andy Chiu --- Changelog v2: - Use CC_HAS_MIN_FUNCTION_ALIGNMENT and it friends to prevent reinventing wheels (Nathan) --- arch/riscv/Kconfig

[PATCH v2 1/6] riscv: ftrace: support fastcc in Clang for WITH_ARGS

2024-06-28 Thread Andy Chiu
Reported-by: Evgenii Shatokhin Closes: https://lore.kernel.org/linux-riscv/7e7c7914-445d-426d-89a0-59a9199c4...@yadro.com/ Acked-by: Nathan Chancellor Signed-off-by: Andy Chiu --- arch/riscv/include/asm/ftrace.h | 7 +++ arch/riscv/kernel/asm-offsets.c | 7 +++ arch/riscv/kernel/mcount-dyn.S

[PATCH v2 0/6] riscv: ftrace: atmoic patching and preempt improvements

2024-06-28 Thread Andy Chiu
ctions. - Link to v1: https://lore.kernel.org/r/20240613-dev-andyc-dyn-ftrace-v4-v1-0-1a538e12c...@sifive.com --- Andy Chiu (6): riscv: ftrace: support fastcc in Clang for WITH_ARGS riscv: ftrace: align patchable functions to 4 Byte boundary riscv: ftrace: prepare ftrace for

Re: [PATCH -fixes] riscv: patch: Flush the icache right after patching to avoid illegal insns

2024-06-24 Thread Andy Chiu
On Mon, Jun 24, 2024 at 7:49 PM Andy Chiu wrote: > > Hi Alex, > > On Mon, Jun 24, 2024 at 4:21 PM Alexandre Ghiti > wrote: > > > > We cannot delay the icache flush after patching some functions as we may > > have patched a function that will get called before t

Re: [PATCH -fixes] riscv: patch: Flush the icache right after patching to avoid illegal insns

2024-06-24 Thread Andy Chiu
s, > size_t len) > > ret = patch_insn_write(tp, insns, len); > > - if (!ret) > - flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len); > - > return ret; > } > NOKPROBE_SYMBOL(patch_text_nosync); > @@ -253,9 +263,9 @@ static int patch_text_cb(void *data) > } else { > while (atomic_read(>cpu_count) <= num_online_cpus()) > cpu_relax(); > - } > > - local_flush_icache_all(); > + local_flush_icache_all(); > + } > > return ret; > } > -- > 2.39.2 > Thanks, Andy

Re: [PATCH] riscv: Fix early ftrace nop patching

2024-06-18 Thread Andy Chiu
On Tue, Jun 18, 2024 at 9:40 PM Alexandre Ghiti wrote: > > Hi Andy, > > On Tue, Jun 18, 2024 at 2:48 PM Andy Chiu wrote: > > > > On Tue, Jun 18, 2024 at 8:02 PM Alexandre Ghiti wrote: > > > > > > Hi Conor, > > > > > >

Re: [PATCH] riscv: Fix early ftrace nop patching

2024-06-18 Thread Andy Chiu
please let me know if I missed anything. I think what Conor suggested is safe for init_nop, as it would be called only when there is only one core (booting) and at the loading stage of kernel modules. In the first case we just have to make sure there is no patchable entry before the core executes fence.

Re: [PATCH 4/8] riscv: ftrace: align patchable functions to 4 Byte boundary

2024-06-16 Thread Andy Chiu
Sorry for the noise, On Mon, Jun 17, 2024 at 10:38 AM Andy Chiu wrote: > > On Fri, Jun 14, 2024 at 3:09 AM Nathan Chancellor wrote: > > > > Hi Andy, > > > > On Thu, Jun 13, 2024 at 03:11:09PM +0800, Andy Chiu wrote: > > > We are changing ftrace code patc

Re: [PATCH 4/8] riscv: ftrace: align patchable functions to 4 Byte boundary

2024-06-16 Thread Andy Chiu
On Fri, Jun 14, 2024 at 3:09 AM Nathan Chancellor wrote: > > Hi Andy, > > On Thu, Jun 13, 2024 at 03:11:09PM +0800, Andy Chiu wrote: > > We are changing ftrace code patching in order to remove dependency from > > stop_machine() and enable kernel preemption. This requires u

Re: [PATCH 2/8] tracing: do not trace kernel_text_address()

2024-06-16 Thread Andy Chiu
On Thu, Jun 13, 2024 at 9:32 PM Steven Rostedt wrote: > > On Thu, 13 Jun 2024 15:11:07 +0800 > Andy Chiu wrote: > > > kernel_text_address() and __kernel_text_address() are called in > > arch_stack_walk() of riscv. This results in excess amount of un-related > > trac

[PATCH 8/8] riscv: ftrace: support PREEMPT

2024-06-13 Thread Andy Chiu
Now, we can safely enable dynamic ftrace with kernel preemption. Signed-off-by: Andy Chiu --- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 80b8d48e1e46..c1493ee1b8cd 100644 --- a/arch/riscv/Kconfig +++ b

[PATCH 7/8] riscv: vector: Support calling schedule() for preemptible Vector

2024-06-13 Thread Andy Chiu
schedule(). Besides, we currently don't pass argument through vector register, so we don't have to save/restore V-regs in ftrace trampoline. Signed-off-by: Andy Chiu --- arch/riscv/include/asm/processor.h | 5 + arch/riscv/include/asm/vector.h| 22 +++--- 2 files changed

[PATCH 6/8] riscv: ftrace: do not use stop_machine to update code

2024-06-13 Thread Andy Chiu
Now it is safe to remove dependency from stop_machine() for us to patch code in ftrace. Signed-off-by: Andy Chiu --- arch/riscv/kernel/ftrace.c | 53 -- 1 file changed, 4 insertions(+), 49 deletions(-) diff --git a/arch/riscv/kernel/ftrace.c b/arch

[PATCH 5/8] riscv: ftrace: prepare ftrace for atomic code patching

2024-06-13 Thread Andy Chiu
, then perform the jump. This enable the kernel to update the target atomically. The ordering of reading/updating the targert address should be guarded by generic ftrace code, where it sends smp_rmb ipi. Signed-off-by: Andy Chiu --- arch/riscv/include/asm/ftrace.h | 4 +++ arch/riscv/kernel/ftrace.c

[PATCH 4/8] riscv: ftrace: align patchable functions to 4 Byte boundary

2024-06-13 Thread Andy Chiu
functions properly on newer versions of gcc. So, we add a cc-option to test if the toolchain supports it. Suggested-by: Evgenii Shatokhin Signed-off-by: Andy Chiu --- arch/riscv/Kconfig | 1 + arch/riscv/Makefile | 7 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/riscv

[PATCH 3/8] riscv: ftrace: support fastcc in Clang for WITH_ARGS

2024-06-13 Thread Andy Chiu
-by: Evgenii Shatokhin Closes: https://lore.kernel.org/linux-riscv/7e7c7914-445d-426d-89a0-59a9199c4...@yadro.com/ Signed-off-by: Andy Chiu --- arch/riscv/include/asm/ftrace.h | 7 +++ arch/riscv/kernel/asm-offsets.c | 7 +++ arch/riscv/kernel/mcount-dyn.S | 16 ++-- 3

[PATCH 2/8] tracing: do not trace kernel_text_address()

2024-06-13 Thread Andy Chiu
function's entry/exit. This patch adds both functions to notrace, so they won't show up on the trace records. Signed-off-by: Andy Chiu --- kernel/extable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/extable.c b/kernel/extable.c index 71f482581cab..d03fa462fa8b

[PATCH 1/8] riscv: stacktrace: convert arch_stack_walk() to noinstr

2024-06-13 Thread Andy Chiu
dd CALLER_ADDRx support") Signed-off-by: Andy Chiu --- arch/riscv/kernel/stacktrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index 528ec7cc9a62..0d3f00eb0bae 100644 --- a/arch/riscv/kernel/stacktrac

[PATCH 0/8] riscv: ftrace: atmoic patching and preempt improvements

2024-06-13 Thread Andy Chiu
ftrace to be able to run with kernel preemption (7,8) --- Andy Chiu (8): riscv: stacktrace: convert arch_stack_walk() to noinstr tracing: do not trace kernel_text_address() riscv: ftrace: support fastcc in Clang for WITH_ARGS riscv: ftrace: align patchable functions to 4 Byte

Re: [PATCH v2 2/6] iio: light: stk3310: Implement vdd supply and power it off during suspend

2024-04-24 Thread Andy Shevchenko
On Wed, Apr 24, 2024 at 7:14 PM Ondřej Jirman wrote: > On Wed, Apr 24, 2024 at 06:20:41PM GMT, Andy Shevchenko wrote: > > On Wed, Apr 24, 2024 at 3:59 PM Ondřej Jirman wrote: > > > On Wed, Apr 24, 2024 at 02:16:06AM GMT, Andy Shevchenko wrote: > > > > On Wed

Re: [PATCH v2 2/6] iio: light: stk3310: Implement vdd supply and power it off during suspend

2024-04-24 Thread Andy Shevchenko
On Wed, Apr 24, 2024 at 3:59 PM Ondřej Jirman wrote: > On Wed, Apr 24, 2024 at 02:16:06AM GMT, Andy Shevchenko wrote: > > On Wed, Apr 24, 2024 at 1:41 AM Aren Moynihan > > wrote: ... > > > ret = stk3310_init(indio_dev); > > > if (ret <

Re: [PATCH v2 2/6] iio: light: stk3310: Implement vdd supply and power it off during suspend

2024-04-23 Thread Andy Shevchenko
get_drvdata() directly. Jonathan, do we have something like iio_priv_from_drvdata(struct device *dev)? Seems many drivers may utilise it. > } ... > static int stk3310_resume(struct device *dev) Ditto. -- With Best Regards, Andy Shevchenko

Re: [PATCH v2 3/6] iio: light: stk3310: Manage LED power supply

2024-04-23 Thread Andy Shevchenko
et regulator vdd > failed\n"); > > + data->led_reg = devm_regulator_get(>dev, "leda"); > + if (IS_ERR(data->led_reg)) > + return dev_err_probe(>dev, ret, "get regulator led > failed\n"); Can't you use a bulk regulator API instead? -- With Best Regards, Andy Shevchenko

Re: [PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend

2024-04-18 Thread Andy Shevchenko
On Thu, Apr 18, 2024 at 8:50 PM Aren wrote: > On Thu, Apr 18, 2024 at 06:56:09PM +0300, Andy Shevchenko wrote: > > On Thu, Apr 18, 2024 at 6:06 PM Aren wrote: > > > On Mon, Apr 15, 2024 at 05:04:53PM +0300, Andy Shevchenko wrote: > > > > On Sun, Apr 14,

Re: [PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend

2024-04-18 Thread Andy Shevchenko
On Thu, Apr 18, 2024 at 6:06 PM Aren wrote: > On Mon, Apr 15, 2024 at 05:04:53PM +0300, Andy Shevchenko wrote: > > On Sun, Apr 14, 2024 at 8:57 PM Aren Moynihan > > wrote: ... > > > stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY); > &g

Re: [PATCH 3/4] iio: light: stk3310: log error if reading the chip id fails

2024-04-15 Thread Andy Shevchenko
de it seems that this one is strictly part of the probe phase, which means we may use return dev_err_probe(...); pattern. Yet, you may add another patch to clean up all of them: _probe(), _init(), _regmap_init() to use the same pattern everywhere. -- With Best Regards, Andy Shevchenko

Re: [PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend

2024-04-15 Thread Andy Shevchenko
heck the order of freeing resources, be sure you have no devm_*() releases happening before this call. ... > + usleep_range(1000, 2000); fsleep() -- With Best Regards, Andy Shevchenko

Re: [PATCH] [v3] module: don't ignore sysfs_create_link() failures

2024-03-26 Thread Andy Shevchenko
nd. So, we will reduce a technical debt, and not adding to it. > + goto out_detach; > + } ... > +int module_add_driver(struct module *mod, struct device_driver *drv) > { > char *driver_name; > - int no_warn; > + int ret; I would move it... > struct module_kobject *mk = NULL; ...to be here. -- With Best Regards, Andy Shevchenko

Re: [RFC PATCH] riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS

2024-03-21 Thread Andy Chiu
On Thu, Mar 21, 2024 at 4:48 PM Björn Töpel wrote: > > Andy, > > Pulling out the A option: > > >> > A) Use auipc/jalr, only patch jalr to take us to a common > >> >dispatcher/trampoline > >> > > >> > | # probabl

Re: [RFC PATCH] riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS

2024-03-20 Thread Andy Chiu
ng I am not very sure is: do we need a destination address in a "per-function" manner? It seems like most of the time the destination address can only be ftrace_call, or ftrace_regs_call. If the number of destination addresses is very few, then we could potentially reduce the size of . > > There are 4 CMODX possiblities: >mv, nop: fully disabled, no problems >mv, jalr: We will jump to zero. We would need to have the inst > page/access fault handler take care of this case. Especially > if we align the instructions so that they can be patched > together, being interrupted in the middle and taking this > path will be rare. > ld, nop: no problems > ld, jalr: fully enabled, no problems > > Patching is a 64b store/sd, and we only need a fence.i at the end, since > we can handle all 4 possibilities. > > For the disabled case we'll have: > A) mv, aupic, nop > D) mv, aupic, mv, nop. > > Puranjay, I've flipped. Let's go Mark's CALL_OPS together with a new > text patch mechanism w/o stop_machine(). > > > Björn Cheers, Andy

Re: [RFC PATCH] riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS

2024-03-08 Thread Andy Chiu
tter performance than that? > > > > > I'm trying to wrap my head if it makes sense to have it on RISC-V, given > > that we're a bit different from Arm64. Does the scale tip to the GOOD > > side? > > > > Oh, and we really need to see performance numbers on real HW! I have a > > VF2 that I could try this series on. > > It would be great if you can do it :D. > > Thanks, > Puranjay > > ___ > linux-riscv mailing list > linux-ri...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv - [1] https://yhbt.net/lore/all/cajf2gtsn3_cdysf9d8dt-br2wf_m8y02a09xgrq8kxi91sn...@mail.gmail.com/T/ Regards, Andy

Re: [RFC PATCH] riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS

2024-03-08 Thread Andy Chiu
4. I would like to benchmark this on real hardware and put the results > > > in > > > the commit message. > > > > > > Signed-off-by: Puranjay Mohan > > > --- > > > arch/riscv/Kconfig | 2 ++ > > > arch/riscv/Makefile

Re: [PATCH v1 1/1] ACPI: NFIT: Switch to use acpi_evaluate_dsm_typed()

2024-02-02 Thread Andy Shevchenko
On Mon, Nov 20, 2023 at 07:19:44PM +0200, Andy Shevchenko wrote: > On Mon, Nov 20, 2023 at 04:11:54PM +0100, Rafael J. Wysocki wrote: > > On Mon, Nov 20, 2023 at 4:03 PM Andy Shevchenko > > wrote: > > > On Thu, Oct 19, 2023 at 06:03:28PM -0700, Dan Williams wrote: >

[v1] trace/hwlat: stop worker if !is_percpu_thread due to hotplug event

2024-01-31 Thread Andy Chiu
If the task happens to run after cpu hot-plug offline, then it would not be running in a percpu_thread. Instead, it would be re-queued into a UNBOUND workqueue. This would trigger a warning if we enable kernel preemption. Signed-off-by: Andy Chiu --- kernel/trace/trace_hwlat.c | 11

[v1] trace/osnoise: prevent osnoise hotplog worker running in UNBOUND workqueue

2024-01-31 Thread Andy Chiu
wq. Signed-off-by: Andy Chiu --- kernel/trace/trace_osnoise.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index bd0d01d00fb9..cf7f716d3f35 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace

Re: [PATCH] tracing histograms: Simplify parse_actions() function

2024-01-08 Thread Andy Shevchenko
need data to be assigned here as well ret = -EINVAL; ... } -- With Best Regards, Andy Shevchenko

Re: [PATCH v3 0/5] params: harden string ops and allocatio ops

2023-12-01 Thread Andy Shevchenko
On Fri, Dec 01, 2023 at 09:43:34AM -0800, Kees Cook wrote: > On Mon, 20 Nov 2023 17:11:41 +0200, Andy Shevchenko wrote: > > A couple of patches are for get the string ops, used in the module, > > slightly harden. On top a few cleanups. > > > > Since the main part i

Re: [PATCH v3 0/5] params: harden string ops and allocatio ops

2023-12-01 Thread Andy Shevchenko
On Mon, Nov 20, 2023 at 05:11:41PM +0200, Andy Shevchenko wrote: > A couple of patches are for get the string ops, used in the module, > slightly harden. On top a few cleanups. > > Since the main part is rather hardening, I think the Kees' tree is > the best fit for the series. I

[PATCH v3 2/5] params: Do not go over the limit when getting the string length

2023-11-20 Thread Andy Shevchenko
We can use strnlen() even on early stages and it prevents from going over the string boundaries in case it's already too long. Reviewed-by: Luis Chamberlain Reviewed-by: Kees Cook Signed-off-by: Andy Shevchenko --- kernel/params.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions

[PATCH v3 5/5] params: Fix multi-line comment style

2023-11-20 Thread Andy Shevchenko
The multi-line comment style in the file is rather arbitrary. Make it follow the standard one. Reviewed-by: Luis Chamberlain Reviewed-by: Kees Cook Signed-off-by: Andy Shevchenko --- kernel/params.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git

[PATCH v3 4/5] params: Sort headers

2023-11-20 Thread Andy Shevchenko
Sort the headers in alphabetic order in order to ease the maintenance for this part. Reviewed-by: Luis Chamberlain Reviewed-by: Kees Cook Signed-off-by: Andy Shevchenko --- kernel/params.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kernel/params.c b

[PATCH v3 1/5] params: Introduce the param_unknown_fn type

2023-11-20 Thread Andy Shevchenko
Introduce a new type for the callback to parse an unknown argument. This unifies function prototypes which takes that as a parameter. Reviewed-by: Luis Chamberlain Reviewed-by: Kees Cook Signed-off-by: Andy Shevchenko --- include/linux/moduleparam.h | 6 +++--- kernel/params.c | 8

[PATCH v3 3/5] params: Use size_add() for kmalloc()

2023-11-20 Thread Andy Shevchenko
Prevent allocations from integer overflow by using size_add(). Reviewed-by: Luis Chamberlain Reviewed-by: Kees Cook Signed-off-by: Andy Shevchenko --- kernel/params.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/params.c b/kernel/params.c index f8e3c4139854

[PATCH v3 0/5] params: harden string ops and allocatio ops

2023-11-20 Thread Andy Shevchenko
ies (Luis) Andy Shevchenko (5): params: Introduce the param_unknown_fn type params: Do not go over the limit when getting the string length params: Use size_add() for kmalloc() params: Sort headers params: Fix multi-line comment style include/linux/moduleparam.h | 6 ++-- kernel/param

Re: [PATCH v1 1/1] ACPI: NFIT: Switch to use acpi_evaluate_dsm_typed()

2023-11-20 Thread Andy Shevchenko
On Thu, Oct 19, 2023 at 06:03:28PM -0700, Dan Williams wrote: > Andy Shevchenko wrote: > > The acpi_evaluate_dsm_typed() provides a way to check the type of the > > object evaluated by _DSM call. Use it instead of open coded variant. > > Looks good to me. > > Review

Re: [PATCH v1 1/1] ACPI: NFIT: Switch to use acpi_evaluate_dsm_typed()

2023-10-19 Thread Andy Shevchenko
On Mon, Oct 02, 2023 at 04:54:58PM +0300, Andy Shevchenko wrote: > The acpi_evaluate_dsm_typed() provides a way to check the type of the > object evaluated by _DSM call. Use it instead of open coded variant. Dan, do you have any comments? -- With Best Regards, Andy Shevchenko

Re: [PATCH v2] ACPI: NFIT: Fix local use of devm_*()

2023-10-14 Thread Andy Shevchenko
for educational purposes." -- With Best Regards, Andy Shevchenko

Re: [PATCH v2 3/6] ACPI: AC: Replace acpi_driver with platform_driver

2023-10-07 Thread Andy Shevchenko
eed to get from ac to > the underlying platform device, a pointer to it can be added to struct > acpi_ac without removing the ACPI device pointer from it. The idea behind is to eliminate data duplication. > > unsigned long long state; > > struct notifier_block battery_nb; > > }; -- With Best Regards, Andy Shevchenko

Re: [PATCH v2 3/6] ACPI: AC: Replace acpi_driver with platform_driver

2023-10-06 Thread Andy Shevchenko
event) { > default: > - acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n", > + acpi_handle_debug(ACPI_HANDLE(ac->dev), "Unsupported event > [0x%x]\n", > event); Does it makes any sense now? Basically it duplicates the ACPI_COMPANION() call as Rafael pointed out in previous version discussion. > fallthrough; -- With Best Regards, Andy Shevchenko

Re: [PATCH v1 1/1] ACPI: NFIT: Switch to use acpi_evaluate_dsm_typed()

2023-10-03 Thread Andy Shevchenko
On Mon, Oct 02, 2023 at 10:27:02PM +0200, Wilczynski, Michal wrote: > On 10/2/2023 3:54 PM, Andy Shevchenko wrote: ... > > + out_obj = acpi_evaluate_dsm_typed(handle, guid, revid, func, _obj, > > ACPI_TYPE_BUFFER); > > This line is 90 characters long, wouldn't it be be

[PATCH v1 1/1] ACPI: NFIT: Switch to use acpi_evaluate_dsm_typed()

2023-10-02 Thread Andy Shevchenko
The acpi_evaluate_dsm_typed() provides a way to check the type of the object evaluated by _DSM call. Use it instead of open coded variant. Signed-off-by: Andy Shevchenko --- drivers/acpi/nfit/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/nfit

[PATCH v2 4/5] params: Sort headers

2023-10-02 Thread Andy Shevchenko
Sort the headers in alphabetic order in order to ease the maintenance for this part. Signed-off-by: Andy Shevchenko --- kernel/params.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/params.c b/kernel/params.c index c3a029fe183d..eb55b32399b4 100644

[PATCH v2 1/5] params: Introduce the param_unknown_fn type

2023-10-02 Thread Andy Shevchenko
Introduce a new type for the callback to parse an unknown argument. This unifies function prototypes which takes that as a parameter. Signed-off-by: Andy Shevchenko --- include/linux/moduleparam.h | 6 +++--- kernel/params.c | 8 ++-- 2 files changed, 5 insertions(+), 9

[PATCH v2 3/5] params: Use size_add() for kmalloc()

2023-10-02 Thread Andy Shevchenko
Prevent allocations from integer overflow by using size_add(). Signed-off-by: Andy Shevchenko --- kernel/params.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/params.c b/kernel/params.c index f8e3c4139854..c3a029fe183d 100644 --- a/kernel/params.c +++ b/kernel

[PATCH v2 0/5] params: harden string ops and allocatio ops

2023-10-02 Thread Andy Shevchenko
mit() conversion as it revealed an issue, i.e. reuse getters with non-page-aligned pointer, which would be addressed separately - added cover letter and clarified the possible route for the series (Luis) Andy Shevchenko (5): params: Introduce the param_unknown_fn type params: Do not go o

[PATCH v2 2/5] params: Do not go over the limit when getting the string length

2023-10-02 Thread Andy Shevchenko
We can use strnlen() even on early stages and it prevents from going over the string boundaries in case it's already too long. Signed-off-by: Andy Shevchenko --- kernel/params.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/params.c b/kernel/params.c index

[PATCH v2 5/5] params: Fix multi-line comment style

2023-10-02 Thread Andy Shevchenko
The multi-line comment style in the file is rather arbitrary. Make it follow the standard one. Signed-off-by: Andy Shevchenko --- kernel/params.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel/params.c b/kernel/params.c index eb55b32399b4

Re: [PATCH v1 2/2] ACPI: NFIT: Use modern scope based rollback

2023-10-02 Thread Andy Shevchenko
On Tue, Sep 26, 2023 at 09:45:20PM +0300, Michal Wilczynski wrote: > Change rollback in acpi_nfit_init_interleave_set() to use modern scope > based attribute __free(). This is similar to C++ RAII and is a preferred > way for handling local memory allocations. LGTM, Reviewed-by: Andy S

Re: [PATCH v1 1/2] ACPI: NFIT: Fix memory leak, and local use of devm_*()

2023-10-02 Thread Andy Shevchenko
local leak'. > > Fix this by switching from devm_kcalloc() to kcalloc(), and adding > proper rollback. LGTM, Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko

Re: [PATCH v1 9/9] ACPI: NFIT: Don't use KBUILD_MODNAME for driver name

2023-09-25 Thread Andy Shevchenko
we won't have any users outside of existing model (instantiating via ACPI ID). All the above is "strictly speaking"... -- With Best Regards, Andy Shevchenko

Re: [PATCH v1 1/1] lib/string_helpers: Don't copy a tail in kstrdup_and_replace() if 'new' is \0

2023-09-14 Thread Andy Shevchenko
On Wed, Sep 13, 2023 at 12:45:57PM +0300, Andy Shevchenko wrote: > The kstrdup_and_replace() takes two characters, old and new, to replace > former with latter after the copying of the original string. But in case > when new is a NUL, there is no point to copy the rest of t

[PATCH v1 1/1] lib/string_helpers: Don't copy a tail in kstrdup_and_replace() if 'new' is \0

2023-09-13 Thread Andy Shevchenko
string and not a buffer of the size filled with a given data. With this we can optimize the memory consumption by copying only meaningful part of the original string and drop the rest. Signed-off-by: Andy Shevchenko --- The first user of this is pending: https://lore.kernel.org/platform-driver-x86

Re: [PATCH] nvdimm: Replace the usage of a variable by a direct function call in nd_pfn_validate()

2023-04-14 Thread Andy Shevchenko
th uuid_equal(). > return -ENODEV; -- With Best Regards, Andy Shevchenko

Re: [PATCH v1 1/1] nvdimm/namespace: return uuid_null only once in nd_dev_to_uuid()

2022-07-14 Thread Andy Shevchenko
On Thu, Jul 14, 2022 at 11:24:05AM -0700, Dan Williams wrote: > Andy Shevchenko wrote: > > Refactor nd_dev_to_uuid() in order to make code shorter and cleaner > > by joining conditions and hence returning uuid_null only once. > > Apologies for the delay, applied for v5.20.

Re: [PATCH v1 1/1] nvdimm/namespace: drop nested variable in create_namespace_pmem()

2022-06-21 Thread Andy Shevchenko
On Tue, Jun 07, 2022 at 07:49:37PM +0300, Andy Shevchenko wrote: > Kernel build bot reported: > > namespace_devs.c:1991:10: warning: Local variable 'uuid' shadows outer > variable [shadowVariable] > > Refactor create_namespace_pmem() by dropping a nested version of > th

[PATCH v1 1/1] nvdimm/namespace: drop nested variable in create_namespace_pmem()

2022-06-07 Thread Andy Shevchenko
ernel test robot Signed-off-by: Andy Shevchenko --- drivers/nvdimm/namespace_devs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index 0f863fda56e6..dfade66bab73 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/driv

[PATCH v1 1/1] nvdimm/namespace: drop unneeded temporary variable in size_store()

2022-06-07 Thread Andy Shevchenko
Refactor size_store() in order to remove temporary variable on stack by joining conditionals. Signed-off-by: Andy Shevchenko --- drivers/nvdimm/namespace_devs.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm

[PATCH v1 1/1] nvdimm/namespace: return uuid_null only once in nd_dev_to_uuid()

2022-06-07 Thread Andy Shevchenko
Refactor nd_dev_to_uuid() in order to make code shorter and cleaner by joining conditions and hence returning uuid_null only once. Signed-off-by: Andy Shevchenko --- drivers/nvdimm/namespace_devs.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/nvdimm

Re: [PATCH v1 1/1] ACPI: Switch to use list_entry_is_head() helper

2022-03-02 Thread Andy Shevchenko
On Wed, Mar 02, 2022 at 05:36:20PM +0100, Rafael J. Wysocki wrote: > On Wed, Mar 2, 2022 at 4:50 PM Andy Shevchenko > wrote: > > On Fri, Feb 11, 2022 at 01:04:23PM +0200, Andy Shevchenko wrote: > > > Since we got list_entry_is_head() helper in the generic header, > &g

Re: [PATCH v1 1/1] ACPI: Switch to use list_entry_is_head() helper

2022-03-02 Thread Andy Shevchenko
On Fri, Feb 11, 2022 at 01:04:23PM +0200, Andy Shevchenko wrote: > Since we got list_entry_is_head() helper in the generic header, > we may switch the ACPI modules to use it. This eliminates the > need in additional variable. In some cases it reduces critical > sections as well. Besi

[PATCH v1 1/1] ACPI: Switch to use list_entry_is_head() helper

2022-02-11 Thread Andy Shevchenko
Since we got list_entry_is_head() helper in the generic header, we may switch the ACPI modules to use it. This eliminates the need in additional variable. In some cases it reduces critical sections as well. Signed-off-by: Andy Shevchenko --- drivers/acpi/acpi_ipmi.c | 16

[PATCH v1 1/1] ACPI: NFIT: Import GUID before use

2021-12-13 Thread Andy Shevchenko
Strictly speaking the comparison between guid_t and raw buffer is not correct. Import GUID to variable of guid_t type and then compare. Signed-off-by: Andy Shevchenko --- drivers/acpi/nfit/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/nfit/core.c b

Re: [PATCH V7 08/18] x86/entry: Preserve PKRS MSR across exceptions

2021-12-02 Thread Andy Lutomirski
possible places for preserving this state were considered, irqentry_state_t or pt_regs.[1] pt_regs was much more complicated and was potentially fraught with unintended consequences.[2] However, Andy came up with a way to hide additional values on the stack which could be accessed as "extended_pt

[PATCH v2 2/2] spi: Avoid undefined behaviour when counting unused native CSs

2021-04-20 Thread Andy Shevchenko
ffz(), that has been used to count unused native CSs, might cause undefined behaviour when called against ~0U. To fix that, open code it with ffs(~value) - 1. Fixes: 7d93aecdb58d ("spi: Add generic support for unused native cs with cs-gpios") Signed-off-by: Andy Shevchenko --- v2:

[PATCH v2 1/2] spi: Allow to have all native CSs in use along with GPIOs

2021-04-20 Thread Andy Shevchenko
port for unused native cs with cs-gpios") Signed-off-by: Andy Shevchenko --- v2: no changes drivers/spi/spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 36c46feab6d4..9c3730a9f7d5 100644 --- a/drivers/spi/spi.c +++

[PATCH v2 1/1] spi: Make error handling of gpiod_count() call cleaner

2021-04-20 Thread Andy Shevchenko
() call cleaner. Note, that gpiod_count() never returns 0, take this into account as well. Signed-off-by: Andy Shevchenko --- v2: reformulated commit message and dropped Fixes tag drivers/spi/spi.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi.c

Re: [PATCH v1 2/2] spi: Avoid potential UB when counting unused native CSs

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 03:56:16PM +0100, Mark Brown wrote: > On Tue, Apr 20, 2021 at 05:10:04PM +0300, Andy Shevchenko wrote: > > ffz(), that has been used to count unused native CSs, might produce UB > > Bit of an IA there... UB -- undefined behaviour. I'll decode it. Sho

Re: [RESEND v2] iommu/vt-d: Use passthrough mode for the Intel IPUs

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 05:37:27PM +0300, Sakari Ailus wrote: > On Tue, Apr 20, 2021 at 02:55:33PM +0300, Andy Shevchenko wrote: > > On Tue, Apr 20, 2021 at 01:56:40PM +0300, Sakari Ailus wrote: > > > On Tue, Apr 20, 2021 at 06:34:26PM +0800, Bingbu Cao wrote: > > >

Re: [PATCH v1 1/1] spi: Don't overwrite num_chipselect with error code

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 4:19 PM Andy Shevchenko wrote: > > The code currently organized in a way that num_chipselect is overwritten > each time we call spi_get_gpio_descs(). It might be potentially dangerous > in case when the gpiod_count() returns an error code. > > Note

[PATCH v1 1/2] spi: Allow to have all native CSs in use along with GPIOs

2021-04-20 Thread Andy Shevchenko
port for unused native cs with cs-gpios") Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 36c46feab6d4..9c3730a9f7d5 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.

[PATCH v1 2/2] spi: Avoid potential UB when counting unused native CSs

2021-04-20 Thread Andy Shevchenko
ffz(), that has been used to count unused native CSs, might produce UB when called against ~0U. To fix that, open code it with ffs(~value) - 1. Fixes: 7d93aecdb58d ("spi: Add generic support for unused native cs with cs-gpios") Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c

[PATCH v1 1/1] spi: Don't overwrite num_chipselect with error code

2021-04-20 Thread Andy Shevchenko
("spi: Optionally use GPIO descriptors for CS GPIOs") Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 74b2b1dd358b..36c46feab6d4 100644 --- a/drivers/spi/s

[PATCH v1 1/1] spi: Rename enable1 to activate in spi_set_cs()

2021-04-20 Thread Andy Shevchenko
The enable1 is confusing name. Change it to clearly show what is the intention behind it. No functional changes. Fixes: 25093bdeb6bc ("spi: implement SW control for CS times") Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 9 - 1 file changed, 4 insertions(+), 5

Re: linux-next: Tree for Apr 20

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 03:19:39PM +0300, Andy Shevchenko wrote: > On Tue, Apr 20, 2021 at 03:02:51PM +0300, Andy Shevchenko wrote: > > On Tue, Apr 20, 2021 at 07:47:18PM +1000, Stephen Rothwell wrote: ... > > I have full of build warnings / errors in x86 and iommu Fo

Re: linux-next: Tree for Apr 20

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 03:02:51PM +0300, Andy Shevchenko wrote: > On Tue, Apr 20, 2021 at 07:47:18PM +1000, Stephen Rothwell wrote: > > Hi all, > > > > Changes since 20210419: > > > > The powerpc tree lost its build failure. > > > > The ftrace tre

Re: [PATCH v3 2/2] iio: accel: Add driver for Murata SCA3300 accelerometer

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 2:36 PM Tomas Melin wrote: > On 4/20/21 1:47 PM, Andy Shevchenko wrote: > > On Tue, Apr 20, 2021 at 11:50 AM Tomas Melin > > wrote: ... > >>>> + for_each_set_bit(bit, indio_dev->active_scan_mask, > >>>>

Re: linux-next: Tree for Apr 20

2021-04-20 Thread Andy Shevchenko
ned int, size_t, struct iommu_iotlb_gather *)’ {aka ‘long unsigned int (*)(struct io_pgtable_ops *, long unsigned int, unsigned int, struct iommu_iotlb_gather *)’} [-Werror=incompatible-pointer-types] 551 | pgtable->iop.ops.unmap= iommu_v1_unmap_page; |^ cc1: some warnings being treated as errors Is it only me? -- With Best Regards, Andy Shevchenko

Re: [RESEND v2] iommu/vt-d: Use passthrough mode for the Intel IPUs

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 01:56:40PM +0300, Sakari Ailus wrote: > On Tue, Apr 20, 2021 at 06:34:26PM +0800, Bingbu Cao wrote: > > On 4/20/21 6:20 PM, Andy Shevchenko wrote: > > > On Tue, Apr 20, 2021 at 10:48:33AM +0800, Bingbu Cao wrote: ... > > > This misses the

Re: [PATCH v3 2/2] iio: accel: Add driver for Murata SCA3300 accelerometer

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 11:50 AM Tomas Melin wrote: > On 4/19/21 4:55 PM, Andy Shevchenko wrote: > > On Mon, Apr 19, 2021 at 4:26 PM Tomas Melin wrote: ... > >> +#define SCA3300_MASK_STATUSGENMASK(8, 0) > >> +#define SCA3300_MASK_RS_STATUS GENMASK(1, 0) &g

Re: [PATCH] optee: use export_uuid() to copy client UUID

2021-04-20 Thread Andy Shevchenko
fined binary representation and also add an octets field in struct > optee_msg_param in order to avoid casting. Wonderful! Thanks for fixing this! Reviewed-by: Andy Shevchenko A bit of off-topic, have you know by any chance who may consider applying this one? https://lore.kernel

Re: [RESEND v2] iommu/vt-d: Use passthrough mode for the Intel IPUs

2021-04-20 Thread Andy Shevchenko
I'm wondering if IPU MMU should be described properly in the DMAR table. -- With Best Regards, Andy Shevchenko

Re: [RESEND v2] iommu/vt-d: Use passthrough mode for the Intel IPUs

2021-04-20 Thread Andy Shevchenko
> > Fixes: 26f5689592e2 ("media: staging/intel-ipu3: mmu: Implement driver") > Signed-off-by: Bingbu Cao > --- > drivers/iommu/intel/iommu.c | 29 + This misses the changelog from v1 followed by the explanation why resent. -- With Best Regards, Andy Shevchenko

Re: [PATCH 0/2] bitmap_parselist: support 'all' semantics

2021-04-20 Thread Andy Shevchenko
y second bit in cpumask may be selected like this: > isolcpus=all:1/2 After addressing a couple of nit-picks, Reviewed-by: Andy Shevchenko > Yury Norov (2): > bitmap_parse: support 'all' semantics > rcu/tree_plugin: don't handle the case of 'all' CPU range > > Docume

Re: [PATCH 2/2] rcu/tree_plugin: don't handle the case of 'all' CPU range

2021-04-20 Thread Andy Shevchenko
mp(str, "all"))/* legacy: use "0-N" instead */ Perhaps move comment as well to new location. -- With Best Regards, Andy Shevchenko

Re: [PATCH 1/2] bitmap_parse: support 'all' semantics

2021-04-20 Thread Andy Shevchenko
t; {-EINVAL, "10-1", NULL, 8, 0}, > @@ -384,7 +391,6 @@ static const struct test_bitmap_parselist > parselist_tests[] __initconst = { > {-EINVAL, "a-31:10/1", NULL, 8, 0}, > {-EINVAL, "0-31:a/1", NULL, 8, 0}, > {-EINVAL, "0-\n", NULL, 8, 0}, > - Otherwise this change doesn't belong to the series. -- With Best Regards, Andy Shevchenko

Re: [PATCH v1 1/1] pinctrl: core: Show pin numbers for the controllers with base = 0

2021-04-20 Thread Andy Shevchenko
On Tue, Apr 20, 2021 at 12:32:18AM -0700, Drew Fustini wrote: > On Thu, Apr 15, 2021 at 04:03:56PM +0300, Andy Shevchenko wrote: > > The commit f1b206cf7c57 ("pinctrl: core: print gpio in pins debugfs file") > > enabled GPIO pin number and label in debugfs fo

  1   2   3   4   5   6   7   8   9   10   >