-
Notifications
You must be signed in to change notification settings - Fork 105
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] ACPI: OSL: Allow Notify () handlers to run on all CPUs #680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] ACPI: OSL: Allow Notify () handlers to run on all CPUs #680
Conversation
mainline inclusion from mainline-v6.7-rc1 category: misc Fix up four places where there is no empty line after declarations of local variables in a function (as per the kernel coding style). Signed-off-by: Jonathan Bergh <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]> (cherry picked from commit a1da3b7) Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion from mainline-v6.8-rc1 category: misc Reduce the number of checks and goto labels related to error handling in acpi_os_execute() and drop the status local variable, which turns out to be redundant, from it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> (cherry picked from commit 392829e) Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion from mainline-v6.8-rc1 category: misc Replace the 3-branch if () statement used for selecting the target workqueue in acpi_os_execute() with a switch () one that is more suitable for this purpose and carry out the work item initialization before it to avoid code duplication. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> (cherry picked from commit 3f3a259) Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion from mainline-v6.8-rc1 category: bugfix Notify () handlers, like GPE handlers, are only allowed to run on CPU0 now out of the concern that they might trigger an SMM trap leading to memory corruption. Namely, in some cases, SMM code might corrupt memory if not run on CPU0. However, Notify () handlers are registered by kernel code and they are not likely to evaluate AML that would trigger an SMM trap. In fact, many of them don't even evaluate any AML at all and even if they do, that AML may as well be evaluated in other code paths. In other words, they are not special from the AML evaluation perspective, so there is no real reason to treat them in any special way. Accordingly, allow Notify () handlers, unlike GPE handlers, to be executed by all CPUs in the system. Also adjust the allocation of the "notify" workqueue to allow multiple handlers to be executed at the same time, because they need not be serialized. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> (cherry picked from commit e2ffcda) Signed-off-by: Wentao Guan <[email protected]>
Reviewer's Guide by SourceryThis pull request modifies the ACPI subsystem to allow Notify handlers to run on all CPUs, addressing concerns about unnecessary restrictions. It also adjusts the notify workqueue to enable concurrent execution of multiple handlers. Sequence diagram for ACPI Notify Handler ExecutionsequenceDiagram
participant Kernel
participant ACPI Subsystem
participant Notify Handler
activate Kernel
Kernel->>ACPI Subsystem: acpi_os_execute(OSL_NOTIFY_HANDLER, function, context)
activate ACPI Subsystem
ACPI Subsystem->>kacpi_notify_wq: queue_work(kacpi_notify_wq, &dpc->work)
activate kacpi_notify_wq
kacpi_notify_wq->>Notify Handler: acpi_os_execute_deferred(work)
activate Notify Handler
Notify Handler->>ACPI Subsystem: function(context)
deactivate Notify Handler
deactivate kacpi_notify_wq
ACPI Subsystem-->>Kernel: AE_OK
deactivate ACPI Subsystem
deactivate Kernel
Sequence diagram for ACPI GPE Handler ExecutionsequenceDiagram
participant Kernel
participant ACPI Subsystem
participant GPE Handler
activate Kernel
Kernel->>ACPI Subsystem: acpi_os_execute(OSL_GPE_HANDLER, function, context)
activate ACPI Subsystem
ACPI Subsystem->>kacpid_wq: queue_work_on(0, kacpid_wq, &dpc->work)
activate kacpid_wq
kacpid_wq->>GPE Handler: acpi_os_execute_deferred(work)
activate GPE Handler
GPE Handler->>ACPI Subsystem: function(context)
deactivate GPE Handler
deactivate kacpid_wq
ACPI Subsystem-->>Kernel: AE_OK
deactivate ACPI Subsystem
deactivate Kernel
Updated class diagram for acpi_os_executeclassDiagram
class acpi_os_execute {
+acpi_status acpi_os_execute(acpi_execute_type type, acpi_osd_exec_callback function, void *context)
}
note for acpi_os_execute "Notify handlers can now run on all CPUs"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @opsiff - I've reviewed your changes - here's some feedback:
Overall Comments:
- The removal of
statusandgoto out_threadseems like a significant change; can you confirm it's intended and doesn't introduce regressions? - Consider adding a comment explaining why
queue_work_on(0, ...)is still needed forOSL_GPE_HANDLER.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review代码审查意见:
总体来说,代码的改动提高了代码的可读性和可维护性,简化了错误处理逻辑,并且没有引入新的问题。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
在HUAWEI MateBook d14 YTGZ model上测试通过 |
mainline inclusion
from mainline-v6.8-rc1
category: bugfix
Notify () handlers, like GPE handlers, are only allowed to run on CPU0
now out of the concern that they might trigger an SMM trap leading to
memory corruption. Namely, in some cases, SMM code might corrupt memory
if not run on CPU0.
However, Notify () handlers are registered by kernel code and they
are not likely to evaluate AML that would trigger an SMM trap. In
fact, many of them don't even evaluate any AML at all and even if
they do, that AML may as well be evaluated in other code paths. In
other words, they are not special from the AML evaluation perspective,
so there is no real reason to treat them in any special way.
Accordingly, allow Notify () handlers, unlike GPE handlers, to be
executed by all CPUs in the system.
Also adjust the allocation of the "notify" workqueue to allow multiple
handlers to be executed at the same time, because they need not be
serialized.
Signed-off-by: Rafael J. Wysocki [email protected]
Reviewed-by: Andy Shevchenko [email protected]
(cherry picked from commit e2ffcda)
Signed-off-by: Wentao Guan [email protected]
Summary by Sourcery
Allow Notify() handlers to run on all CPUs, as they are not special from the AML evaluation perspective and do not need to be serialized. Adjust the allocation of the "notify" workqueue to allow multiple handlers to be executed at the same time.
Bug Fixes: