platform/x86/amd: Fix pmc compile dependency errors.
PATCH 1/1 platform/x86/amd: Fix pmc compile dependency errors.
When disabled CONFIG_SUSPEND and CONFIG_DEBUG_FS, get_metrics_table and amd_pmc_idlemask_read is defined under two conditions of this, pmc build with implicit declaration of function error.Some build error messages are as follows:
CC [M] drivers/platform/x86/amd/pmc.odrivers/platform/x86/amd/pmc.c: In function ‘smu_fw_info_show’:drivers/platform/x86/amd/pmc.c:436:6: error: implicit declaration of function ‘get_metrics_table’ [-Werror=implicit-function-declaration]
436 | if (get_metrics_table(dev, &table))
| ^~~~~~~~~~~~~~~~~
drivers/platform/x86/amd/pmc.c: In function ‘amd_pmc_idlemask_show’:
drivers/platform/x86/amd/pmc.c:508:8: error: implicit declaration of function ‘amd_pmc_idlemask_read’; did you mean ‘amd_pmc_idlemask_show’? [-Werror=implicit-function-declaration]
508 | rc = amd_pmc_idlemask_read(dev, NULL, s);
| ^~~~~~~~~~~~~~~~~~~~~
| amd_pmc_idlemask_showcc1: some warnings being treated as errors
--- drivers/platform/x86/amd/pmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/platform/x86/amd/pmc.c +4 -1
@@ -433,8 +433,10 @@ static int smu_fw_info_show(struct seq_file *s, void *unused)struct smu_metrics table;int idx; +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS )if (get_metrics_table (dev, &table))return -EINVAL ; +#endif seq_puts (s,"\n=== SMU Statistics ===\n" );seq_printf (s,"Table Version: %d\n" , table.table_version);
@@ -503,11 +505,12 @@ static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)if (rc)return rc; } -if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) { +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS ) rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc; +#endif }else {seq_puts (s,"Unsupported SMU version for Idlemask\n" ); }
Signature · 1 line
2.34.1
Hi,
Quoted 15 lines · Yupeng Li
When disabled
CONFIG_SUSPENDandCONFIG_DEBUG_FS,get_metrics_tableandamd_pmc_idlemask_readis defined under two conditions of this, pmc build with implicit declaration of function error.Some build error messages are as follows:CC [M]
drivers/platform/x86/amd/pmc.odrivers/platform/x86/amd/pmc.c: In function ‘smu_fw_info_show’:drivers/platform/x86/amd/pmc.c:436:6: error: implicit declaration of function ‘get_metrics_table’ [-Werror=implicit-function-declaration]
436 | if (get_metrics_table(dev, &table))| ^~~~~~~~~~~~~~~~~ drivers/platform/x86/amd/pmc.c: In function ‘amd_pmc_idlemask_show’: drivers/platform/x86/amd/pmc.c:508:8: error: implicit declaration of function ‘amd_pmc_idlemask_read’; did you mean ‘amd_pmc_idlemask_show’? [-Werror=implicit-function-declaration] 508 | rc = amd_pmc_idlemask_read(dev, NULL, s); | ^~~~~~~~~~~~~~~~~~~~~ | amd_pmc_idlemask_show
Quoted 4 lines
cc1: some warnings being treated as errors
Signed-off-by Yupeng Li <[email protected]>Reviewed-by Caicai <[email protected]>
Thank you for your patch, however I do not believe that this is the correct fix:
Quoted 9 lines
--- drivers/platform/x86/amd/pmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/platform/x86/amd/pmc.c +0
-0
drivers/platform/x86/amd/pmc.c static int smu_fw_info_show(struct seq_file *s, void *unused) · line 442
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +2
-0@@ -433,8 +433,10 @@ static int smu_fw_info_show(struct seq_file *s, void *unused)struct smu_metrics table;int idx; +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS )if (get_metrics_table (dev, &table))return -EINVAL ; +#endif seq_puts (s,"\n=== SMU Statistics ===\n" );seq_printf (s,"Table Version: %d\n" , table.table_version);
The table variable gets used here, but now it no longer has been initialized by get_metrics_table() so just #ifdef-ing out the get_metrics_table() call is wrong.
Quoted 4 lines
drivers/platform/x86/amd/pmc.c +0
-0@@ -503,11 +505,12 @@ static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)if (rc)return rc; }
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 516
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +2
-1-if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) { +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS ) rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc; +#endif }else {seq_puts (s,"Unsupported SMU version for Idlemask\n" ); }
Same thing except now nothing gets send to the struct seq_file *s, so this is wrong too.
Shyam / Mario, can you take a look at the reported compile errors please?
Regards,
Hans
Quoted 66 lines · Hans de Goede
Hi,
Quoted 15 lines · Yupeng Li
When disabled
CONFIG_SUSPENDandCONFIG_DEBUG_FS,get_metrics_tableandamd_pmc_idlemask_readis defined under two conditions of this, pmc build with implicit declaration of function error.Some build error messages are as follows:CC [M]
drivers/platform/x86/amd/pmc.odrivers/platform/x86/amd/pmc.c: In function ‘smu_fw_info_show’:drivers/platform/x86/amd/pmc.c:436:6: error: implicit declaration of function ‘get_metrics_table’ [-Werror=implicit-function-declaration]
436 | if (get_metrics_table(dev, &table))| ^~~~~~~~~~~~~~~~~ drivers/platform/x86/amd/pmc.c: In function ‘amd_pmc_idlemask_show’: drivers/platform/x86/amd/pmc.c:508:8: error: implicit declaration of function ‘amd_pmc_idlemask_read’; did you mean ‘amd_pmc_idlemask_show’? [-Werror=implicit-function-declaration] 508 | rc = amd_pmc_idlemask_read(dev, NULL, s); | ^~~~~~~~~~~~~~~~~~~~~ | amd_pmc_idlemask_showQuoted 4 lines
cc1: some warnings being treated as errors
Signed-off-by Yupeng Li <[email protected]>Reviewed-by Caicai <[email protected]>Thank you for your patch, however I do not believe that this is the correct fix:
Quoted 9 lines
--- drivers/platform/x86/amd/pmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/platform/x86/amd/pmc.c +0
-0drivers/platform/x86/amd/pmc.c static int smu_fw_info_show(struct seq_file *s, void *unused) · line 442
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +2
-0@@ -433,8 +433,10 @@ static int smu_fw_info_show(struct seq_file *s, void *unused)struct smu_metrics table;int idx; +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS )if (get_metrics_table (dev, &table))return -EINVAL ; +#endif seq_puts (s,"\n=== SMU Statistics ===\n" );seq_printf (s,"Table Version: %d\n" , table.table_version);The table variable gets used here, but now it no longer has been initialized by
get_metrics_table()so just #ifdef-ing out theget_metrics_table()call is wrong.Quoted 4 lines
drivers/platform/x86/amd/pmc.c +0
-0@@ -503,11 +505,12 @@ static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)if (rc)return rc; }drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 516
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +2
-1-if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) { +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS ) rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc; +#endif }else {seq_puts (s,"Unsupported SMU version for Idlemask\n" ); }Same thing except now nothing gets send to the struct
seq_file*s, so this is wrong too.
Quoted 6 lines
Shyam / Mario, can you take a look at the reported compile errors please?
Regards,
Hans
What kernel is this? Shyam removed CONFIG_DEBUGFS in b37fe34c83. So is this failure still happening in 6.1-rc4?
Quoted 67 lines · Mario Limonciello
Quoted 66 lines · Hans de Goede
Hi,
Quoted 15 lines · Yupeng Li
When disabled
CONFIG_SUSPENDandCONFIG_DEBUG_FS,get_metrics_tableandamd_pmc_idlemask_readis defined under two conditions of this, pmc build with implicit declaration of function error.Some build error messages are as follows:CC [M]
drivers/platform/x86/amd/pmc.odrivers/platform/x86/amd/pmc.c: In function ‘smu_fw_info_show’:drivers/platform/x86/amd/pmc.c:436:6: error: implicit declaration of function ‘get_metrics_table’ [-Werror=implicit-function-declaration]
436 | if (get_metrics_table(dev, &table))| ^~~~~~~~~~~~~~~~~ drivers/platform/x86/amd/pmc.c: In function ‘amd_pmc_idlemask_show’: drivers/platform/x86/amd/pmc.c:508:8: error: implicit declaration of function ‘amd_pmc_idlemask_read’; did you mean ‘amd_pmc_idlemask_show’? [-Werror=implicit-function-declaration] 508 | rc = amd_pmc_idlemask_read(dev, NULL, s); | ^~~~~~~~~~~~~~~~~~~~~ | amd_pmc_idlemask_showQuoted 4 lines
cc1: some warnings being treated as errors
Signed-off-by Yupeng Li <[email protected]>Reviewed-by Caicai <[email protected]>Thank you for your patch, however I do not believe that this is the correct fix:
Quoted 9 lines
--- drivers/platform/x86/amd/pmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/platform/x86/amd/pmc.c +0
-0drivers/platform/x86/amd/pmc.c static int smu_fw_info_show(struct seq_file *s, void *unused) · line 440
Quoted 8 lines
drivers/platform/x86/amd/pmc.c +2
-0@@ -433,8 +433,10 @@ static int smu_fw_info_show(struct seq_file *s, void *unused)struct smu_metrics table;int idx; +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS )if (get_metrics_table (dev, &table))return -EINVAL ; +#endif seq_puts (s,"\n=== SMU Statistics ===\n" );seq_printf (s,"Table Version: %d\n" , table.table_version);The table variable gets used here, but now it no longer has been initialized by
get_metrics_table()so just #ifdef-ing out theget_metrics_table()call is wrong.Quoted 4 lines
drivers/platform/x86/amd/pmc.c +0
-0@@ -503,11 +505,12 @@ static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)if (rc)return rc; }drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 516
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +2
-1-if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) { +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS ) rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc; +#endif }else {seq_puts (s,"Unsupported SMU version for Idlemask\n" ); }Same thing except now nothing gets send to the struct
seq_file*s, so this is wrong too.Shyam / Mario, can you take a look at the reported compile errors please?
Quoted 7 lines
Quoted 4 lines
Regards,
Hans
What kernel is this? Shyam removed
CONFIG_DEBUGFSinb37fe34c83. So is this failure still happening in 6.1-rc4?
It managed to trickle into stable too:
https://bugzilla.kernel.org/show_bug.cgi?id=216679
Adding bug reporter to Cc too.
From a quick glance, I'd drop all that ifdeffery and add empty stubs. IMNSVHO.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette[Public]
Quoted 111 lines
-----Original Message-----
From: Borislav Petkov <[email protected]>
Sent: Friday, November 11, 2022 09:15
To: Limonciello, Mario <[email protected]>
Cc: Hans de Goede <[email protected]>; Yupeng Li <[email protected]>; S-k, Shyam-sundar <Shyam-sundar.S- [email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; smf- [email protected]
Subject: Re: [PATCH 1/1] platform/x86/amd: Fix pmc compile dependency errors.Quoted 5 lines · Mario Limonciello
Quoted 4 lines · Hans de Goede
Hi,
Quoted 1 line · Yupeng Li
When disabled
CONFIG_SUSPENDandCONFIG_DEBUG_FS,
get_metrics_tableQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
and
amd_pmc_idlemask_readis defined under two conditions of this, pmc build with implicit declaration of function error.Some build error messages are as follows:CC [M]
drivers/platform/x86/amd/pmc.odrivers/platform/x86/amd/pmc.c: In function 'smu_fw_info_show':drivers/platform/x86/amd/pmc.c:436:6: error: implicit declaration offunction '
get_metrics_table' [-Werror=implicit-function-declaration]Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
436 | if (get_metrics_table(dev, &table)) | ^~~~~~~~~~~~~~~~~
drivers/platform/x86/amd/pmc.c: In function'
amd_pmc_idlemask_show':Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/platform/x86/amd/pmc.c:508:8: error: implicit declaration offunction '
amd_pmc_idlemask_read'; did you mean 'amd_pmc_idlemask_show'? [-Werror=implicit-function-declaration]Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
508 | rc = amd_pmc_idlemask_read(dev, NULL, s); | ^~~~~~~~~~~~~~~~~~~~~ | amd_pmc_idlemask_showcc1: some warnings being treated as errors
Signed-off-by Yupeng Li <[email protected]>Reviewed-by Caicai <[email protected]>Thank you for your patch, however I do not believe that this is the correct
fix:
Quoted 6 lines
Quoted 6 lines
Review
Quoted 6 lines
--- drivers/platform/x86/amd/pmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/platform/x86/amd/pmc.cQuoted 4 lines
Quoted 4 lines
drivers/platform/x86/amd/pmc.c static int smu_fw_info_show(struct seq_file
Quoted 4 lines
index
ce859b300712..2b08039921b8100644drivers/platform/x86/amd/pmc.c +0
-0@@ -433,8 +433,10 @@ static int smu_fw_info_show(struct seq_file*s, void *unused)
Quoted 10 lines
Quoted 10 lines
drivers/platform/x86/amd/pmc.c static int smu_fw_info_show(struct seq_file *s, void *unused) · line 442
Quoted 8 lines
drivers/platform/x86/amd/pmc.c +2
-0struct smu_metrics table;int idx; +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS )if (get_metrics_table (dev, &table))return -EINVAL ; +#endif seq_puts (s,"\n=== SMU Statistics ===\n" );seq_printf (s,"Table Version: %d\n" , table.table_version);The table variable gets used here, but now it no longer has been
initialized by
Quoted 1 line
Quoted 1 line
get_metrics_table()so just #ifdef-ing out theget_metrics_table()call iswrong.
Quoted 2 lines
Quoted 2 lines
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct
Quoted 2 lines
drivers/platform/x86/amd/pmc.c +0
-0@@ -503,11 +505,12 @@ static int amd_pmc_idlemask_show(struct
seq_file*s, void *unused)Quoted 17 lines
Quoted 17 lines
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 516
Quoted 13 lines
drivers/platform/x86/amd/pmc.c +2
-1if (rc)return rc; } -if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) { +#if defined(CONFIG_SUSPEND ) || defined(CONFIG_DEBUG_FS ) rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc; +#endif }else {seq_puts (s,"Unsupported SMU version for Idlemask\n" ); }Same thing except now nothing gets send to the struct
seq_file*s, so this is wrong too.Quoted 1 line
Quoted 1 line
Shyam / Mario, can you take a look at the reported compile errors
please?
Quoted 7 lines
Quoted 5 lines
Regards,
Hans
What kernel is this? Shyam removed
CONFIG_DEBUGFSinb37fe34c83. Sois
Quoted 1 line
this failure still happening in 6.1-rc4?
It managed to trickle into stable too:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugz
illa.kernel.org%2Fshow_bug.cgi%3Fid%3D216679&data=05%7C01%7Cm ario.limonciello%40amd.com%7C29820718c1334539d74e08dac3f782f2%7C3dd 8961fe4884e608e11a82d994e183d%7C0%7C0%7C638037765076195581%7CUn known%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6 Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NcjgeDsIS%2 BcW84%2FMcl9hKFNfL5Cw%2F2rYU8yXXsh2H5E%3D&reserved=0
Quoted 5 lines
Adding bug reporter to Cc too.
From a quick glance, I'd drop all that ifdeffery and add empty stubs. IMNSVHO.
I sent up a patch for it, but Hans hasn't applied it.
https://patchwork.kernel.org/project/platform-driver-x86/patch/[email protected]/
Quoted 2 lines · Mario
I sent up a patch for it, but Hans hasn't applied it.
https://patchwork.kernel.org/project/platform-driver-x86/patch/[email protected]/
Yap, that fixes it.
So yeah, Hans, make sure to Cc: stable too when applying.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteHi,
Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Mario
I sent up a patch for it, but Hans hasn't applied it.
https://patchwork.kernel.org/project/platform-driver-x86/patch/[email protected]/Yap, that fixes it.
So yeah, Hans, make sure to Cc: stable too when applying.
Done. I'll send this out in my next fixes pull-req to Linus before the end of this week.
Regards,
Hans