* Re: FW: [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework"
[not found] ` <20170529021852epcms1p66b2e89d2aec7988e00fb64c41a48a839@epcms1p6>
@ 2017-05-31 23:51 ` Rafael J. Wysocki
[not found] ` <CGME20170516042313epcms1p5523f4e3e1ae608eaf0327be0242ee46e@epcms1p1>
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-05-31 23:51 UTC (permalink / raw)
To: jongman.heo; +Cc: Linux PM, LKML, Srinivas Pandruvada
On Monday, May 29, 2017 02:18:52 AM Jongman Heo wrote:
>
> Hi,
>
> FYI, 4.12-rc3 still has this issue.
>
>
> --------- Original Message ---------
> Sender : 허종만 <jongman.heo@samsung.com>
> Date : 2017-05-16 13:25 (GMT+9)
> Title : [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework"
>
>
> Hi,
>
> With 4.12-rc1 (Linus git), booting fails due to kernel panic, at intel_pstate_register_driver+0x56/0x110.
> I can't copy the whole trace from the graphic console, it looks like below.
>
> Call Trace:
> intel_pstate_init
> intel_pstate_setup
> do_one_initcall
> set_debug_rodata
> kernel_init_freeable
> rest_init
> kernel_init
> ret_from_fork
> Code: ...
> RIP: intel_pstate_register_driver+0x56/0x110 RSP: ffffa3a98000bd80
> ...
I guess this is a division by 0 due to the unmet assumption that the denominator
in min_perf_pct_min() will always be nonzero.
If this guess is correct, the patch below should help, so can you please test it?
Thanks,
Rafael
---
drivers/cpufreq/intel_pstate.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -571,9 +571,10 @@ static inline void update_turbo_state(vo
static int min_perf_pct_min(void)
{
struct cpudata *cpu = all_cpu_data[0];
+ int turbo_pstate = cpu->pstate.turbo_pstate;
- return DIV_ROUND_UP(cpu->pstate.min_pstate * 100,
- cpu->pstate.turbo_pstate);
+ return turbo_pstate ?
+ DIV_ROUND_UP(cpu->pstate.min_pstate * 100, turbo_pstate) : 0;
}
static s16 intel_pstate_get_epb(struct cpudata *cpu_data)
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Re: FW: [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework"
[not found] ` <CGME20170516042313epcms1p5523f4e3e1ae608eaf0327be0242ee46e@epcms1p1>
@ 2017-06-01 1:08 ` Jongman Heo
2017-06-02 0:41 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Jongman Heo @ 2017-06-01 1:08 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux PM, LKML, Srinivas Pandruvada
>
>--------- Original Message ---------
>Sender : Rafael J. Wysocki <rjw@rjwysocki.net>
>Date : 2017-06-01 08:58 (GMT+9)
>Title : Re: FW: [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework"
>
>On Monday, May 29, 2017 02:18:52 AM Jongman Heo wrote:
>>
>> Hi,
>>
>> FYI, 4.12-rc3 still has this issue.
>>
>>
>> --------- Original Message ---------
>> Sender : 허종만 <jongman.heo@samsung.com>
>> Date : 2017-05-16 13:25 (GMT+9)
>> Title : [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework"
>>
>>
>> Hi,
>>
>> With 4.12-rc1 (Linus git), booting fails due to kernel panic, at intel_pstate_register_driver+0x56/0x110.
>> I can't copy the whole trace from the graphic console, it looks like below.
>>
>> Call Trace:
>> intel_pstate_init
>> intel_pstate_setup
>> do_one_initcall
>> set_debug_rodata
>> kernel_init_freeable
>> rest_init
>> kernel_init
>> ret_from_fork
>> Code: ...
>> RIP: intel_pstate_register_driver+0x56/0x110 RSP: ffffa3a98000bd80
>> ...
>
>I guess this is a division by 0 due to the unmet assumption that the denominator
>in min_perf_pct_min() will always be nonzero.
>
>If this guess is correct, the patch below should help, so can you please test it?
>
>Thanks,
>Rafael
>
>
>---
> drivers/cpufreq/intel_pstate.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>Index: linux-pm/drivers/cpufreq/intel_pstate.c
>===================================================================
>--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
>+++ linux-pm/drivers/cpufreq/intel_pstate.c
>@@ -571,9 +571,10 @@ static inline void update_turbo_state(vo
> static int min_perf_pct_min(void)
> {
> struct cpudata *cpu = all_cpu_data[0];
>+ int turbo_pstate = cpu->pstate.turbo_pstate;
>
>- return DIV_ROUND_UP(cpu->pstate.min_pstate * 100,
>- cpu->pstate.turbo_pstate);
>+ return turbo_pstate ?
>+ DIV_ROUND_UP(cpu->pstate.min_pstate * 100, turbo_pstate) : 0;
> }
>
> static s16 intel_pstate_get_epb(struct cpudata *cpu_data)
>
>
>
Hi,
Your patch fixes the issue.
Thanks~.
Jongman.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: FW: [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework"
2017-06-01 1:08 ` Jongman Heo
@ 2017-06-02 0:41 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-06-02 0:41 UTC (permalink / raw)
To: jongman.heo; +Cc: Linux PM, LKML, Srinivas Pandruvada
On Thursday, June 01, 2017 01:08:16 AM Jongman Heo wrote:
> >
> >--------- Original Message ---------
> >Sender : Rafael J. Wysocki <rjw@rjwysocki.net>
> >Date : 2017-06-01 08:58 (GMT+9)
> >Title : Re: FW: [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework"
> >
> >On Monday, May 29, 2017 02:18:52 AM Jongman Heo wrote:
> >>
> >> Hi,
> >>
> >> FYI, 4.12-rc3 still has this issue.
> >>
> >>
> >> --------- Original Message ---------
> >> Sender : 허종만 <jongman.heo@samsung.com>
> >> Date : 2017-05-16 13:25 (GMT+9)
> >> Title : [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework"
> >>
> >>
> >> Hi,
> >>
> >> With 4.12-rc1 (Linus git), booting fails due to kernel panic, at intel_pstate_register_driver+0x56/0x110.
> >> I can't copy the whole trace from the graphic console, it looks like below.
> >>
> >> Call Trace:
> >> intel_pstate_init
> >> intel_pstate_setup
> >> do_one_initcall
> >> set_debug_rodata
> >> kernel_init_freeable
> >> rest_init
> >> kernel_init
> >> ret_from_fork
> >> Code: ...
> >> RIP: intel_pstate_register_driver+0x56/0x110 RSP: ffffa3a98000bd80
> >> ...
> >
> >I guess this is a division by 0 due to the unmet assumption that the denominator
> >in min_perf_pct_min() will always be nonzero.
> >
> >If this guess is correct, the patch below should help, so can you please test it?
> >
> >Thanks,
> >Rafael
> >
> >
> >---
> > drivers/cpufreq/intel_pstate.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> >Index: linux-pm/drivers/cpufreq/intel_pstate.c
> >===================================================================
> >--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> >+++ linux-pm/drivers/cpufreq/intel_pstate.c
> >@@ -571,9 +571,10 @@ static inline void update_turbo_state(vo
> > static int min_perf_pct_min(void)
> > {
> > struct cpudata *cpu = all_cpu_data[0];
> >+ int turbo_pstate = cpu->pstate.turbo_pstate;
> >
> >- return DIV_ROUND_UP(cpu->pstate.min_pstate * 100,
> >- cpu->pstate.turbo_pstate);
> >+ return turbo_pstate ?
> >+ DIV_ROUND_UP(cpu->pstate.min_pstate * 100, turbo_pstate) : 0;
> > }
> >
> > static s16 intel_pstate_get_epb(struct cpudata *cpu_data)
> >
> >
> >
>
> Hi,
>
> Your patch fixes the issue.
OK, thanks for the confirmation.
Here it goes again with a changelog and all.
---
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: [PATCH] cpufreq: intel_pstate: Avoid division by 0 in min_perf_pct_min()
Commit c5a2ee7dde89 (cpufreq: intel_pstate: Active mode P-state
limits rework) incorrectly assumed that pstate.turbo_pstate will
always be nonzero for CPU0 in min_perf_pct_min() if
cpufreq_register_driver() has succeeded which may not be the case
in virtualized environments.
If that is not the case, it leads to an early crash on boot in
intel_pstate_register_driver(), so add a sanity check to
min_perf_pct_min() to prevent the crash from happening.
Fixes: c5a2ee7dde89 (cpufreq: intel_pstate: Active mode P-state limits rework)
Reported-and-tested-by: Jongman Heo <jongman.heo@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -571,9 +571,10 @@ static inline void update_turbo_state(vo
static int min_perf_pct_min(void)
{
struct cpudata *cpu = all_cpu_data[0];
+ int turbo_pstate = cpu->pstate.turbo_pstate;
- return DIV_ROUND_UP(cpu->pstate.min_pstate * 100,
- cpu->pstate.turbo_pstate);
+ return turbo_pstate ?
+ DIV_ROUND_UP(cpu->pstate.min_pstate * 100, turbo_pstate) : 0;
}
static s16 intel_pstate_get_epb(struct cpudata *cpu_data)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-02 0:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170516042511epcms1p33c79e84f62d4b1d37cf227d2379bbecf@epcms1p3>
[not found] ` <CGME20170516042313epcms1p5523f4e3e1ae608eaf0327be0242ee46e@epcms1p6>
[not found] ` <20170529021852epcms1p66b2e89d2aec7988e00fb64c41a48a839@epcms1p6>
2017-05-31 23:51 ` FW: [4.12 regression] "cpufreq: intel_pstate: Active mode P-state limits rework" Rafael J. Wysocki
[not found] ` <CGME20170516042313epcms1p5523f4e3e1ae608eaf0327be0242ee46e@epcms1p1>
2017-06-01 1:08 ` Jongman Heo
2017-06-02 0:41 ` Rafael J. Wysocki
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).