Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1539326lqt; Sat, 8 Jun 2024 02:31:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUHopTZ/1IWxFr6rKV7OKNrHDRN4TQIIlZ9k+vytZ24uF08FsTNrUIg/hvRJoVSU+Iki0AVDraT08tZiXUDojB9oabvZW9dHMcm8FhMJA== X-Google-Smtp-Source: AGHT+IGQ2BBarcfy+MzBqJe9MlRALACfUYMCmsGMDPsWwQLIXzl7W3vXl8pTY2g6dZoOKLTHcQqu X-Received: by 2002:a05:622a:13ce:b0:439:d0ed:39e4 with SMTP id d75a77b69052e-44041b4ea6emr50800031cf.4.1717839075859; Sat, 08 Jun 2024 02:31:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717839075; cv=pass; d=google.com; s=arc-20160816; b=p22CpkuXdymlpOI3gs9JBbCJIw7CbziFcXqi0hUpmCoGCIaynuMlMeYzGqv71RI1pV +7O7bcHm5Gog3XE+y/gogw/npST4xx7cKAymbcmkmPn+lrmCb+uQxDf9gDiAhN0YMS2h 2y6w2YDZo2EBiHrGTznPtQ91GpUhitjXZ6OGd7lzxhPEo/qxkFGzYg4Si4WbZMxJhduk V+fgWwy6bhgXKO32tLZb9FEw0RhuRfMsLRJX8kwVHvk8nCQUgQoso4hcXF1HJFEF4BNt aj20vErmtUq3hU+5hbnmsUz2DRCfQygsR90j4X+yYUtqNOacL1G25pdO6rLLEyzJKgMx J63Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=xsEQ4RbKUCCvCOLijKx+rrLpk6s3nFjLGIQkMHpDzro=; fh=1zlAyoHwLWj2dpcUUjQOLNirz4V+cQkZURzC4Y8xDqA=; b=KQLZ2+ca9Sj5yq2VhilbZ/5WQuIlPgzD5wokRbA5kXQws6HACvDx83J/+BBk+X00PP 5UKpqC7M84oIbF5C9MXwabobPzmMBuQ29bnQ9Y81I3JSZ0rstsbcWRZMubvEqs9WMFtL CA484+IQgeMyW2WeIxDOyb6Fxq+Z205dCAzZ+MmFrTJEFlAaCy/Z72grIVolzWjckWL/ r1Oz0/u27M39k6hQAyJndRkuTcn9kSknD1bSIp3fwYr57Oyoicj/ImTzWV+rx8APpVZf qXeLOglTgd6ESlCNMew6LTU0pHlSwpgXtjn5nIBoUaP1Eatkd2vh6fzP3d+Jj87/XYk+ xeEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=WKj8JVl6; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-206997-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206997-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-44038b38d6fsi59272001cf.419.2024.06.08.02.31.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 02:31:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206997-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=WKj8JVl6; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-206997-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206997-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 90C9B1C216AC for ; Sat, 8 Jun 2024 09:31:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D183176FAB; Sat, 8 Jun 2024 09:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="WKj8JVl6" Received: from xry111.site (xry111.site [89.208.246.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9281B10A1A; Sat, 8 Jun 2024 09:31:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.208.246.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717839066; cv=none; b=eFEAgFxlXzuUaGoiS9qbD8S7ozrHcEHd/cfXrRwA06LgR6EVsIerF0HKDlFNhPzGnSa0FrmdlR/b9myrfQawSgPuWaH2d5FIJyFjH7BHQ++P+1TpNuefKa4BzJTg7/jRXuaigFEwkIjYcc4anH/ssGR1O6aCTmlx9jur96Hu8EU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717839066; c=relaxed/simple; bh=xsEQ4RbKUCCvCOLijKx+rrLpk6s3nFjLGIQkMHpDzro=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=HG1LWZsbms751pQKovMU6V20FWzt1fJKFu+JVV4+eTD657n5/W3ifBJ9DcOORk9sD1Mfv6+bF3EVE/X4QT8OQrVrC1VGvPB6DCVo9f1ohyudozQ/L1MsDMnmL1KyleuHelwWRcic8O5XInLLUpXfgugUC6XbrUMTslTKyU7LwC4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b=WKj8JVl6; arc=none smtp.client-ip=89.208.246.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1717839057; bh=xsEQ4RbKUCCvCOLijKx+rrLpk6s3nFjLGIQkMHpDzro=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=WKj8JVl64i+29XvnAOfZLe0+B7Pb6ZuHx2kNBskgqIcineM5NslulL7aZX43FJUnA sXox9Hy152zqbomhx/C84077XN4L5rGiZRAMryW3cvutV8WGJPK+1//V10VIx8sw2o rYKkbAkRWbcBJJKjQjEYMmWNhD4FZZb+UO2t2XpQ= Received: from [IPv6:240e:358:1149:1500:dc73:854d:832e:6] (unknown [IPv6:240e:358:1149:1500:dc73:854d:832e:6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id D896A6709E; Sat, 8 Jun 2024 05:30:54 -0400 (EDT) Message-ID: <4179689cade0b26bb412d6aef2f695664d16a6eb.camel@xry111.site> Subject: Re: [PATCH v1 2/6] cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization From: Xi Ruoyao To: srinivas pandruvada , "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Linux PM , LKML Date: Sat, 08 Jun 2024 17:30:50 +0800 In-Reply-To: <4fe39e45c117a976b60dfb37234551391050b199.camel@linux.intel.com> References: <13494237.uLZWGnKmhe@kreacher> <8366982.T7Z3S40VBb@kreacher> <6d5ee74605bd9574baa5ed111cb54e959414437a.camel@linux.intel.com> <6ebadacd8aaa307a5766cdb1b4d4a5c69acd87ac.camel@xry111.site> <30a30c5107a47a2cc3fd39306728f70dd649d7fe.camel@linux.intel.com> <29d69252dcdc398f147c9139a8666d09e7bd831d.camel@linux.intel.com> <0324bc3a88654855719cd48a5ed69a34eea31037.camel@xry111.site> <48eba83030e155f703b4248e9c1ae65aa44b1a83.camel@xry111.site> <1da736da33a61de92314934ecf7fa0420d6d6b81.camel@linux.intel.com> <63e98f2151ef64de92cf7e3da796937755ea5552.camel@linux.intel.com> <258ce61c155c28937620f6abe57a39f2b4b0ff56.camel@xry111.site> <101b903e58f2ebae60934edc374c7cda09f83de1.camel@linux.intel.com> <651d11578646200cdb0a91c46ed09a22f29e94a0.camel@linux.intel.com> <1031cc4e4b507628531d9115ce7e4bc588dbab1c.camel@xry111.site> <4fe39e45c117a976b60dfb37234551391050b199.camel@linux.intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2024-06-07 at 08:18 -0700, srinivas pandruvada wrote: > On Fri, 2024-06-07 at 17:04 +0200, Rafael J. Wysocki wrote: > > On Wed, Jun 5, 2024 at 2:05=E2=80=AFPM srinivas pandruvada > > wrote: > > >=20 > > > On Wed, 2024-06-05 at 13:21 +0800, Xi Ruoyao wrote: > > > > On Tue, 2024-06-04 at 09:56 -0700, srinivas pandruvada wrote: > > > > > > > With such a delay, I am not sure how this even worked > > > > > > > before. > > > >=20 > > > > It didn't work out of box but it worked after manually writing 0 > > > > to > > > > no_turbo after 20 seconds, see > > > > https://bugzilla.kernel.org/show_bug.cgi?id=3D218702. > > >=20 > > > That make sense. So it never worked out of box. The > > > store_no_turbo() > > > has additional read for turbo flag before, which is removed now. I > > > think adding that back will will restore old behavior. > > >=20 > > > diff --git a/drivers/cpufreq/intel_pstate.c > > > b/drivers/cpufreq/intel_pstate.c > > > index 4b986c044741..0d5330e5b96b 100644 > > > --- a/drivers/cpufreq/intel_pstate.c > > > +++ b/drivers/cpufreq/intel_pstate.c > > > @@ -1301,6 +1301,8 @@ static ssize_t store_no_turbo(struct kobject > > > *a, > > > struct kobj_attribute *b, > > >=20 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 no_turbo =3D !!clamp_t(int= , input, 0, 1); > > >=20 > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 global.turbo_disabled =3D turbo= _is_disabled(); > > > + > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (no_turbo =3D=3D global= .no_turbo) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 goto unlock_driver; > > >=20 > > >=20 > > > Need to adjust the mutex around it also. > >=20 > > Anyhow, it can be made work. > >=20 > > global.turbo_disabled can be updated right before it is checked in > > store_no_turbo(), so if 0 is written to no_turbo (and global.no_turbo > > is 1), it will succeed if global.turbo_disabled changes from 1 to 0. > >=20 > > Something like the attached (untested) patch. >=20 > Should work. >=20 > Xi, > Please test so that we can close this issue. Yes it restores the old behavior for me. Tested-by: Xi Ruoyao --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University