Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1103986lqt; Fri, 7 Jun 2024 08:07:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHjrNuCUOXlc8nZZDYqQVkAY0Tem3DktYitArwH39dsmYp10Bxd0VdUwbs1jv3hG56UNU7nHzl2VPTAGLFhxTz9/kMUvXZJepsO7P++A== X-Google-Smtp-Source: AGHT+IGefX8/1Pebm1NIfWsB7REkgn7K8erOd/FhaPwKEPjFDHLrdA5voCiKVLsSbJCFv7ARcj5c X-Received: by 2002:a17:906:2989:b0:a68:ff92:46f0 with SMTP id a640c23a62f3a-a6cd5614c41mr203816866b.10.1717772838886; Fri, 07 Jun 2024 08:07:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717772838; cv=pass; d=google.com; s=arc-20160816; b=QuFkLb5vpWgLildTm8sUxBMEtGVpk1ukoIgCcBQHe2kruoATpp6QFglD5n7xJdSsVY 6s60GE/zxkjeVuuSjPMYk1o6d4A3JOnf9+OvB+rDTcUBWk2Rlh7n1OMiCms0jyKsnWL6 38IkXCB5WNXU4rovnb7gAo+/1RBKOJWsIPZLllCcvtfgDiI0zma+ZfHgvr7vd3QxByZ6 CYyz52ElgmTgvB974uIoMci1CzEbe2m79T2w52Ztr6pOOCkul1f2znd+E3LKhr2iYrlj uiRXf7o/Rg9ZW2liag+sF3S5Duh/bhGmVWEBDBgC/iLyAASDYIiy2WVson66tOe3CO0J X1Ag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=vDF6a3tDMzYiekKq/2BB294Ynz3MXARG91Bdi8vooMU=; fh=XjtIh5z4NRemndJg6MjLKvnwyqTY1lrOx2yD/xJws+4=; b=iZh4np/ag3beC5/p2wexPIcnGmcMRZ5FLgyiawTCv4XVnK0BKqNsVHfh3FRcIljjsC ml8Xg71y3fmg9madYQnrSZXiW/I5pgJmA/eEBXpM+uu8M8OKuGbQaNacf0b8CjBYPoYY MiuRbIuR0hO+6O4I+jy+X+agKYWFFyL/46NSrAumNZHRDduh/H+Bp6iNq7AVWOKSBz7K CcK6LNbKmn8+fTerKKxMDqDTRkOzDXTp4gMqqsgQX2tdK5GGEi4aFl7xGktL/Om337qo Mrgphfx4eJKQQ7bavMmCCp7jeBMfx2agjreKk4JmFAfJYOQvQfyKs+NZL4++hgOp4xiY 1t9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JdOkLoTu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-206350-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c805cd694si194250166b.247.2024.06.07.08.07.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 08:07:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206350-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JdOkLoTu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-206350-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8DDC51F27422 for ; Fri, 7 Jun 2024 15:07:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08436199E86; Fri, 7 Jun 2024 15:05:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JdOkLoTu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0FA2F198E84; Fri, 7 Jun 2024 15:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717772709; cv=none; b=MI1zGRXifVaXlB3SCHCll6lzvA2ZQ0q4MN3/TEj2Q7elI3ldt5iGS4ujyhAFgCp0X3ZhJC3LHo627jt260BU9lUyVyHnFsyvzAXeumlJrngTfOzgKOAPy9e8ZUkRMV91yFK4cQmmkLSQ4O1uwqm2l7PEihwCsrNCgZoWlCtEsjk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717772709; c=relaxed/simple; bh=hxdOBIFpzvLuVlj0/tQBcXCexd1esA1lmDKCEQeF3os=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=U8yfinLrEuk9cQAYDi04enupDMgWYefh/yv8fmhug8dCxJPYkxpHl0ICjrrQVvPgUElNiCGCfgjI+XWBu4HbWV5busInbJFM/w9E3T/8fdWppptPcjZ+VB6d2qNBrhi5+J/mopCTyj/LDApu1BLzSuqabLGYqepRL0Spl88/uec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JdOkLoTu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98155C3277B; Fri, 7 Jun 2024 15:05:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717772708; bh=hxdOBIFpzvLuVlj0/tQBcXCexd1esA1lmDKCEQeF3os=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=JdOkLoTuwU5TUS/3Jnkj8onU1nEE/NJd1hlbXzy4ym2o4U3wTEN7j0d2ioefsrqeC 1HMy3F4DagBQrDgKMxVw3BRqaMVEpPMLL4l+RGFnT4d4305AzqxodiZjEyv6Gp7Ckx NRDZZLpc69z1WsOAFWoGdbvDpIsi2uPQ0BVNpwCHdRTzymUJKWtnbuWXFqW5fX0nmG bNucAus4qZMeheiMFGCXTt/mR1vJMveUCBfyDArgwAyZq6hImXuuA9RsnsjFIYlE2f KPSzGEueSqnUutxCVFled7fBvaknBYjO0awW3BOe5kCk2F0m+Zns8RycmEAsz2gry6 rRoDKJ/O2czlw== Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3d218bbba30so46029b6e.3; Fri, 07 Jun 2024 08:05:08 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUb1bWKE1H/tLnut/mdXSjFEgelKxnRRz5vmoo9R4ge4F9UM0RErSSdnELQjM5Wtzh0DcQJNlys/q+SWcCw/HpFRzuUrl4NyTKUjuVL0n3Zj9BPFIgyaz0o6LMshq4UIIUQRhVWgGw= X-Gm-Message-State: AOJu0Yx6Mlxi5TDDt6mjp6f/YP2GO/1Mf6binL19ciMLQNFN3vDS7hha xl9/F6j5QIWM0Z2DdfVcEtV/+xSvNT1hbtyoTEmWsIcRt1HSRtScdtvd16KX6p7fGICSldPNCG9 lqM+OFRlVGgzPqqAWjNbgsXxEV2E= X-Received: by 2002:a4a:a788:0:b0:5ba:ca8a:6598 with SMTP id 006d021491bc7-5baca8a70b5mr898315eaf.0.1717772707773; Fri, 07 Jun 2024 08:05:07 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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> In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 7 Jun 2024 17:04:56 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 2/6] cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization To: srinivas pandruvada Cc: Xi Ruoyao , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Linux PM , LKML Content-Type: multipart/mixed; boundary="0000000000000d69a0061a4e20a2" --0000000000000d69a0061a4e20a2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 5, 2024 at 2:05=E2=80=AFPM srinivas pandruvada wrote: > > 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. > > > > 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. > > 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. > > 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, > > no_turbo =3D !!clamp_t(int, input, 0, 1); > > + global.turbo_disabled =3D turbo_is_disabled(); > + > if (no_turbo =3D=3D global.no_turbo) > goto unlock_driver; > > > Need to adjust the mutex around it also. Anyhow, it can be made work. 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. Something like the attached (untested) patch. --0000000000000d69a0061a4e20a2 Content-Type: text/x-patch; charset="US-ASCII"; name="intel_pstate-turbo_disabled.patch" Content-Disposition: attachment; filename="intel_pstate-turbo_disabled.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lx4tgzik0 LS0tCiBkcml2ZXJzL2NwdWZyZXEvaW50ZWxfcHN0YXRlLmMgfCAgIDE5ICsrKysrKysrKysrKy0t LS0tLS0KIDEgZmlsZSBjaGFuZ2VkLCAxMiBpbnNlcnRpb25zKCspLCA3IGRlbGV0aW9ucygtKQoK SW5kZXg6IGxpbnV4LXBtL2RyaXZlcnMvY3B1ZnJlcS9pbnRlbF9wc3RhdGUuYwo9PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09P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