[v1,4/4] ACPI: OSL: Use GFP_KERNEL for work item allocations

Message ID 3552364.iIbC2pHGDl@kreacher
State New
Headers
Series ACPI: OSL: acpi_os_execute() improvements |

Commit Message

Rafael J. Wysocki Nov. 29, 2023, 1:52 p.m. UTC
  From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

After the recent modification changing the ACPI SCI interrupt handler
into a threaded one, the SCI interrupt handler code does not run in
interrupt context any more and acpi_os_execute(), that may be invoked
by it, need not use GFP_ATOMIC for allocating work items.

Make it use GFP_KERNEL instead.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/osl.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Andy Shevchenko Nov. 29, 2023, 2:10 p.m. UTC | #1
On Wed, Nov 29, 2023 at 02:52:22PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> After the recent modification changing the ACPI SCI interrupt handler
> into a threaded one, the SCI interrupt handler code does not run in
> interrupt context any more and acpi_os_execute(), that may be invoked
> by it, need not use GFP_ATOMIC for allocating work items.
> 
> Make it use GFP_KERNEL instead.

True, threader IRQ handler can sleep.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  
Rafael J. Wysocki Dec. 4, 2023, 3:26 p.m. UTC | #2
On Wed, Nov 29, 2023 at 3:33 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> After the recent modification changing the ACPI SCI interrupt handler
> into a threaded one, the SCI interrupt handler code does not run in
> interrupt context any more and acpi_os_execute(), that may be invoked
> by it, need not use GFP_ATOMIC for allocating work items.
>
> Make it use GFP_KERNEL instead.

This change is premature, because acpi_ev_detect_gpe() still disables
local interrupts around acpi_os_execute() calls, even though it runs
from a kernel thread now.

Withdrawing.

> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/acpi/osl.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> Index: linux-pm/drivers/acpi/osl.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/osl.c
> +++ linux-pm/drivers/acpi/osl.c
> @@ -1084,8 +1084,7 @@ acpi_status acpi_os_execute(acpi_execute
>          * parameters we can't use the approach some kernel code uses of
>          * having a static work_struct.
>          */
> -
> -       dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC);
> +       dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL);
>         if (!dpc)
>                 return AE_NO_MEMORY;
>
>
>
>
>
  

Patch

Index: linux-pm/drivers/acpi/osl.c
===================================================================
--- linux-pm.orig/drivers/acpi/osl.c
+++ linux-pm/drivers/acpi/osl.c
@@ -1084,8 +1084,7 @@  acpi_status acpi_os_execute(acpi_execute
 	 * parameters we can't use the approach some kernel code uses of
 	 * having a static work_struct.
 	 */
-
-	dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC);
+	dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL);
 	if (!dpc)
 		return AE_NO_MEMORY;