On Wed, Nov 20, 2019 at 7:55 AM Doug Smythies <dsmythies@xxxxxxxxx> wrote: > > On 2019.11.19 14:14 Rafael J. Wysocki wrote: > > On Tuesday, November 19, 2019 8:17:05 PM CET Rafael J. Wysocki wrote: > > ... > > >> However, I now also see that freq_qos_remove_request() doesn't clear > >> the qos field in req which is should do, so freq_qos_add_request() > >> will complain and fail if the object pointed to by req is passed to it > >> again. > >> > >> I'll send a patch to test for this later today. > >> > > > > The patch is appended. Please test it (on top of 5.4-rc8) and report back. > > > > --- > > kernel/power/qos.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > Index: linux-pm/kernel/power/qos.c > > =================================================================== > > --- linux-pm.orig/kernel/power/qos.c > > +++ linux-pm/kernel/power/qos.c > > @@ -814,6 +814,8 @@ EXPORT_SYMBOL_GPL(freq_qos_update_reques > > */ > > int freq_qos_remove_request(struct freq_qos_request *req) > > { > > + int ret; > > + > > if (!req) > > return -EINVAL; > > > > @@ -821,7 +823,11 @@ int freq_qos_remove_request(struct freq_ > > "%s() called for unknown object\n", __func__)) > > return -EINVAL; > > > > - return freq_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); > > + ret = freq_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); > > + req->qos = NULL; > > + req->type = 0; > > + > > + return ret; > > } > > EXPORT_SYMBOL_GPL(freq_qos_remove_request); > > Yes the patch fixes the problem. Thanks. > > I tested several hundred times switching between > passive and active modes with the intel_pstate driver, > including with various CPUs disabled and re-enabled. Thanks a lot! Let me resend the patch with a changelog and tags.