Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp462059lqj; Sun, 2 Jun 2024 06:40:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWP6PJXBivh6Ekvq/Mq/+y3Fo5yHcxRed/oslFhPp7JDpVr2hsLVfbUK5jsZ+gPaRUH9A9edMlqV9EYAPJCdaqR8pEl3UM1quQ5nwduaA== X-Google-Smtp-Source: AGHT+IFbQX7QwpYhfVhQWZEWB4PAEv2WfKpl3NaH6il5PKpxAohZroQWoJYsa0JPyrKKaMeZQGQ7 X-Received: by 2002:a05:6a00:3c83:b0:6f4:59cd:717 with SMTP id d2e1a72fcca58-702478c7cfcmr8298903b3a.28.1717335642667; Sun, 02 Jun 2024 06:40:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717335642; cv=pass; d=google.com; s=arc-20160816; b=A5mhUa32DctGNQUC049LX/a9PQWeTNSVwVShN9a04pa/gq4wYt7pmFrDEraBpNQp4Z CD645CjQyc1X3lmhiEdJkfIgVitODXTP4t3CPGBwLgxEjyyK7VzzxuaV6UnV781OqBLa 83OlFeV0QNgl8bpNIKNjeAYRQHZU+83fLwRB10ha53XBunks7MZQiL06f7iEOfhcj0X+ V8eaOGUxftRBsGy2LhzmAaaCMSONt4NWiTr0Gnx5pirJitpXnmRX3GkPLy6ja4t0bg3r n0GnZT9338g+ccQ3cmfaZdObjIEOMt7XzdvFJO2Od4uFRSr56pydiHzU5pH6t9D9/4R4 oEpw== 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=NugtBoo6HeoPWFobyp5Dqem7d2GcQeN/7XD7a5PIxwY=; fh=xrkL5PxAQXhFicTamXjfKvqI05HKtutp2rAf13IMZFg=; b=wADKpRVlevd4L8nwfwlkmu++ZKqyFtbMwnlhA+feixrKmoJ7Y0DbeGvuIif6Vy5+yx KPO6zWhTEXiq+rORc8HFvGdlHyq+r9E8Rqjy285l0NZ7WhRtiw5ryjnSdsE83o/qxsvg Cw2mUzXBPxfdyOyBlxj1hryatGL1mEk66JqJDTwP41zRLvs5x0iZOMdWvy9CZQ+m5af5 YfnTbPzMvQ9vCDfcwDLnWq9eTq4ea/26j4Ejp6e2NY3uOePUe8ZYWIFyV4jiOxG8gAfi 6b1c/WHxXwQyZfGmVCTPi5fstlaFQopCqZuPk3r+tRPKG569BevnSTZSvV+btth/7j1e Y3Vg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZMidcGMt; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-198264-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198264-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70242e636edsi4859689b3a.390.2024.06.02.06.40.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 06:40:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198264-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZMidcGMt; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-198264-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198264-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3FE5A281BC2 for ; Sun, 2 Jun 2024 13:40:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB4883FB1B; Sun, 2 Jun 2024 13:40:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZMidcGMt" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 69FBD3A1DC; Sun, 2 Jun 2024 13:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717335634; cv=none; b=gGhi3FmtxZQNPDRMkglCnz7r+7inT+tOtOi9WYo2yRsvtrX4NiZDtwcj/iwcNeoUNsuf4KJYwpkReo8weAUDifSAISmZs/svuPzzc6RvBk3RMfA2z4GwOMpMUHfJ7PY//jzNF7yhMougkGUaH38RgsiHdGwPdvhg7pzfZ4AohkM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717335634; c=relaxed/simple; bh=NugtBoo6HeoPWFobyp5Dqem7d2GcQeN/7XD7a5PIxwY=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=Zj6I48yKbI8FvaQBcxbwoZI15qNqzU+7oHa/l6UgzDe62VHez3oHElqcEnDQBWys0kZjuagejnljKxE89GKaz69eaD7HFW6q3dxb33d0QKVrle5SLkOmwUjmKdqgOYRLUWBccehXVIcpxauPNeIv5AirFruEnN52KTqqYoLrTeA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZMidcGMt; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717335633; x=1748871633; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=NugtBoo6HeoPWFobyp5Dqem7d2GcQeN/7XD7a5PIxwY=; b=ZMidcGMtGeZ0LGYUflk9rYPxT6aTnWWJ4SIk4XwDNrKiwKJ2laXsawwm grBzEe3UGwYk2L59eXd62s6ZNjKUNznL3+pPOclt/UTYIytdZARxJXQrP ehmqX4PoWbEdGwK/MI06M6AoroviRqf2F0BYZsZtEfJLOPvwNTagy3/rR 6yNOkMqBG23/sMAVxQNwnjPm42IFzIU5pqP/trGavdCIZzryTURLGiIbC XPiXHaQ+zBSjtNB7pUUU68SjudjXh2nN2PIs07VGBp8mo4p6sopt0OSDq 4r6Fjg1pn3fz95JC7Ig9PVEdkmSae0Ji5jdLv4+pWetI0EW0wMkmG1BM3 Q==; X-CSE-ConnectionGUID: lMHKWjjGQ8GVzXueetKhjA== X-CSE-MsgGUID: yBhArZPgQ5iW6CNOuunuMA== X-IronPort-AV: E=McAfee;i="6600,9927,11091"; a="14021895" X-IronPort-AV: E=Sophos;i="6.08,209,1712646000"; d="scan'208";a="14021895" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2024 06:40:32 -0700 X-CSE-ConnectionGUID: n126bJhYTfuM9l4t/0QEDg== X-CSE-MsgGUID: xn0Des1vRDSpMh3bPjxRzg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,209,1712646000"; d="scan'208";a="37079604" Received: from spandruv-desk.jf.intel.com ([10.54.75.19]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2024 06:40:32 -0700 Message-ID: <30a30c5107a47a2cc3fd39306728f70dd649d7fe.camel@linux.intel.com> Subject: Re: [PATCH v1 2/6] cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization From: srinivas pandruvada To: Xi Ruoyao , "Rafael J. Wysocki" , Linux PM Cc: LKML Date: Sun, 02 Jun 2024 06:40:31 -0700 In-Reply-To: <6ebadacd8aaa307a5766cdb1b4d4a5c69acd87ac.camel@xry111.site> References: <13494237.uLZWGnKmhe@kreacher> <8366982.T7Z3S40VBb@kreacher> <6d5ee74605bd9574baa5ed111cb54e959414437a.camel@linux.intel.com> <6ebadacd8aaa307a5766cdb1b4d4a5c69acd87ac.camel@xry111.site> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Sun, 2024-06-02 at 12:25 +0800, Xi Ruoyao wrote: > On Sat, 2024-06-01 at 21:03 -0700, srinivas pandruvada wrote: > > Hi Xi, > >=20 > > On Sun, 2024-06-02 at 11:21 +0800, Xi Ruoyao wrote: > > > On Mon, 2024-03-25 at 18:02 +0100, Rafael J. Wysocki wrote: > > > > From: Rafael J. Wysocki > > > >=20 > > > > The global.turbo_disabled is updated quite often, especially in > > > > the > > > > passive mode in which case it is updated every time the > > > > scheduler > > > > calls > > > > into the driver.=C2=A0 However, this is generally not necessary and > > > > it > > > > adds > > > > MSR read overhead to scheduler code paths (and that particular > > > > MSR > > > > is > > > > slow to read). > > > >=20 > > > > For this reason, make the driver read > > > > MSR_IA32_MISC_ENABLE_TURBO_DISABLE > > > > just once at the cpufreq driver registration time and remove > > > > all of > > > > the > > > > in-flight updates of global.turbo_disabled. > > >=20 > > > Hi Rafael and Srinivas, > > >=20 > > > Thanks for the clean up, but unfortunately on one of my laptops > > > (based > > > on i5-11300H) MSR_IA32_MISC_ENABLE_TURBO_DISABLE is mysteriously > > > changing from 1 to 0 in about one minute after system boot.=C2=A0 I'v= e > > > no > > > idea why this is happening (firmware is doing some stupid thing?) > > >=20 > > > I've noticed the issue before and "hacked it around" > > > (https://bugzilla.kernel.org/show_bug.cgi?id=3D218702). But after > > > this > > > change I can no longer hack it around and the system is much > > > slower. > > >=20 > > > Is it possible to hack it around again? > > >=20 > > Please try the attached diff and build kernel and try. > >=20 > > git apply update_max_freq.diff > >=20 > > Then build kernel and install. >=20 > Unfortunately it didn't work.=C2=A0 Then I tried: >=20 > @@ -1304,6 +1310,10 @@ static ssize_t store_no_turbo(struct kobject > *a, struct kobj_attribute *b, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (no_turbo =3D=3D globa= l.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=C2=A0goto unlock_driver; > =C2=A0 > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0global.turbo_disabled =3D turb= o_is_disabled(); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0global.no_turbo =3D global.tur= bo_disabled; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0arch_set_max_freq_ratio(global= .turbo_disabled); > + > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (global.turbo_disabled= ) { > =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=C2=A0pr_notice_once("Turbo disabled by BIOS or unavailab= le > on processor\n"); > =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=C2=A0count =3D -EPERM; >=20 > and my old hack worked again.=C2=A0 Curiously after I writing 0 to > /sys/devices/system/cpu/intel_pstate/no_turbo successfully, your code > is > triggered. >=20 > $ dmesg | grep intel_pstate > [=C2=A0=C2=A0=C2=A0 0.554425] intel_pstate: Intel P-state driver initiali= zing > [=C2=A0=C2=A0=C2=A0 0.554877] intel_pstate: HWP enabled > [=C2=A0=C2=A0=C2=A0 1.780021] intel_pstate: Turbo disabled by BIOS or una= vailable on > processor > [=C2=A0=C2=A0 21.789044] intel_pstate: intel_pstate_update_limits cpu:0 > [=C2=A0=C2=A0 21.789053] intel_pstate: intel_pstate_update_limits cpu:1 > [=C2=A0=C2=A0 21.789060] intel_pstate: intel_pstate_update_limits cpu:2 > [=C2=A0=C2=A0 21.789189] intel_pstate: intel_pstate_update_limits cpu:3 > [=C2=A0=C2=A0 21.789198] intel_pstate: intel_pstate_update_limits cpu:4 > [=C2=A0=C2=A0 21.789203] intel_pstate: intel_pstate_update_limits cpu:5 > [=C2=A0=C2=A0 21.789209] intel_pstate: intel_pstate_update_limits cpu:6 > [=C2=A0=C2=A0 21.789276] intel_pstate: intel_pstate_update_limits cpu:7 >=20 > The message at [1.780021] is from the first attempt writing 0 to > /sys/devices/system/cpu/intel_pstate/no_turbo when > MSR_IA32_MISC_ENABLE_TURBO_DISABLE is still 1 This requires user action, Please add a pr_info() to https://elixir.bootlin.com/linux/v6.10-rc1/C/ident/acpi_processor_notify Check if you got any message Also what is=20 cat /proc/cpuinfo and cpuid -1 Thanks, Srinivas