Re: [linux-yocto][v5.15/standard/preempt-rt/sdkv5.15/xlnx-soc][PATCH] driver: soc: xilinx: rename cpu_number1 to dummy_cpu_number

2024-01-18 Thread Bruce Ashfield
In message: [linux-yocto][v5.15/standard/preempt-rt/sdkv5.15/xlnx-soc][PATCH] 
driver: soc: xilinx: rename cpu_number1 to dummy_cpu_number
on 17/01/2024 quanyang.w...@windriver.com wrote:

> From: Quanyang Wang 
> 
> The per cpu variable cpu_number1 is passed to xlnx_event_handler as
> argument "dev_id", but is not used in this function. So drop the
> initialization of this variable and rename it to dummy_cpu_number.
> This patch is to fix the following calltrace when the kernel option
> CONFIG_DEBUG_ATOMIC_SLEEP is enabled:
> 
> BUG: sleeping function called from invalid context at 
> include/linux/sched/mm.h:274
> in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0
> preempt_count: 1, expected: 0
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.0 #53
> Hardware name: Xilinx Versal vmk180 Eval board rev1.1 (QSPI) (DT)
> Call trace:
>  dump_backtrace+0xd0/0xe0
>  show_stack+0x18/0x40
>  dump_stack_lvl+0x7c/0xa0
>  dump_stack+0x18/0x34
>  __might_resched+0x10c/0x140
>  __might_sleep+0x4c/0xa0
>  __kmem_cache_alloc_node+0xf4/0x168
>  kmalloc_trace+0x28/0x38
>  __request_percpu_irq+0x74/0x138
>  xlnx_event_manager_probe+0xf8/0x298
>  platform_probe+0x68/0xd8
> 
> Signed-off-by: Quanyang Wang 
> ---
> Hi Bruce,
> Would you please help merge this patch to the branches:
>   v5.15/standard/preempt-rt/sdkv5.15/xlnx-soc
>   v5.15/standard/sdkv5.15/xlnx-soc

merged.

Bruce


> Thanks,
> Quanyang
> ---
>  drivers/soc/xilinx/xlnx_event_manager.c | 14 +++---
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/soc/xilinx/xlnx_event_manager.c 
> b/drivers/soc/xilinx/xlnx_event_manager.c
> index cf152eb58d87a..1ab3486e64f95 100644
> --- a/drivers/soc/xilinx/xlnx_event_manager.c
> +++ b/drivers/soc/xilinx/xlnx_event_manager.c
> @@ -20,7 +20,7 @@
>  #include 
>  #include 
>  
> -static DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number1);
> +static DEFINE_PER_CPU_READ_MOSTLY(int, dummy_cpu_number);
>  
>  static int virq_sgi;
>  static int event_manager_availability = -EACCES;
> @@ -552,7 +552,6 @@ static void xlnx_disable_percpu_irq(void *data)
>  static int xlnx_event_init_sgi(struct platform_device *pdev)
>  {
>   int ret = 0;
> - int cpu;
>   /*
>* IRQ related structures are used for the following:
>* for each SGI interrupt ensure its mapped by GIC IRQ domain
> @@ -589,11 +588,8 @@ static int xlnx_event_init_sgi(struct platform_device 
> *pdev)
>   sgi_fwspec.param[0] = sgi_num;
>   virq_sgi = irq_create_fwspec_mapping(_fwspec);
>  
> - cpu = get_cpu();
> - per_cpu(cpu_number1, cpu) = cpu;
>   ret = request_percpu_irq(virq_sgi, xlnx_event_handler, 
> "xlnx_event_mgmt",
> -  _number1);
> - put_cpu();
> +  _cpu_number);
>  
>   WARN_ON(ret);
>   if (ret) {
> @@ -609,16 +605,12 @@ static int xlnx_event_init_sgi(struct platform_device 
> *pdev)
>  
>  static void xlnx_event_cleanup_sgi(struct platform_device *pdev)
>  {
> - int cpu = smp_processor_id();
> -
> - per_cpu(cpu_number1, cpu) = cpu;
> -
>   cpuhp_remove_state(CPUHP_AP_ONLINE_DYN);
>  
>   on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
>  
>   irq_clear_status_flags(virq_sgi, IRQ_PER_CPU);
> - free_percpu_irq(virq_sgi, _number1);
> + free_percpu_irq(virq_sgi, _cpu_number);
>   irq_dispose_mapping(virq_sgi);
>  }
>  
> -- 
> 2.36.1
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13499): 
https://lists.yoctoproject.org/g/linux-yocto/message/13499
Mute This Topic: https://lists.yoctoproject.org/mt/103780752/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy
 [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto][v5.15/standard/preempt-rt/sdkv5.15/xlnx-soc][PATCH] driver: soc: xilinx: rename cpu_number1 to dummy_cpu_number

2024-01-16 Thread quanyang.wang via lists.yoctoproject.org
From: Quanyang Wang 

The per cpu variable cpu_number1 is passed to xlnx_event_handler as
argument "dev_id", but is not used in this function. So drop the
initialization of this variable and rename it to dummy_cpu_number.
This patch is to fix the following calltrace when the kernel option
CONFIG_DEBUG_ATOMIC_SLEEP is enabled:

BUG: sleeping function called from invalid context at 
include/linux/sched/mm.h:274
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0
preempt_count: 1, expected: 0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.0 #53
Hardware name: Xilinx Versal vmk180 Eval board rev1.1 (QSPI) (DT)
Call trace:
 dump_backtrace+0xd0/0xe0
 show_stack+0x18/0x40
 dump_stack_lvl+0x7c/0xa0
 dump_stack+0x18/0x34
 __might_resched+0x10c/0x140
 __might_sleep+0x4c/0xa0
 __kmem_cache_alloc_node+0xf4/0x168
 kmalloc_trace+0x28/0x38
 __request_percpu_irq+0x74/0x138
 xlnx_event_manager_probe+0xf8/0x298
 platform_probe+0x68/0xd8

Signed-off-by: Quanyang Wang 
---
Hi Bruce,
Would you please help merge this patch to the branches:
v5.15/standard/preempt-rt/sdkv5.15/xlnx-soc
v5.15/standard/sdkv5.15/xlnx-soc
Thanks,
Quanyang
---
 drivers/soc/xilinx/xlnx_event_manager.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/soc/xilinx/xlnx_event_manager.c 
b/drivers/soc/xilinx/xlnx_event_manager.c
index cf152eb58d87a..1ab3486e64f95 100644
--- a/drivers/soc/xilinx/xlnx_event_manager.c
+++ b/drivers/soc/xilinx/xlnx_event_manager.c
@@ -20,7 +20,7 @@
 #include 
 #include 
 
-static DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number1);
+static DEFINE_PER_CPU_READ_MOSTLY(int, dummy_cpu_number);
 
 static int virq_sgi;
 static int event_manager_availability = -EACCES;
@@ -552,7 +552,6 @@ static void xlnx_disable_percpu_irq(void *data)
 static int xlnx_event_init_sgi(struct platform_device *pdev)
 {
int ret = 0;
-   int cpu;
/*
 * IRQ related structures are used for the following:
 * for each SGI interrupt ensure its mapped by GIC IRQ domain
@@ -589,11 +588,8 @@ static int xlnx_event_init_sgi(struct platform_device 
*pdev)
sgi_fwspec.param[0] = sgi_num;
virq_sgi = irq_create_fwspec_mapping(_fwspec);
 
-   cpu = get_cpu();
-   per_cpu(cpu_number1, cpu) = cpu;
ret = request_percpu_irq(virq_sgi, xlnx_event_handler, 
"xlnx_event_mgmt",
-_number1);
-   put_cpu();
+_cpu_number);
 
WARN_ON(ret);
if (ret) {
@@ -609,16 +605,12 @@ static int xlnx_event_init_sgi(struct platform_device 
*pdev)
 
 static void xlnx_event_cleanup_sgi(struct platform_device *pdev)
 {
-   int cpu = smp_processor_id();
-
-   per_cpu(cpu_number1, cpu) = cpu;
-
cpuhp_remove_state(CPUHP_AP_ONLINE_DYN);
 
on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
 
irq_clear_status_flags(virq_sgi, IRQ_PER_CPU);
-   free_percpu_irq(virq_sgi, _number1);
+   free_percpu_irq(virq_sgi, _cpu_number);
irq_dispose_mapping(virq_sgi);
 }
 
-- 
2.36.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13491): 
https://lists.yoctoproject.org/g/linux-yocto/message/13491
Mute This Topic: https://lists.yoctoproject.org/mt/103780752/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-