Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp54559rdh; Wed, 22 Nov 2023 18:04:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+muvR2B2feH04PhRTW7cv5xRnkvfnlhrz7B+TYkSddM1/dFqPnGSAaqwP+G8VI/Iz0sjK X-Received: by 2002:a05:6a21:360e:b0:18b:2710:d729 with SMTP id yg14-20020a056a21360e00b0018b2710d729mr3510289pzb.31.1700705080175; Wed, 22 Nov 2023 18:04:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700705080; cv=none; d=google.com; s=arc-20160816; b=ssBUhJXPb6CmAJs7ySqYz1oStrvCSWwFWRbzJF8e1mhHRCjP8ycfS3aOgMQtRtlN0Q I37b7Gb8KIboysEufam240ZI+YWzqb0pzXUncJHwfJKwNs3SPjnLH84HIiUSY6sGW8PS 6C66GqRMUMnK8gGn8Sn/784pNkAZH8kwACNCfm4FJqtcylBvMIbo1boPUYsdVdcHZ1wd cY1Y47rLmgMYU73xgYBoKF/+tGmg2zEgC8fcni0hJwyaiRUvcaWpecZPzSKt0X7gKSx/ A7clxEkDr9dyxaPDVgm07Khh7JxoUiqHXGSkL3IxdpBNwKFVCTfJsorPdRLQ7/c22b4M 5x9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=vShwBIiU1qk+sBYM8a4RM2atQ1b7lFgMjSeqpTAPbfs=; fh=APqPES4Mqz0g7zNqHQwNTd9rs+e0mpwib4vRPKnk9ns=; b=Oswq1FMcoNTcNprvgC29RTaBkxYSy/z7QXMQFEvk8QepFc1cPBKNbSRnxHrYq1Tn65 tvMDi3IrXIrcbWaf4hpxbM038LSsv0dc0kXrbEAf2OzvI5TMEnCv9rP+wfJPJz1g1bat Ety7/8ayyM+rmNggSL63SqNpHwMMO/7BRV9uMpdD65du5AO+EqSTUo3Bb5azcGAVwlY6 7exKLeV5vExM5YnNHYCGgOVh701k6GzXPUCYmdyp0mht7rK2sDUKhUGIcxLQUWHmB3+8 uE+Hap6yJIlHOZsUkY8qisXi7Z0jwqA37z1OYGJZwB9LD5UZ2I9UouMGE6S2EVAnc1YS KjRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=Rj+fMAEV; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=GLJ8SRTm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id i4-20020a17090ad34400b002748c1bbd79si864880pjx.6.2023.11.22.18.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 18:04:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=Rj+fMAEV; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=GLJ8SRTm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CC436822F052; Wed, 22 Nov 2023 18:04:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234053AbjKWCEW (ORCPT + 99 others); Wed, 22 Nov 2023 21:04:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234702AbjKWCEP (ORCPT ); Wed, 22 Nov 2023 21:04:15 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15C5E1B3; Wed, 22 Nov 2023 18:04:21 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id C7AA43200A2C; Wed, 22 Nov 2023 21:04:18 -0500 (EST) Received: from imap52 ([10.202.2.102]) by compute3.internal (MEProxy); Wed, 22 Nov 2023 21:04:19 -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:sender :subject:subject:to:to; s=fm2; t=1700705058; x=1700791458; bh=vS hwBIiU1qk+sBYM8a4RM2atQ1b7lFgMjSeqpTAPbfs=; b=Rj+fMAEVfv6CXMwB7A B97pLsfITXQlTrUv8malOnHh0W9rP3pq/qZt5XmPoNtJowhPYmL2Uk0OFhQFz6If AUIlY/RX51yw+UHN/zUnuYD050npN6QIFgS2xASRDJH3OiRtRwUayLAR6wmj8lFu vO1kWefD2St5fkuC1vpBYieziwstLPwAWyPC03VgT2Ve8UxM8a4bqNkCiAa335En CyII1UX3M6wsvtHAz7QY4vCuuwu1ckB+pXJaIcM3XwotCssZkX/7xGZ8ya8Xt14i aDn7IPLHECuR5xfYXGebn5awAGshrye/NwaKzg9tyApRf9uyl2OzbFaYg8wi89/W mHpw== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1700705058; x=1700791458; bh=vShwBIiU1qk+s BYM8a4RM2atQ1b7lFgMjSeqpTAPbfs=; b=GLJ8SRTmzD9i2PjqBH7GII1xljvWU hGcZdFbGj0LJ7c3ju+fHxLMVDf2HH8e45VyqSJ24jOsnDtSUH0euX63lSczX6cJc S9Y4kcAdiy+bfAltvsM6bFXOoEn277e5zmCTAIF+vwNDWX87ZiBKpL4PmCeClgZ4 PDJ4d9nu2fVGFFlEeeBagQOXZtVDq3Wkc0QczMpgztNwm5WzY3u+Bc5t2nDCzxbj b+iP0V+yp67xZt1Un6OlitMmyud4LrUvfqlXjecptlGnxZha/PO6nPWS7E9p/Uph yUqj6ZbJuXFJVmCE7XFH4GN2R+Cwo6suF8qTFXi7oOeV1cchCFF4kH32A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehvddggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedfofgr rhhkucfrvggrrhhsohhnfdcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssg drtggrqeenucggtffrrghtthgvrhhnpeeiueefjeeiveetuddvkeetfeeltdevffevudeh ffefjedufedvieejgedugeekhfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 85559C6008B; Wed, 22 Nov 2023 21:04:17 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1234-gac66594aae-fm-20231122.001-gac66594a MIME-Version: 1.0 Message-Id: <7ff45ca3-cf28-4a7c-aedf-3dcb51129a3d@app.fastmail.com> In-Reply-To: <20231122194453.GA497690@gmail.com> References: <20231113165453.6335-1-mpearson-lenovo@squebb.ca> <20231122194453.GA497690@gmail.com> Date: Wed, 22 Nov 2023 21:03:57 -0500 From: "Mark Pearson" To: "Breno Leitao" Cc: "platform-driver-x86@vger.kernel.org" , "Hans de Goede" , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , ibm-acpi-devel@lists.sourceforge.net, "Limonciello, Mario" , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] platform/x86: Add support for improved performance mode Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 18:04:38 -0800 (PST) Hi Breno, Thanks for the review! On Wed, Nov 22, 2023, at 2:44 PM, Breno Leitao wrote: > On Mon, Nov 13, 2023 at 11:54:33AM -0500, Mark Pearson wrote: >> @@ -10355,6 +10361,17 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, >> if (err) >> goto unlock; >> >> + /* Set TMS mode appropriately (enable for performance), if available */ >> + if (dytc_ultraperf_cap) { >> + int cmd; >> + >> + cmd = DYTC_SET_COMMAND(DYTC_FUNCTION_TMS, DYTC_NOMODE, >> + profile == PLATFORM_PROFILE_PERFORMANCE); >> + err = dytc_command(cmd, &output); >> + if (err) >> + return err; > > Aren't you returning holding the 'dytc_mutex' mutex? > > From what I understand, in the first line of this function you get the lock, > and release later, at the exit, so, returning without releasing the lock might > be dangerous. Here is a summary of how I read this function with your change: > > > mutex_lock_interruptible(&dytc_mutex); > ... > err = dytc_command(cmd, &output); > if (err) > return err; > > unlock: > mutex_unlock(&dytc_mutex); > return err; > > > I think "goto unlock" might solve it. Yep - you're right. Good catch. Will fix in the next revision. Thank you Mark