Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1195189rdb; Mon, 19 Feb 2024 07:14:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW2uDHCndGp4sZWmGsxw+J7dOmKuxR8ADEySIQacq5xGlWcHu8cW7CMRSZdHTC7gq2Ddy69yQUyAQGVPlKZGNexRq8kOyyumKZ/P6wDww== X-Google-Smtp-Source: AGHT+IFqaJ5zYVSZPBFzM+Np/N40HDD0DUFwZ5HBeFtmtv2Py+QQrmt7oZOd0P3K50zgCXJEIqXG X-Received: by 2002:a05:6a20:9f48:b0:19e:4c37:8737 with SMTP id ml8-20020a056a209f4800b0019e4c378737mr15171646pzb.5.1708355682340; Mon, 19 Feb 2024 07:14:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708355682; cv=pass; d=google.com; s=arc-20160816; b=CakGTA9GIykw4rjH4oOkmS2b6wHENjDgIOTgW8wlg7EosGz1vF67kXwXKzOzo8be0d Chrc7+oEJpOW9xCQ4UQyaa2vgCxjUJfK3/Qow0f7EW35r1CK8WPzEu3xmRY/d3CK9Czi GLF/cPIf+HN5ETQ+OWjGQv26Gge61b53NyWrlYM6AdIcYF6hHsoxhhBSWTcCcS7GshW4 qZ8uJgcqybhHLiy20fRTLKleuYgaiYGe8Uwm0P/oMUkfbA3AHufGslfsyE2LYSdIxtAY 9DcrNxZs75SIkmyGboNdswpL9FFkbxs2NBMG8RIJaEFbSMx/KbtYdvcNLsTRbO4dcfBf c7UA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=T1Y+CtE1cF4upI7SQ3B2wjaUi/0ZYHr3yApmOLdpaRU=; fh=QDSOQDnvj9fCfOagbr4omBL8uw57CT9quC8Fmh5UJic=; b=o/nFgKhwsp6Roiq/zKxIYkIBLLmXr71p/jJHDdNXAiQsc7w42+1JVqn9sJhCjITpL4 KjF9eOBJ0hFAPU82Tjv7cJbQc6NJqqHIIrOhTrCI5tipbppJTaQ3J/9GkiKKTzX9TE+b CmM/w3ItgJa5Jxj/cukMkj0ooDWpVqwKP9ImHQcpWeErP/EfX3NMEjUChU5UCapx5cKE TI1OzpUDeVMRGQI2+ZIci1WrlyfTRXi5qS7Lu0UVBBuXSNGsDekaIoUtvaGJDmJbQ95R JZah+iJ1b6WLmFCsRS1UBmTCpzWy/mvgxW+2x+4g2DtuukVME611Yy2XihvL2ztAP32i ipDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=gk9BtmfL; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=oi7xwq5E; arc=pass (i=1 spf=pass spfdomain=squebb.ca dkim=pass dkdomain=squebb.ca dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-71567-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71567-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q11-20020a656a8b000000b005cf94b8d9ddsi4651878pgu.869.2024.02.19.07.14.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 07:14:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71567-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=gk9BtmfL; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=oi7xwq5E; arc=pass (i=1 spf=pass spfdomain=squebb.ca dkim=pass dkdomain=squebb.ca dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-71567-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71567-linux.lists.archive=gmail.com@vger.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0A6DE2823F0 for ; Mon, 19 Feb 2024 15:14:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11D2720319; Mon, 19 Feb 2024 15:14:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b="gk9BtmfL"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="oi7xwq5E" Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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 F159A2C1AD; Mon, 19 Feb 2024 15:14:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.26 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708355674; cv=none; b=l/N4/J038hTNupyOY9oJOIJjGC36M8qJNdc2QEK10utbg+7JK8NHklHmqH4RG/EgVzdAO7vdWVY6ngRVptHPpgYmd5eyX9jwQZfEPZIuSTIowX7gmHwJWFhhDh6ZBg2ysM8H8BP7Nrdcg3ScM9ThoKEHzksHG04PWRU9U4t1CQY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708355674; c=relaxed/simple; bh=5MVJrTp+bNza9ZMAQf7AGBb6UwjGk8bOxNP0jEjDp8c=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=fqCnWulLCXpqvyD5SKLrjuFa5WoRJ+MqojsVWHG8fpJMF/UvWbSyc620c+YVyAgTSqCpCTkX5ZHdWuJ5J8csTikFz1Yh9l1ikjTmEpw2XQ7z6aNKci7cgPmv+hmSZH9AOaU7lJKFMO72zjG/iMrwUjfRicRxDFEQ+xkU0bKpI5s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca; spf=pass smtp.mailfrom=squebb.ca; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b=gk9BtmfL; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=oi7xwq5E; arc=none smtp.client-ip=66.111.4.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=squebb.ca Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CD78E5C00BF; Mon, 19 Feb 2024 10:14:30 -0500 (EST) Received: from imap52 ([10.202.2.102]) by compute3.internal (MEProxy); Mon, 19 Feb 2024 10:14:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squebb.ca; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1708355670; x=1708442070; bh=T1Y+CtE1cF 4upI7SQ3B2wjaUi/0ZYHr3yApmOLdpaRU=; b=gk9BtmfL+tPZq6aPjNQaI9mfe5 cmcDgnj54IuAcvNANj6ytwqd2q3rlp3SePviOn7bny9z5toTtqiCrUDoq0LgVjfA fFEcfci4Sev/9uO18PgZDxVKhClMgab/6zu7Iq57I7ToffsQ99B99W+rwVJ6bW90 FQHnFPyUUpzGIAAjIrBAQJoICGnRDag8+7DLrLAUZf4ZBKTuIAdj01xcBFCS2G09 wrmQSUzn3aHgVMIoiiGySVkEQnQnckWdxBfna0GqwycWfgXt+7QlhlviZtNZJu9b 3VaVo4Ts+neKKkMIUHi7rmkTUlRcbQ1rJGQurAmVhnUUBprFmbSl7FS/vDyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708355670; x=1708442070; bh=T1Y+CtE1cF4upI7SQ3B2wjaUi/0Z YHr3yApmOLdpaRU=; b=oi7xwq5Ex897J9GPcpa5sFsjXypOr99CyPbCKtMWcfrH b9dKXDnUjoJBGZyCEoJg688vj/Ps4VCigPOep3tu5vprjBkLEMzBJ7AepJnRDrdA ojtkk6BgrgcO5AT6QOyZi+UkYdXZM6hFrtNVlELakg4JbYXVfbnOVMxEzl47pqiH Ah6H7uvlkVcGTgwmbRZAhZGZC13vixKSjldebZkk/B5/R7ij/LevIHK5ezz6iXUb 0pN9HWqO0CQ5/6ZkACINIkLz9WQNuhnhfpOMnD3zSxcqViq2DJSlh/50LcPjGX62 p+6hWCAmmd9XkzLufybv3psjc1vGU+RSD1sFQklDBw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdekgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdforghr khcurfgvrghrshhonhdfuceomhhpvggrrhhsohhnqdhlvghnohhvohesshhquhgvsggsrd gtrgeqnecuggftrfgrthhtvghrnhepieeufeejieevteduvdekteefledtveffveduheff feejudefvdeijeegudegkefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepmhhpvggrrhhsohhnqdhlvghnohhvohesshhquhgvsggsrdgtrg X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 81F94C60098; Mon, 19 Feb 2024 10:14:30 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-144-ge5821d614e-fm-20240125.002-ge5821d61 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: <20240217022311.113879-1-mario.limonciello@amd.com> References: <20240217022311.113879-1-mario.limonciello@amd.com> Date: Mon, 19 Feb 2024 10:13:54 -0500 From: "Mark Pearson" To: "Limonciello, Mario" , "Hans de Goede" Cc: "platform-driver-x86@vger.kernel.org" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] platform/x86: thinkpad_acpi: Only update profile if successfully converted Content-Type: text/plain Hi Mario On Fri, Feb 16, 2024, at 9:23 PM, Mario Limonciello wrote: > Randomly a Lenovo Z13 will trigger a kernel warning traceback from this > condition: > > ``` > if (WARN_ON((profile < 0) || (profile >= ARRAY_SIZE(profile_names)))) > ``` > > This happens because thinkpad-acpi always assumes that > convert_dytc_to_profile() successfully updated the profile. On the > contrary a condition can occur that when dytc_profile_refresh() is called > the profile doesn't get updated as there is a -EOPNOTSUPP branch. > > Catch this situation and avoid updating the profile. Also log this into > dynamic debugging in case any other modes should be added in the future. > > Fixes: c3bfcd4c6762 ("platform/x86: thinkpad_acpi: Add platform profile > support") > Signed-off-by: Mario Limonciello > --- > BTW - This isn't new. I've been seeing this a long time, but I just > finally > got annoyed enough by it to find the code that triggered the sequence. I've never seen this on my systems - is there anything in particular that can be used to reproduce the issue? I'll follow up with the FW team as setting the profile shouldn't (to my knowledge) fail. Agreed it should be handled if it does fail though. > > drivers/platform/x86/thinkpad_acpi.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/thinkpad_acpi.c > b/drivers/platform/x86/thinkpad_acpi.c > index c4895e9bc714..5ecd9d33250d 100644 > --- a/drivers/platform/x86/thinkpad_acpi.c > +++ b/drivers/platform/x86/thinkpad_acpi.c > @@ -10308,6 +10308,7 @@ static int convert_dytc_to_profile(int > funcmode, int dytcmode, > return 0; > default: > /* Unknown function */ > + pr_debug("unknown function 0x%x\n", funcmode); > return -EOPNOTSUPP; > } > return 0; > @@ -10493,8 +10494,8 @@ static void dytc_profile_refresh(void) > return; > > perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF; > - convert_dytc_to_profile(funcmode, perfmode, &profile); > - if (profile != dytc_current_profile) { > + err = convert_dytc_to_profile(funcmode, perfmode, &profile); > + if (!err && profile != dytc_current_profile) { > dytc_current_profile = profile; > platform_profile_notify(); > } > -- > 2.34.1 Looks good to me. Thank you! Reviewed-by Mark Pearson Mark