Re: [Intel-gfx] [PATCH v5 0/7] Introduce __xchg, non-atomic xchg

2024-04-05 Thread Andrzej Hajda
On 05.04.2024 16:47, Jani Nikula wrote: On Mon, 27 Feb 2023, Peter Zijlstra wrote: On Thu, Feb 23, 2023 at 10:24:19PM +0100, Andrzej Hajda wrote: On 22.02.2023 18:04, Peter Zijlstra wrote: On Wed, Jan 18, 2023 at 04:35:22PM +0100, Andrzej Hajda wrote: Andrzej Hajda (7): arch: rename

Re: [Intel-gfx] [PATCH v5 0/7] Introduce __xchg, non-atomic xchg

2023-02-23 Thread Andrzej Hajda
On 22.02.2023 18:04, Peter Zijlstra wrote: On Wed, Jan 18, 2023 at 04:35:22PM +0100, Andrzej Hajda wrote: Andrzej Hajda (7): arch: rename all internal names __xchg to __arch_xchg linux/include: add non-atomic version of xchg arch/*/uprobes: simplify arch_uretprobe_hijack_return_addr

Re: [Intel-gfx] [PATCH v5 0/7] Introduce __xchg, non-atomic xchg

2023-02-22 Thread Andrzej Hajda
Hi, Ping on the series. Arnd, Andrew is there anything more I can do to push the process forward? Regards Andrzej On 18.01.2023 16:35, Andrzej Hajda wrote: Hi all, The helper is tiny and there are advices we can live without it, so I want to present few arguments why it would be good

[PATCH v5 7/7] drm/i915/gt: use __xchg instead of internal helper

2023-01-18 Thread Andrzej Hajda
Prefer core helper if available. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/i915/gt/intel_engine_cs.c| 2 +- drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c | 4 ++-- drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 4 ++-- drivers/gpu/drm/i915/gt/intel_ggtt.c

[PATCH v5 6/7] qed: use __xchg if possible

2023-01-18 Thread Andrzej Hajda
Recently introduced helper simplifies the code. Signed-off-by: Andrzej Hajda --- include/linux/qed/qed_chain.h | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/include/linux/qed/qed_chain.h b/include/linux/qed/qed_chain.h index a84063492c71ae

[PATCH v5 5/7] io_uring: use __xchg if possible

2023-01-18 Thread Andrzej Hajda
Recently introduced helper simplifies the code. Signed-off-by: Andrzej Hajda --- io_uring/io_uring.c | 7 ++- io_uring/slist.h| 6 ++ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 2ac1cd8d23ea62..2b46a692d69022 100644

[PATCH v5 4/7] llist: simplify __llist_del_all

2023-01-18 Thread Andrzej Hajda
llist_del_all uses xchg, let's use __xchg here. Signed-off-by: Andrzej Hajda --- include/linux/llist.h | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/llist.h b/include/linux/llist.h index 85bda2d02d65be..4dc1d185ea98ab 100644 --- a/include/linux/llist.h

[PATCH v5 3/7] arch/*/uprobes: simplify arch_uretprobe_hijack_return_addr

2023-01-18 Thread Andrzej Hajda
In all architectures, except x86, arch_uretprobe_hijack_return_addr is just __xchg. Signed-off-by: Andrzej Hajda --- arch/arm/probes/uprobes/core.c | 8 ++-- arch/arm64/kernel/probes/uprobes.c | 9 ++--- arch/csky/kernel/probes/uprobes.c | 9 ++--- arch/mips/kernel/uprobes.c

[PATCH v5 2/7] linux/include: add non-atomic version of xchg

2023-01-18 Thread Andrzej Hajda
The pattern of setting variable with new value and returning old one is very common in kernel. Usually atomicity of the operation is not required, so xchg seems to be suboptimal and confusing in such cases. Signed-off-by: Andrzej Hajda Reviewed-by: Andy Shevchenko --- include/linux/non-atomic

[PATCH v5 1/7] arch: rename all internal names __xchg to __arch_xchg

2023-01-18 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda Reviewed-by: Arnd Bergmann Acked-by: Geert Uytterhoeven [m68k] Acked-by: Palmer Dabbelt [riscv] --- v2: squashed all arch patches into one v3: fixed alpha/xchg_local, thx to l...@intel.com v4: adjusted indentation

[PATCH v5 0/7] Introduce __xchg, non-atomic xchg

2023-01-18 Thread Andrzej Hajda
cpp/header/utility Regards Andrzej Andrzej Hajda (7): arch: rename all internal names __xchg to __arch_xchg linux/include: add non-atomic version of xchg arch/*/uprobes: simplify arch_uretprobe_hijack_return_addr llist: simplify __llist_del_all io_uring: use __xchg if possible qed:

Re: [Intel-gfx] [RFC DO NOT MERGE] treewide: use __xchg in most obvious places

2023-01-10 Thread Andrzej Hajda
On 10.01.2023 12:07, Andy Shevchenko wrote: On Tue, Jan 10, 2023 at 11:53:06AM +0100, Andrzej Hajda wrote: This patch tries to show usability of __xchg helper. It is not intended to be merged, but I can convert it to proper patchset if necessary. There are many more places where __xchg can

[RFC DO NOT MERGE] treewide: use __xchg in most obvious places

2023-01-10 Thread Andrzej Hajda
-by: Andrzej Hajda --- arch/arm/probes/uprobes/core.c| 8 ++-- arch/csky/kernel/probes/uprobes.c | 9 ++--- arch/mips/kernel/irq_txx9.c | 7 ++- arch/mips/kernel/process.c| 8 +++- arch/mips/kernel/uprobes.c

[PATCH v4] arch: rename all internal names __xchg to __arch_xchg

2023-01-05 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda Reviewed-by: Arnd Bergmann --- v2: squashed all arch patches into one v3: fixed alpha/xchg_local, thx to l...@intel.com v4: adjusted indentation (Heiko) --- arch/alpha/include/asm/cmpxchg.h | 10 +- arch

[PATCH v3] arch: rename all internal names __xchg to __arch_xchg

2022-12-30 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda Reviewed-by: Arnd Bergmann --- v2: squashed all arch patches into one v3: fixed alpha/xchg_local, thx to l...@intel.com --- arch/alpha/include/asm/cmpxchg.h | 8 arch/arc/include/asm/cmpxchg.h | 4

[PATCH v2] arch: rename all internal names __xchg to __arch_xchg

2022-12-29 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda Reviewed-by: Arnd Bergmann --- arch/alpha/include/asm/cmpxchg.h | 6 +++--- arch/arc/include/asm/cmpxchg.h | 4 ++-- arch/arm/include/asm/cmpxchg.h | 4 ++-- arch/arm64/include/asm/cmpxchg.h | 4

Re: [PATCH 00/19] Introduce __xchg, non-atomic xchg

2022-12-29 Thread Andrzej Hajda
Forgive me late response - Holidays, On 22.12.2022 18:21, Andrew Morton wrote: On Thu, 22 Dec 2022 12:46:16 +0100 Andrzej Hajda wrote: Hi all, I hope there will be place for such tiny helper in kernel. Quick cocci analyze shows there is probably few thousands places where it could

Re: [PATCH 00/19] Introduce __xchg, non-atomic xchg

2022-12-22 Thread Andrzej Hajda
On 22.12.2022 15:12, Geert Uytterhoeven wrote: Hi Andrzej, Thanks for your series! On Thu, Dec 22, 2022 at 12:49 PM Andrzej Hajda wrote: I hope there will be place for such tiny helper in kernel. Quick cocci analyze shows there is probably few thousands places where it could be useful. I

[PATCH 19/19] drm/i915/gt: use __xchg instead of internal helper

2022-12-22 Thread Andrzej Hajda
Prefer core helper if available. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/i915/gt/intel_engine_cs.c| 2 +- drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c | 4 ++-- drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 4 ++-- drivers/gpu/drm/i915/gt/intel_ggtt.c

[PATCH 18/19] linux/include: add non-atomic version of xchg

2022-12-22 Thread Andrzej Hajda
The pattern of setting variable with new value and returning old one is very common in kernel. Usually atomicity of the operation is not required, so xchg seems to be suboptimal and confusing in such cases. Signed-off-by: Andrzej Hajda --- include/linux/non-atomic/xchg.h | 19

[PATCH 17/19] arch/xtensa: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/xtensa/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/xtensa/include/asm/cmpxchg.h b/arch/xtensa/include/asm/cmpxchg.h index eb87810357ad88..675a11ea8de76b

[PATCH 16/19] arch/sparc: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/sparc/include/asm/cmpxchg_32.h | 4 ++-- arch/sparc/include/asm/cmpxchg_64.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include

[PATCH 15/19] arch/sh: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/sh/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sh/include/asm/cmpxchg.h b/arch/sh/include/asm/cmpxchg.h index 0ed9b3f4a57796..288f6f38d98fb4 100644

[PATCH 14/19] arch/s390: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/s390/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/include/asm/cmpxchg.h b/arch/s390/include/asm/cmpxchg.h index 84c3f0d576c5b1..efc16f4aac8643 100644

[PATCH 13/19] arch/riscv: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/riscv/include/asm/atomic.h | 2 +- arch/riscv/include/asm/cmpxchg.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/riscv/include/asm/atomic.h b/arch/riscv/include/asm/atomic.h

[PATCH 12/19] arch/powerpc: correct logged function names in xchg helpers

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/powerpc/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/cmpxchg.h b/arch/powerpc/include/asm/cmpxchg.h index 05f246c0e36eb3

[PATCH 11/19] arch/parisc: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/parisc/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h index 5f274be105671e..c1d776bb16b4ed

[PATCH 10/19] arch/openrisc: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/openrisc/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/openrisc/include/asm/cmpxchg.h b/arch/openrisc/include/asm/cmpxchg.h index 79fd16162ccb6d

[PATCH 09/19] arch/mips: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/mips/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h index 7ec9493b28614f..feed343ad483a9 100644

[PATCH 08/19] arch/m68k: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/m68k/include/asm/cmpxchg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/m68k/include/asm/cmpxchg.h b/arch/m68k/include/asm/cmpxchg.h index 6cf464cdab067e..d7f3de9c5d6f79 100644

[PATCH 07/19] arch/loongarch: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/loongarch/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/loongarch/include/asm/cmpxchg.h b/arch/loongarch/include/asm/cmpxchg.h index ecfa6cf79806e6

[PATCH 06/19] arch/ia64: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/ia64/include/asm/cmpxchg.h | 2 +- arch/ia64/include/uapi/asm/cmpxchg.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/ia64/include/asm/cmpxchg.h b/arch/ia64/include/asm

[PATCH 05/19] arch/hexagon: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/hexagon/include/asm/cmpxchg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h index cdb705e1496af8

[PATCH 04/19] arch/arm64: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/arm64/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h index 497acf134d9923..3a36ba58e8c2ef

[PATCH 03/19] arch/arm: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/arm/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h index 4dfe538dfc689b..6953fc05a97886 100644

[PATCH 02/19] arch/arc: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/arc/include/asm/cmpxchg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h index c5b544a5fe8106..e138fde067dea5 100644

[PATCH 01/19] arch/alpha: rename internal name __xchg to __arch_xchg

2022-12-22 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro. Signed-off-by: Andrzej Hajda --- arch/alpha/include/asm/cmpxchg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h index 6e0a850aa9d38c..40e8159ef6e794

[PATCH 00/19] Introduce __xchg, non-atomic xchg

2022-12-22 Thread Andrzej Hajda
svaybv4xc...@smile.fi.intel.com/T/ [1]: https://doc.rust-lang.org/std/mem/index.html [2]: https://en.cppreference.com/w/cpp/header/utility Regards Andrzej Andrzej Hajda (19): arch/alpha: rename internal name __xchg to __arch_xchg arch/arc: rename internal name __xchg to __arch_xchg arch/arm: rename inte

[PATCH] powerpc/powernv/pci: fix iterator signedness

2016-08-17 Thread Andrzej Hajda
Unsigned type is always non-negative, so the loop could not end in case condition is never true. The problem has been detected using semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci Signed-off-by: Andrzej Hajda <a.ha...@samsung.com> --- arch/powerpc/platforms/power

[PATCH 7/7] usb: gadget: fsl_qe_udc: fix IS_ERR_VALUE usage

2016-02-15 Thread Andrzej Hajda
-by: Andrzej Hajda <a.ha...@samsung.com> --- drivers/usb/gadget/udc/fsl_qe_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index 53c0692..93d28cb 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.c

[PATCH 0/7] fix IS_ERR_VALUE usage

2016-02-15 Thread Andrzej Hajda
http://permalink.gmane.org/gmane.linux.kernel/2120927 [2]: http://permalink.gmane.org/gmane.linux.kernel/2150581 Regards Andrzej Andrzej Hajda (7): netfilter: fix IS_ERR_VALUE usage MIPS: module: fix incorrect IS_ERR_VALUE macro usages drivers: char: mem: fix IS_ERROR_VALUE usage atmel-isi: fix IS_ERR

[PATCH 15/19] KVM: PPC: e500: fix handling local_sid_lookup result

2015-09-24 Thread Andrzej Hajda
The function can return negative value. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107 Signed-off-by: Andrzej Hajda <a.ha...@samsung.com> --- Hi, To

[PATCH 05/31] arch/powerpc/nvram: use kmemdup rather than duplicating its implementation

2015-08-07 Thread Andrzej Hajda
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda a.ha...@samsung.com --- arch/powerpc/kernel/nvram_64.c | 3 +-- 1 file changed, 1 insertion(+), 2

[PATCH 06/31] arch/powerpc/pseries: use kmemdup rather than duplicating its implementation

2015-08-07 Thread Andrzej Hajda
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda a.ha...@samsung.com --- arch/powerpc/platforms/pseries/hotplug-memory.c | 3 +-- 1 file changed, 1

Re: [PATCH] of/platform: Move platform devices under /sys/devices/platform

2014-11-18 Thread Andrzej Hajda
On 11/04/2014 11:45 AM, Grant Likely wrote: Currently the devices created by drivers/of/platform.c get created at the root of /sys/devices. This goes against the typical pattern for sysfs where the top level /sys/devices structure contains categories of devices, and the structure of devices is

[PATCH 0/2] backlight: remove trivial get_brightness implementations

2014-05-30 Thread Andrzej Hajda
This patchset makes get_brightness callback optional and removes trivial implementations. Driver changes are quite obvious so I have put them into single patch. The patchset is based on the current linux-next branch. Regards Andrzej Andrzej Hajda (2): backlight: show brightness even

[PATCH 1/2] backlight: show brightness even if get_brightness is not implemented

2014-05-30 Thread Andrzej Hajda
Many implementations of get_brightness operation returns only value of props.brightness field. This change makes such implementations unnecessary. Signed-off-by: Andrzej Hajda a.ha...@samsung.com --- drivers/video/backlight/backlight.c | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH 2/2] backlight: remove trivial get_brightness implementations

2014-05-30 Thread Andrzej Hajda
Since backlight core returns props.brightness in case get_brightness is not implemented trivial implementations are not needed anymore. Signed-off-by: Andrzej Hajda a.ha...@samsung.com --- drivers/macintosh/via-pmu-backlight.c | 6 -- drivers/platform/x86/samsung-q10.c | 6