Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1116402rdb; Mon, 19 Feb 2024 05:01:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXw2ApmVymNfBxdEz4jlSzzsEpZV8Pv5JRdWv1515Nwfgw0Ym4nT5zjE930BxcLYmVKfGTY0SovWV5WPrROi2Ag/DU9qzcTwHQRBVb0aQ== X-Google-Smtp-Source: AGHT+IHOMaw/zulDQ4p40NA0W8MpPehLetUAArr7QAH2gJsuNZDrmBGybp0Zd8PQ32hpwZDRidZ3 X-Received: by 2002:a17:90a:1784:b0:299:3781:4871 with SMTP id q4-20020a17090a178400b0029937814871mr5702545pja.37.1708347700639; Mon, 19 Feb 2024 05:01:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708347700; cv=pass; d=google.com; s=arc-20160816; b=gf0gaUsXoxIBLzyzSeVhFSuXfNwCtpJx8KRAkg4+aSGHv9AA/CSRD8w3+j/2t1kFaj yQ55p7td6krLvw4tvfOWP1ayKGAfbF/O0hBPN9e8716Nnu18r3OpWnIt/h7tf7NxvA/j PfFwSLIb8R2eqo+XwraDobP7w+fncFnMwAyR/CU9Oiay3nmJfCvCjUJc4Q65Tsj6dvfp riouF6nCUWjUXDP0MuOLibQus0/rnSh/GuB7PemQsKfc6Iw7MBadDX+XFcn8pD9OPGss sjfbsQaURSUbgLUWCI/58deUVXbQs0eJefhd8pOxx0vwfCIPZQemDmPFh5dC7dhjLNav 8zpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=nMxKeQCC51WbQZLbi5a685VF0mibFkff8D67rJw7soU=; fh=WG7/5gms4lfivTT8AfdEitlklTaJr/22j4uBFRzsx2Q=; b=j+FG38X6kDN9JDPibcV+Um4XW20SRi6Sq1TgBcG/xtMzS86WOOd6b8wuEH5R/YbcpI EKCol6j9Ed5tRarGyAW1s7El+re62mh0eBOPynmRwcQFd1WHgDYr7awGXifo9cs3SHti +yNfIGWmrGWnzA8bzxFr4hW1eJEpe7npOq5xOoQJRJWKqTiRSni79WcR5SltcLfLRxZy QoQfqw5l2t8gP9qcl8NaerE0mS2OOGkF1QEEveSdoRgDHM8Fbyi0RqDscyy4RofmsvKx LzdA24HgWB/bZO3QT2c3HbljVzMrX2stGN/aQY1R5xOsqM9+Yd8ZyHuGXKtTmW2ryBk4 OTCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UpPC2RyS; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-71359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71359-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 gf13-20020a17090ac7cd00b00290cf479691si4436125pjb.93.2024.02.19.05.01.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 05:01:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71359-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=@redhat.com header.s=mimecast20190719 header.b=UpPC2RyS; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-71359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71359-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 C8CA0281770 for ; Mon, 19 Feb 2024 12:59:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02D91360BC; Mon, 19 Feb 2024 12:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UpPC2RyS" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 A911334CDE for ; Mon, 19 Feb 2024 12:59:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708347589; cv=none; b=C5Y7nTMdpDzxcKVZRsBjPb04H/GRnc13m/9UsoxJL34us8n+zBeIQxPhBSGLvEstMOIMDQ0zC1DSrRNmNUpQku9MIEwHDyLnzwgnLRvjLRdwvdWq5943po9z6MX1B2fq/FBKzsvtcXQBRz7L4ppEcY9BW0Bi7bdFvV361gNeI0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708347589; c=relaxed/simple; bh=3Fi65QIGXfdHgZ04kFVl3weeoPhyvqfKbrI6gyowmVo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sPEFTmp72LMAkkZOrcHEdLT8JdFDbiEMEBfUM5PzgYAt5NAnwKH28KYUzid5zMnuV51a49JgABHxu4tXdORLAYkNzPVFEGtfegHP6QfDSGQx8hZq4nR+3SsUI2e8qmzmbH0z6xNRESMQzI9R/JyQUcHvgtoIzJEhhTy465B1bYo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UpPC2RyS; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708347586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nMxKeQCC51WbQZLbi5a685VF0mibFkff8D67rJw7soU=; b=UpPC2RySwdQtHBpFs58kkNvzz+EDP1k97tfaOaKRyfEQXjd059wC2Elf6xcq4g3uhBZgJP 74YY27x0SE1xcRKnOM1vU6uh/ilPpHh+kAhqYMAjuN7qIui4bEHpgvGZTuesTzrQbGqsDR 52q3/CVoyHUfzUsvm9jNR8ydkhZQEns= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-81-EzM1hemWOQOpSh1QDP-PiA-1; Mon, 19 Feb 2024 07:59:44 -0500 X-MC-Unique: EzM1hemWOQOpSh1QDP-PiA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a3ecd8d3a8dso29595866b.2 for ; Mon, 19 Feb 2024 04:59:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708347583; x=1708952383; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nMxKeQCC51WbQZLbi5a685VF0mibFkff8D67rJw7soU=; b=XEItN3oU9Pu+VgRDqyUlQPpwv0N+75wDaYTd7AAPLdSuERQmq/6uJ21x6h7X77X9he v4d6w7RTDD56xtbtx1G1eMjoQfNNgWjnk8XLRPBi4XQn1ynCMfp4W3kY0ViFaCfK93ud c+h7NlYrmDdoD5fuUITv4xU1xM3BVeQZXmxdjCbNmKmnECXi8l0FHPWDGmt8XNDNq5PG 7MU65ZkGHT+aa123oeiQJzjzFklXVbMSs8j2suKMzzTMQgM2cWFvVbWdKUrU3l9x97X3 qleIIBNy4jsilOIFnK8u/RiTT3asXu4An+R5CMGdDpTYKIAT9Cq8uB/Js+hzcJcIG5FY 78bA== X-Forwarded-Encrypted: i=1; AJvYcCWhPGV+RtzcWgITqecs1mK9Y5svvUgziwP7JxJquMq8iONBxqM1NruJEB6Zegdp/Xe6Wo2Bv2UULey/fcSVtEiv0BqMxiupuxviVZyd X-Gm-Message-State: AOJu0YwoJld9EqgyOLYFbdGXzPqQ6AzdLO9QZWiJFrGBTaMpWHSRssO/ Cy0K+72bqQrLWWrUQaK3z1JbFdnyInZXR5g2takXdPwC2jHFhWBx953Dn06fcGQQGQ/bJ/ufw65 I0yP7ohKWrk5PeBMWDZ4xMlP7OhELmH/qjjazMwmpWhXZxYU51xNfBpek0JDOXg== X-Received: by 2002:a17:906:718d:b0:a3e:7cd8:3db7 with SMTP id h13-20020a170906718d00b00a3e7cd83db7mr2495942ejk.68.1708347583633; Mon, 19 Feb 2024 04:59:43 -0800 (PST) X-Received: by 2002:a17:906:718d:b0:a3e:7cd8:3db7 with SMTP id h13-20020a170906718d00b00a3e7cd83db7mr2495929ejk.68.1708347583325; Mon, 19 Feb 2024 04:59:43 -0800 (PST) Received: from [10.40.98.142] ([78.108.130.194]) by smtp.gmail.com with ESMTPSA id a19-20020a1709064a5300b00a3e2b0799e0sm2404226ejv.4.2024.02.19.04.59.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Feb 2024 04:59:43 -0800 (PST) Message-ID: Date: Mon, 19 Feb 2024 13:59:42 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] platform/x86: thinkpad_acpi: Only update profile if successfully converted Content-Language: en-US To: Mario Limonciello , Mark Pearson Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240217022311.113879-1-mario.limonciello@amd.com> From: Hans de Goede In-Reply-To: <20240217022311.113879-1-mario.limonciello@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, On 2/17/24 03:23, 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 Thank you for your patch, I've applied this patch to my review-hans branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while. I will include this patch in my next fixes pull-req to Linus for the current kernel development cycle. Regards, Hans > --- > 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. > > 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(); > }