Re: [PATCH] ACPICA: fix swap.cocci warning
by Moore, Robert
-----Original Message-----
From: Guo Zhengkui <guozhengkui(a)vivo.com>
Sent: Thursday, November 18, 2021 10:31 PM
To: Rafael J. Wysocki <rafael(a)kernel.org>
Cc: Moore, Robert <robert.moore(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; Len Brown <lenb(a)kernel.org>; ACPI Devel Maling List <linux-acpi(a)vger.kernel.org>; open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <devel(a)acpica.org>; Linux Kernel Mailing List <linux-kernel(a)vger.kernel.org>; kernel <kernel(a)vivo.com>
Subject: Re: [PATCH] ACPICA: fix swap.cocci warning
On 2021/11/18 22:46, Rafael J. Wysocki wrote:
> On Tue, Nov 9, 2021 at 2:47 PM Guo Zhengkui <guozhengkui(a)vivo.com> wrote:
>>
>> Fix following swap.cocci warning:
>> ./drivers/acpi/acpica/nsrepair2.c:896:33-34: WARNING opportunity for
>> swap()
>>
>> Signed-off-by: Guo Zhengkui <guozhengkui(a)vivo.com>
>
> This change needs to be submitted to the upstream ACPICA project via
> https://github.com/acpica/acpica/
>
> Thanks!
So it means I need to submit this patch to upstream ACPICA project, not linux-next?
The answer is yes.
Bob
>
>> ---
>> drivers/acpi/acpica/nsrepair2.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/acpi/acpica/nsrepair2.c
>> b/drivers/acpi/acpica/nsrepair2.c index 14b71b41e845..02a904ca4caf
>> 100644
>> --- a/drivers/acpi/acpica/nsrepair2.c
>> +++ b/drivers/acpi/acpica/nsrepair2.c
>> @@ -8,6 +8,7 @@
>> *
>>
>> *********************************************************************
>> ********/
>>
>> +#include <linux/minmax.h>
>> #include <acpi/acpi.h>
>> #include "accommon.h"
>> #include "acnamesp.h"
>> @@ -875,7 +876,6 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
>> {
>> union acpi_operand_object *obj_desc1;
>> union acpi_operand_object *obj_desc2;
>> - union acpi_operand_object *temp_obj;
>> u32 i;
>> u32 j;
>>
>> @@ -892,9 +892,7 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
>> || ((sort_direction == ACPI_SORT_DESCENDING)
>> && (obj_desc1->integer.value <
>> obj_desc2->integer.value))) {
>> - temp_obj = elements[j - 1];
>> - elements[j - 1] = elements[j];
>> - elements[j] = temp_obj;
>> + swap(elements[j - 1], elements[j]);
>> }
>> }
>> }
>> --
>> 2.20.1
>>
7 months, 1 week
[rafael-pm:bleeding-edge] BUILD SUCCESS 7975c7f139bb692861600c15d89034a24e467aa9
by kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
branch HEAD: 7975c7f139bb692861600c15d89034a24e467aa9 Merge branches 'acpi-power', 'acpi-dptf', 'acpi-processor' and 'acpi-scan' into linux-next
elapsed time: 724m
configs tested: 148
configs skipped: 4
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm defconfig
arm64 allyesconfig
arm64 defconfig
arm allyesconfig
arm allmodconfig
i386 randconfig-c001-20211126
powerpc randconfig-c003-20211126
mips randconfig-c004-20211126
arm zeus_defconfig
arm colibri_pxa300_defconfig
arm lpc32xx_defconfig
s390 zfcpdump_defconfig
arm omap2plus_defconfig
powerpc adder875_defconfig
arm dove_defconfig
m68k m5272c3_defconfig
arm spear3xx_defconfig
i386 alldefconfig
powerpc mpc8272_ads_defconfig
parisc generic-32bit_defconfig
powerpc akebono_defconfig
powerpc mpc83xx_defconfig
sh edosk7760_defconfig
powerpc mpc8560_ads_defconfig
m68k sun3x_defconfig
arm ep93xx_defconfig
arm simpad_defconfig
sh se7705_defconfig
powerpc mpc834x_itxgp_defconfig
powerpc g5_defconfig
arm mvebu_v5_defconfig
arm hisi_defconfig
sh se7750_defconfig
arm hackkit_defconfig
sh sh03_defconfig
powerpc ep8248e_defconfig
sh titan_defconfig
arm xcep_defconfig
powerpc sam440ep_defconfig
sh se7724_defconfig
powerpc eiger_defconfig
xtensa defconfig
arm neponset_defconfig
powerpc mpc5200_defconfig
sh se7722_defconfig
sh sdk7780_defconfig
arm pcm027_defconfig
powerpc gamecube_defconfig
sh kfr2r09_defconfig
arm lart_defconfig
arm cns3420vb_defconfig
arm mv78xx0_defconfig
arm moxart_defconfig
powerpc mpc832x_rdb_defconfig
sparc sparc64_defconfig
powerpc iss476-smp_defconfig
m68k apollo_defconfig
m68k m5407c3_defconfig
arm pleb_defconfig
xtensa smp_lx200_defconfig
sh microdev_defconfig
sh apsh4ad0a_defconfig
sh kfr2r09-romimage_defconfig
arm eseries_pxa_defconfig
arc nsimosci_hs_smp_defconfig
sh sh2007_defconfig
arm randconfig-c002-20211126
ia64 allmodconfig
ia64 defconfig
ia64 allyesconfig
m68k allmodconfig
m68k defconfig
m68k allyesconfig
nds32 allnoconfig
nios2 defconfig
arc allyesconfig
nds32 defconfig
nios2 allyesconfig
csky defconfig
alpha defconfig
alpha allyesconfig
arc defconfig
sh allmodconfig
h8300 allyesconfig
xtensa allyesconfig
parisc defconfig
s390 allyesconfig
s390 allmodconfig
parisc allyesconfig
s390 defconfig
i386 allyesconfig
sparc allyesconfig
sparc defconfig
i386 defconfig
i386 debian-10.3-kselftests
i386 debian-10.3
mips allyesconfig
mips allmodconfig
powerpc allyesconfig
powerpc allmodconfig
powerpc allnoconfig
x86_64 randconfig-a014-20211126
x86_64 randconfig-a011-20211126
x86_64 randconfig-a012-20211126
x86_64 randconfig-a016-20211126
x86_64 randconfig-a013-20211126
x86_64 randconfig-a015-20211126
i386 randconfig-a016-20211126
i386 randconfig-a015-20211126
i386 randconfig-a012-20211126
i386 randconfig-a013-20211126
i386 randconfig-a014-20211126
i386 randconfig-a011-20211126
arc randconfig-r043-20211126
s390 randconfig-r044-20211126
riscv randconfig-r042-20211126
riscv nommu_k210_defconfig
riscv allyesconfig
riscv nommu_virt_defconfig
riscv allnoconfig
riscv defconfig
riscv rv32_defconfig
riscv allmodconfig
x86_64 rhel-8.3-kselftests
um x86_64_defconfig
um i386_defconfig
x86_64 allyesconfig
x86_64 defconfig
x86_64 rhel-8.3
x86_64 rhel-8.3-func
x86_64 kexec
clang tested configs:
s390 randconfig-c005-20211126
i386 randconfig-c001-20211126
powerpc randconfig-c003-20211126
riscv randconfig-c006-20211126
arm randconfig-c002-20211126
x86_64 randconfig-c007-20211126
mips randconfig-c004-20211126
x86_64 randconfig-a001-20211126
x86_64 randconfig-a003-20211126
x86_64 randconfig-a006-20211126
x86_64 randconfig-a004-20211126
x86_64 randconfig-a005-20211126
x86_64 randconfig-a002-20211126
i386 randconfig-a002-20211126
i386 randconfig-a001-20211126
i386 randconfig-a005-20211126
i386 randconfig-a006-20211126
i386 randconfig-a004-20211126
i386 randconfig-a003-20211126
hexagon randconfig-r045-20211126
hexagon randconfig-r041-20211126
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 1 week
[rafael-pm:bleeding-edge] BUILD SUCCESS 9be6a635aefb6c24bd82b95d7705fb5d83a5195b
by kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
branch HEAD: 9be6a635aefb6c24bd82b95d7705fb5d83a5195b Merge branch 'acpi-scan' into bleeding-edge
elapsed time: 1175m
configs tested: 59
configs skipped: 3
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm allyesconfig
arm allmodconfig
arm defconfig
arm64 defconfig
arm64 allyesconfig
i386 randconfig-c001-20211125
ia64 defconfig
ia64 allmodconfig
ia64 allyesconfig
m68k defconfig
m68k allyesconfig
m68k allmodconfig
csky defconfig
alpha defconfig
alpha allyesconfig
nds32 defconfig
nios2 allyesconfig
arc defconfig
sh allmodconfig
h8300 allyesconfig
xtensa allyesconfig
parisc defconfig
s390 allmodconfig
s390 defconfig
parisc allyesconfig
s390 allyesconfig
i386 allyesconfig
sparc defconfig
i386 defconfig
i386 debian-10.3
sparc allyesconfig
nds32 allnoconfig
nios2 defconfig
arc allyesconfig
mips allmodconfig
mips allyesconfig
powerpc allnoconfig
powerpc allmodconfig
powerpc allyesconfig
arc randconfig-r043-20211124
riscv randconfig-r042-20211124
s390 randconfig-r044-20211124
riscv nommu_k210_defconfig
riscv allyesconfig
riscv nommu_virt_defconfig
riscv allnoconfig
riscv defconfig
riscv rv32_defconfig
riscv allmodconfig
um i386_defconfig
um x86_64_defconfig
x86_64 allyesconfig
x86_64 defconfig
x86_64 rhel-8.3
x86_64 rhel-8.3-func
x86_64 kexec
x86_64 rhel-8.3-kselftests
clang tested configs:
hexagon randconfig-r041-20211124
hexagon randconfig-r045-20211124
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 1 week
Re: [PATCH v1 1/1] ACPI: Replace kernel.h with the necessary inclusions
by Rafael J. Wysocki
On Tue, Nov 23, 2021 at 5:31 PM Andy Shevchenko
<andriy.shevchenko(a)linux.intel.com> wrote:
>
> On Wed, Nov 10, 2021 at 01:16:40PM +0200, Andy Shevchenko wrote:
> > When kernel.h is used in the headers it adds a lot into dependency hell,
> > especially when there are circular dependencies are involved.
> >
> > Replace kernel.h inclusion with the list of what is really being used.
>
> Anybody any comments on this? I really want to shrink kernel.h usage in
> headers rather sooner than later...
Patch applied as 5.17 material, thanks!
7 months, 1 week
[PATCH 0/3] ACPI: Add support for PCC Operation Region
by Sudeep Holla
Hi,
This series adds support for ACPI PCC OpRegion added in ACPI 6.3
I understand that the ACPICA changes need to go via different route,
but I am posting it together to give complete narative/picture for
the review/discussion.
Regards,
Sudeep
Sudeep Holla (3):
ACPICA: Fix wrong interpretation of PCC address
ACPICA: Add support for PCC Opregion special context data
ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype
drivers/acpi/Kconfig | 5 ++
drivers/acpi/Makefile | 1 +
drivers/acpi/acpica/evregion.c | 11 ++++
drivers/acpi/acpica/exfield.c | 7 +--
drivers/acpi/bus.c | 1 +
drivers/acpi/pcc_opregion.c | 111 +++++++++++++++++++++++++++++++++
include/acpi/actypes.h | 8 +++
include/linux/acpi.h | 6 ++
8 files changed, 144 insertions(+), 6 deletions(-)
create mode 100644 drivers/acpi/pcc_opregion.c
--
2.25.1
7 months, 1 week
Re: [PATCH] ACPICA: fix swap.cocci warning
by Rafael J. Wysocki
On Tue, Nov 9, 2021 at 2:47 PM Guo Zhengkui <guozhengkui(a)vivo.com> wrote:
>
> Fix following swap.cocci warning:
> ./drivers/acpi/acpica/nsrepair2.c:896:33-34: WARNING
> opportunity for swap()
>
> Signed-off-by: Guo Zhengkui <guozhengkui(a)vivo.com>
This change needs to be submitted to the upstream ACPICA project via
https://github.com/acpica/acpica/
Thanks!
> ---
> drivers/acpi/acpica/nsrepair2.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
> index 14b71b41e845..02a904ca4caf 100644
> --- a/drivers/acpi/acpica/nsrepair2.c
> +++ b/drivers/acpi/acpica/nsrepair2.c
> @@ -8,6 +8,7 @@
> *
> *****************************************************************************/
>
> +#include <linux/minmax.h>
> #include <acpi/acpi.h>
> #include "accommon.h"
> #include "acnamesp.h"
> @@ -875,7 +876,6 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
> {
> union acpi_operand_object *obj_desc1;
> union acpi_operand_object *obj_desc2;
> - union acpi_operand_object *temp_obj;
> u32 i;
> u32 j;
>
> @@ -892,9 +892,7 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
> || ((sort_direction == ACPI_SORT_DESCENDING)
> && (obj_desc1->integer.value <
> obj_desc2->integer.value))) {
> - temp_obj = elements[j - 1];
> - elements[j - 1] = elements[j];
> - elements[j] = temp_obj;
> + swap(elements[j - 1], elements[j]);
> }
> }
> }
> --
> 2.20.1
>
7 months, 2 weeks
[rafael-pm:bleeding-edge] BUILD SUCCESS 310eeb695db6630697feeb3476ed08bc9231d404
by kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
branch HEAD: 310eeb695db6630697feeb3476ed08bc9231d404 Merge branch 'pm-cpufreq' into bleeding-edge
elapsed time: 721m
configs tested: 102
configs skipped: 3
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm defconfig
arm allyesconfig
arm allmodconfig
arm64 allyesconfig
arm64 defconfig
i386 randconfig-c001-20211118
arm shmobile_defconfig
powerpc eiger_defconfig
sh sh7785lcr_defconfig
powerpc powernv_defconfig
mips fuloong2e_defconfig
sh secureedge5410_defconfig
powerpc mpc885_ads_defconfig
powerpc ge_imp3a_defconfig
mips loongson3_defconfig
arm sama5_defconfig
arm mmp2_defconfig
arm simpad_defconfig
mips ip22_defconfig
mips loongson1c_defconfig
powerpc currituck_defconfig
powerpc ksi8560_defconfig
xtensa nommu_kc705_defconfig
sh sh03_defconfig
arm randconfig-c002-20211117
ia64 allmodconfig
ia64 defconfig
ia64 allyesconfig
m68k defconfig
m68k allyesconfig
m68k allmodconfig
csky defconfig
alpha defconfig
nds32 defconfig
alpha allyesconfig
nios2 allyesconfig
arc defconfig
sh allmodconfig
h8300 allyesconfig
xtensa allyesconfig
parisc defconfig
s390 allmodconfig
s390 defconfig
parisc allyesconfig
s390 allyesconfig
i386 defconfig
i386 debian-10.3
sparc defconfig
i386 allyesconfig
sparc allyesconfig
nds32 allnoconfig
nios2 defconfig
arc allyesconfig
mips allmodconfig
mips allyesconfig
powerpc allnoconfig
powerpc allyesconfig
powerpc allmodconfig
x86_64 randconfig-a003-20211117
x86_64 randconfig-a002-20211117
x86_64 randconfig-a001-20211117
x86_64 randconfig-a006-20211117
x86_64 randconfig-a004-20211117
x86_64 randconfig-a005-20211117
i386 randconfig-a003-20211117
i386 randconfig-a001-20211117
i386 randconfig-a002-20211117
i386 randconfig-a006-20211117
i386 randconfig-a005-20211117
i386 randconfig-a004-20211117
arc randconfig-r043-20211117
riscv allyesconfig
riscv allnoconfig
riscv defconfig
riscv allmodconfig
riscv nommu_k210_defconfig
riscv nommu_virt_defconfig
riscv rv32_defconfig
um i386_defconfig
um x86_64_defconfig
x86_64 allyesconfig
x86_64 defconfig
x86_64 rhel-8.3
x86_64 rhel-8.3-func
x86_64 kexec
x86_64 rhel-8.3-kselftests
clang tested configs:
x86_64 randconfig-a013-20211117
x86_64 randconfig-a011-20211117
x86_64 randconfig-a012-20211117
x86_64 randconfig-a016-20211117
x86_64 randconfig-a014-20211117
x86_64 randconfig-a015-20211117
i386 randconfig-a014-20211117
i386 randconfig-a012-20211117
i386 randconfig-a013-20211117
i386 randconfig-a011-20211117
i386 randconfig-a015-20211117
i386 randconfig-a016-20211117
hexagon randconfig-r045-20211117
hexagon randconfig-r041-20211117
s390 randconfig-r044-20211117
riscv randconfig-r042-20211117
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 2 weeks
[rafael-pm:bleeding-edge] BUILD SUCCESS 16029e67d98a06dadf0204aec4309239aef6af0f
by kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
branch HEAD: 16029e67d98a06dadf0204aec4309239aef6af0f Merge branch 'acpi-thermal' into bleeding-edge
elapsed time: 728m
configs tested: 109
configs skipped: 3
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm allyesconfig
arm allmodconfig
arm defconfig
arm64 defconfig
arm64 allyesconfig
i386 randconfig-c001-20211117
powerpc socrates_defconfig
mips decstation_64_defconfig
mips loongson2k_defconfig
xtensa common_defconfig
arm axm55xx_defconfig
arm sama5_defconfig
arm stm32_defconfig
arm spear13xx_defconfig
ia64 alldefconfig
mips rm200_defconfig
mips rt305x_defconfig
powerpc mpc832x_mds_defconfig
riscv allnoconfig
arm mps2_defconfig
xtensa cadence_csp_defconfig
arm vt8500_v6_v7_defconfig
arc nsim_700_defconfig
arm milbeaut_m10v_defconfig
sh sh7770_generic_defconfig
powerpc mpc85xx_cds_defconfig
arm randconfig-c002-20211116
ia64 defconfig
ia64 allmodconfig
ia64 allyesconfig
m68k allyesconfig
m68k allmodconfig
m68k defconfig
csky defconfig
alpha defconfig
nds32 defconfig
alpha allyesconfig
nios2 allyesconfig
arc defconfig
sh allmodconfig
h8300 allyesconfig
xtensa allyesconfig
parisc defconfig
s390 allmodconfig
parisc allyesconfig
s390 defconfig
s390 allyesconfig
i386 allyesconfig
sparc allyesconfig
sparc defconfig
i386 defconfig
i386 debian-10.3
arc allyesconfig
nds32 allnoconfig
nios2 defconfig
mips allmodconfig
mips allyesconfig
powerpc allnoconfig
powerpc allmodconfig
powerpc allyesconfig
x86_64 randconfig-a003-20211117
x86_64 randconfig-a002-20211117
x86_64 randconfig-a001-20211117
x86_64 randconfig-a004-20211117
x86_64 randconfig-a005-20211117
x86_64 randconfig-a006-20211117
x86_64 randconfig-a015-20211116
x86_64 randconfig-a013-20211116
x86_64 randconfig-a012-20211116
x86_64 randconfig-a011-20211116
x86_64 randconfig-a016-20211116
x86_64 randconfig-a014-20211116
i386 randconfig-a012-20211116
i386 randconfig-a013-20211116
i386 randconfig-a011-20211116
i386 randconfig-a015-20211116
i386 randconfig-a014-20211116
i386 randconfig-a016-20211116
arc randconfig-r043-20211116
riscv randconfig-r042-20211116
s390 randconfig-r044-20211116
riscv allyesconfig
riscv nommu_virt_defconfig
riscv defconfig
riscv rv32_defconfig
riscv allmodconfig
riscv nommu_k210_defconfig
um i386_defconfig
um x86_64_defconfig
x86_64 defconfig
x86_64 rhel-8.3
x86_64 kexec
x86_64 allyesconfig
x86_64 rhel-8.3-func
x86_64 rhel-8.3-kselftests
clang tested configs:
x86_64 randconfig-a003-20211116
x86_64 randconfig-a001-20211116
x86_64 randconfig-a002-20211116
x86_64 randconfig-a006-20211116
x86_64 randconfig-a004-20211116
x86_64 randconfig-a005-20211116
i386 randconfig-a003-20211116
i386 randconfig-a005-20211116
i386 randconfig-a001-20211116
i386 randconfig-a004-20211116
i386 randconfig-a002-20211116
i386 randconfig-a006-20211116
hexagon randconfig-r045-20211116
hexagon randconfig-r041-20211116
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 2 weeks
[rafael-pm:bleeding-edge] BUILD SUCCESS 26af6e4926b029c54765aa53f89555b7c174e6fe
by kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
branch HEAD: 26af6e4926b029c54765aa53f89555b7c174e6fe Merge branch 'pm-em' into bleeding-edge
elapsed time: 1755m
configs tested: 53
configs skipped: 3
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm64 allyesconfig
arm defconfig
arm64 defconfig
arm allmodconfig
arm allyesconfig
ia64 allmodconfig
ia64 defconfig
ia64 allyesconfig
m68k defconfig
m68k allmodconfig
m68k allyesconfig
nds32 defconfig
csky defconfig
alpha defconfig
alpha allyesconfig
nios2 allyesconfig
arc defconfig
sh allmodconfig
h8300 allyesconfig
xtensa allyesconfig
parisc defconfig
parisc allyesconfig
s390 allmodconfig
s390 defconfig
s390 allyesconfig
nds32 allnoconfig
nios2 defconfig
arc allyesconfig
i386 defconfig
i386 debian-10.3
sparc allyesconfig
sparc defconfig
i386 allyesconfig
mips allyesconfig
mips allmodconfig
powerpc allyesconfig
powerpc allmodconfig
powerpc allnoconfig
riscv nommu_k210_defconfig
riscv allyesconfig
riscv nommu_virt_defconfig
riscv defconfig
riscv rv32_defconfig
riscv allmodconfig
riscv allnoconfig
um i386_defconfig
um x86_64_defconfig
x86_64 allyesconfig
x86_64 defconfig
x86_64 rhel-8.3
x86_64 kexec
x86_64 rhel-8.3-func
x86_64 rhel-8.3-kselftests
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
Re: [PATCH AUTOSEL 4.4 15/30] ACPICA: Avoid evaluating methods too early during system resume
by Moore, Robert
Sasha,
Can you re-do this patch in native ACPICA format, then add a pull request to our github?
Thanks,
Bob
-----Original Message-----
From: Sasha Levin <sashal(a)kernel.org>
Sent: Monday, November 08, 2021 5:09 PM
To: linux-kernel(a)vger.kernel.org; stable(a)vger.kernel.org
Cc: Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; Reik Keutterling <spielkind(a)gmail.com>; Sasha Levin <sashal(a)kernel.org>; Moore, Robert <robert.moore(a)intel.com>; linux-acpi(a)vger.kernel.org; devel(a)acpica.org
Subject: [PATCH AUTOSEL 4.4 15/30] ACPICA: Avoid evaluating methods too early during system resume
From: "Rafael J. Wysocki" <rafael.j.wysocki(a)intel.com>
[ Upstream commit d3c4b6f64ad356c0d9ddbcf73fa471e6a841cc5c ]
ACPICA commit 0762982923f95eb652cf7ded27356b247c9774de
During wakeup from system-wide sleep states, acpi_get_sleep_type_data() is called and it tries to get memory from the slab allocator in order to evaluate a control method, but if KFENCE is enabled in the kernel, the memory allocation attempt causes an IRQ work to be queued and a self-IPI to be sent to the CPU running the code which requires the memory controller to be ready, so if that happens too early in the wakeup path, it doesn't work.
Prevent that from taking place by calling acpi_get_sleep_type_data() for S0 upfront, when preparing to enter a given sleep state, and saving the data obtained by it for later use during system wakeup.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214271
Reported-by: Reik Keutterling <spielkind(a)gmail.com>
Tested-by: Reik Keutterling <spielkind(a)gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
drivers/acpi/acpica/acglobal.h | 2 ++ drivers/acpi/acpica/hwesleep.c | 8 ++------
drivers/acpi/acpica/hwsleep.c | 11 ++++-------
drivers/acpi/acpica/hwxfsleep.c | 7 +++++++
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index faa97604d878e..f178d11597c09 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -256,6 +256,8 @@ extern struct acpi_bit_register_info
ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a); ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
+ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a_s0); ACPI_GLOBAL(u8,
+acpi_gbl_sleep_type_b_s0);
/*****************************************************************************
*
diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c index e5599f6108083..e4998cc0ce283 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -184,17 +184,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
acpi_status acpi_hw_extended_wake_prep(u8 sleep_state) {
- acpi_status status;
u8 sleep_type_value;
ACPI_FUNCTION_TRACE(hw_extended_wake_prep);
- status = acpi_get_sleep_type_data(ACPI_STATE_S0,
- &acpi_gbl_sleep_type_a,
- &acpi_gbl_sleep_type_b);
- if (ACPI_SUCCESS(status)) {
+ if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) {
sleep_type_value =
- ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) &
+ ((acpi_gbl_sleep_type_a_s0 << ACPI_X_SLEEP_TYPE_POSITION) &
ACPI_X_SLEEP_TYPE_MASK);
(void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE), diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 7d21cae6d6028..7e44ba8c6a1ab 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -217,7 +217,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state) {
- acpi_status status;
+ acpi_status status = AE_OK;
struct acpi_bit_register_info *sleep_type_reg_info;
struct acpi_bit_register_info *sleep_enable_reg_info;
u32 pm1a_control;
@@ -230,10 +230,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
* This is unclear from the ACPI Spec, but it is required
* by some machines.
*/
- status = acpi_get_sleep_type_data(ACPI_STATE_S0,
- &acpi_gbl_sleep_type_a,
- &acpi_gbl_sleep_type_b);
- if (ACPI_SUCCESS(status)) {
+ if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) {
sleep_type_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE);
sleep_enable_reg_info =
@@ -254,9 +251,9 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
/* Insert the SLP_TYP bits */
- pm1a_control |= (acpi_gbl_sleep_type_a <<
+ pm1a_control |= (acpi_gbl_sleep_type_a_s0 <<
sleep_type_reg_info->bit_position);
- pm1b_control |= (acpi_gbl_sleep_type_b <<
+ pm1b_control |= (acpi_gbl_sleep_type_b_s0 <<
sleep_type_reg_info->bit_position);
/* Write the control registers and ignore any errors */ diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index d62a61612b3f1..b04e2b0f62246 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -372,6 +372,13 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
return_ACPI_STATUS(status);
}
+ status = acpi_get_sleep_type_data(ACPI_STATE_S0,
+ &acpi_gbl_sleep_type_a_s0,
+ &acpi_gbl_sleep_type_b_s0);
+ if (ACPI_FAILURE(status)) {
+ acpi_gbl_sleep_type_a_s0 = ACPI_SLEEP_TYPE_INVALID;
+ }
+
/* Execute the _PTS method (Prepare To Sleep) */
arg_list.count = 1;
--
2.33.0
7 months, 3 weeks