oe-kbuild.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers
@ 2023-02-14  2:11 ` kernel test robot
  2023-02-14  7:58   ` Dan Carpenter
  2023-02-14 17:22   ` Pietro Borrello
  0 siblings, 2 replies; 3+ messages in thread
From: kernel test robot @ 2023-02-14  2:11 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20230125-hid-unregister-leds-v3-2-0a52ac225e00@diag.uniroma1.it>
References: <20230125-hid-unregister-leds-v3-2-0a52ac225e00@diag.uniroma1.it>
TO: Pietro Borrello <borrello@diag.uniroma1.it>
TO: Jiri Kosina <jikos@kernel.org>
TO: Benjamin Tissoires <benjamin.tissoires@redhat.com>
TO: Hanno Zulla <kontakt@hanno.de>
TO: Carlo Caione <carlo@endlessm.com>
CC: Cristiano Giuffrida <c.giuffrida@vu.nl>
CC: "Bos, H.J." <h.j.bos@vu.nl>
CC: Jakob Koschel <jkl820.git@gmail.com>
CC: Roderick Colenbrander <roderick@gaikai.com>
CC: linux-input@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: Pietro Borrello <borrello@diag.uniroma1.it>

Hi Pietro,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 2241ab53cbb5cdb08a6b2d4688feb13971058f65]

url:    https://github.com/intel-lab-lkp/linux/commits/Pietro-Borrello/HID-bigben-use-spinlock-to-safely-schedule-workers/20230210-080058
base:   2241ab53cbb5cdb08a6b2d4688feb13971058f65
patch link:    https://lore.kernel.org/r/20230125-hid-unregister-leds-v3-2-0a52ac225e00%40diag.uniroma1.it
patch subject: [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: riscv-randconfig-m031-20230212 (https://download.01.org/0day-ci/archive/20230214/202302141039.anZLT940-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202302141039.anZLT940-lkp@intel.com/

smatch warnings:
drivers/hid/hid-asus.c:532 asus_kbd_backlight_work() warn: sleeping in atomic context

vim +532 drivers/hid/hid-asus.c

af22a610bc3850 Carlo Caione    2017-04-06  520  
af22a610bc3850 Carlo Caione    2017-04-06  521  static void asus_kbd_backlight_work(struct work_struct *work)
af22a610bc3850 Carlo Caione    2017-04-06  522  {
af22a610bc3850 Carlo Caione    2017-04-06  523  	struct asus_kbd_leds *led = container_of(work, struct asus_kbd_leds, work);
af22a610bc3850 Carlo Caione    2017-04-06  524  	u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4, 0x00 };
af22a610bc3850 Carlo Caione    2017-04-06  525  	int ret;
31e578b641b3b3 Pietro Borrello 2023-02-09  526  	unsigned long flags;
af22a610bc3850 Carlo Caione    2017-04-06  527  
31e578b641b3b3 Pietro Borrello 2023-02-09  528  	spin_lock_irqsave(&led->lock, flags);
af22a610bc3850 Carlo Caione    2017-04-06  529  
af22a610bc3850 Carlo Caione    2017-04-06  530  	buf[4] = led->brightness;
af22a610bc3850 Carlo Caione    2017-04-06  531  
af22a610bc3850 Carlo Caione    2017-04-06 @532  	ret = asus_kbd_set_report(led->hdev, buf, sizeof(buf));
af22a610bc3850 Carlo Caione    2017-04-06  533  	if (ret < 0)
af22a610bc3850 Carlo Caione    2017-04-06  534  		hid_err(led->hdev, "Asus failed to set keyboard backlight: %d\n", ret);
31e578b641b3b3 Pietro Borrello 2023-02-09  535  
31e578b641b3b3 Pietro Borrello 2023-02-09  536  	spin_unlock_irqrestore(&led->lock, flags);
af22a610bc3850 Carlo Caione    2017-04-06  537  }
af22a610bc3850 Carlo Caione    2017-04-06  538  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers
  2023-02-14  2:11 ` [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers kernel test robot
@ 2023-02-14  7:58   ` Dan Carpenter
  2023-02-14 17:22   ` Pietro Borrello
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-02-14  7:58 UTC (permalink / raw)
  To: oe-kbuild, Pietro Borrello, Jiri Kosina, Benjamin Tissoires,
	Hanno Zulla, Carlo Caione
  Cc: lkp, oe-kbuild-all, Cristiano Giuffrida, Bos, H.J.,
	Jakob Koschel, Roderick Colenbrander, linux-input, linux-kernel,
	Pietro Borrello

Hi Pietro,

url:    https://github.com/intel-lab-lkp/linux/commits/Pietro-Borrello/HID-bigben-use-spinlock-to-safely-schedule-workers/20230210-080058
base:   2241ab53cbb5cdb08a6b2d4688feb13971058f65
patch link:    https://lore.kernel.org/r/20230125-hid-unregister-leds-v3-2-0a52ac225e00%40diag.uniroma1.it
patch subject: [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers
config: riscv-randconfig-m031-20230212 (https://download.01.org/0day-ci/archive/20230214/202302141039.anZLT940-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202302141039.anZLT940-lkp@intel.com/

smatch warnings:
drivers/hid/hid-asus.c:532 asus_kbd_backlight_work() warn: sleeping in atomic context

vim +532 drivers/hid/hid-asus.c

af22a610bc3850 Carlo Caione    2017-04-06  521  static void asus_kbd_backlight_work(struct work_struct *work)
af22a610bc3850 Carlo Caione    2017-04-06  522  {
af22a610bc3850 Carlo Caione    2017-04-06  523  	struct asus_kbd_leds *led = container_of(work, struct asus_kbd_leds, work);
af22a610bc3850 Carlo Caione    2017-04-06  524  	u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4, 0x00 };
af22a610bc3850 Carlo Caione    2017-04-06  525  	int ret;
31e578b641b3b3 Pietro Borrello 2023-02-09  526  	unsigned long flags;
af22a610bc3850 Carlo Caione    2017-04-06  527  
31e578b641b3b3 Pietro Borrello 2023-02-09  528  	spin_lock_irqsave(&led->lock, flags);
                                                        ^^^^^^^^^^^^^^^^^
Holding a spinlock.

af22a610bc3850 Carlo Caione    2017-04-06  529  
af22a610bc3850 Carlo Caione    2017-04-06  530  	buf[4] = led->brightness;
af22a610bc3850 Carlo Caione    2017-04-06  531  
af22a610bc3850 Carlo Caione    2017-04-06 @532  	ret = asus_kbd_set_report(led->hdev, buf, sizeof(buf));
                                                              ^^^^^^^^^^^^^^^^^^^
asus_kbd_set_report() does a GFP_KERNEL allocation.


af22a610bc3850 Carlo Caione    2017-04-06  533  	if (ret < 0)
af22a610bc3850 Carlo Caione    2017-04-06  534  		hid_err(led->hdev, "Asus failed to set keyboard backlight: %d\n", ret);
31e578b641b3b3 Pietro Borrello 2023-02-09  535  
31e578b641b3b3 Pietro Borrello 2023-02-09  536  	spin_unlock_irqrestore(&led->lock, flags);
af22a610bc3850 Carlo Caione    2017-04-06  537  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers
  2023-02-14  2:11 ` [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers kernel test robot
  2023-02-14  7:58   ` Dan Carpenter
@ 2023-02-14 17:22   ` Pietro Borrello
  1 sibling, 0 replies; 3+ messages in thread
From: Pietro Borrello @ 2023-02-14 17:22 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: oe-kbuild, Jiri Kosina, Benjamin Tissoires, Hanno Zulla,
	Carlo Caione, lkp, oe-kbuild-all, Cristiano Giuffrida, Bos, H.J.,
	Jakob Koschel, Roderick Colenbrander, linux-input, linux-kernel

On Tue, 14 Feb 2023 at 08:58, Dan Carpenter <error27@gmail.com> wrote:
>
> Hi Pietro,
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Pietro-Borrello/HID-bigben-use-spinlock-to-safely-schedule-workers/20230210-080058
> base:   2241ab53cbb5cdb08a6b2d4688feb13971058f65
> patch link:    https://lore.kernel.org/r/20230125-hid-unregister-leds-v3-2-0a52ac225e00%40diag.uniroma1.it
> patch subject: [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers
> config: riscv-randconfig-m031-20230212 (https://download.01.org/0day-ci/archive/20230214/202302141039.anZLT940-lkp@intel.com/config)
> compiler: riscv32-linux-gcc (GCC) 12.1.0
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <error27@gmail.com>
> | Link: https://lore.kernel.org/r/202302141039.anZLT940-lkp@intel.com/
>
> smatch warnings:
> drivers/hid/hid-asus.c:532 asus_kbd_backlight_work() warn: sleeping in atomic context
>
> vim +532 drivers/hid/hid-asus.c
>
> af22a610bc3850 Carlo Caione    2017-04-06  521  static void asus_kbd_backlight_work(struct work_struct *work)
> af22a610bc3850 Carlo Caione    2017-04-06  522  {
> af22a610bc3850 Carlo Caione    2017-04-06  523          struct asus_kbd_leds *led = container_of(work, struct asus_kbd_leds, work);
> af22a610bc3850 Carlo Caione    2017-04-06  524          u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4, 0x00 };
> af22a610bc3850 Carlo Caione    2017-04-06  525          int ret;
> 31e578b641b3b3 Pietro Borrello 2023-02-09  526          unsigned long flags;
> af22a610bc3850 Carlo Caione    2017-04-06  527
> 31e578b641b3b3 Pietro Borrello 2023-02-09  528          spin_lock_irqsave(&led->lock, flags);
>                                                         ^^^^^^^^^^^^^^^^^
> Holding a spinlock.
>
> af22a610bc3850 Carlo Caione    2017-04-06  529
> af22a610bc3850 Carlo Caione    2017-04-06  530          buf[4] = led->brightness;
> af22a610bc3850 Carlo Caione    2017-04-06  531
> af22a610bc3850 Carlo Caione    2017-04-06 @532          ret = asus_kbd_set_report(led->hdev, buf, sizeof(buf));
>                                                               ^^^^^^^^^^^^^^^^^^^
> asus_kbd_set_report() does a GFP_KERNEL allocation.
>
>
> af22a610bc3850 Carlo Caione    2017-04-06  533          if (ret < 0)
> af22a610bc3850 Carlo Caione    2017-04-06  534                  hid_err(led->hdev, "Asus failed to set keyboard backlight: %d\n", ret);
> 31e578b641b3b3 Pietro Borrello 2023-02-09  535
> 31e578b641b3b3 Pietro Borrello 2023-02-09  536          spin_unlock_irqrestore(&led->lock, flags);
> af22a610bc3850 Carlo Caione    2017-04-06  537  }
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests
>

Hello,
Thank you, but the issue has already been fixed in v4.
Link: https://lore.kernel.org/lkml/20230125-hid-unregister-leds-v4-3-7860c5763c38@diag.uniroma1.it/T/#m8983ca3d0fbf656a40011a77c8988e3d16cac671

Best regards,
Pietro

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-14 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230125-hid-unregister-leds-v3-2-0a52ac225e00@diag.uniroma1.it>
2023-02-14  2:11 ` [PATCH v3 2/2] HID: asus: use spinlock to safely schedule workers kernel test robot
2023-02-14  7:58   ` Dan Carpenter
2023-02-14 17:22   ` Pietro Borrello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).