X86 platform drivers
 help / color / mirror / Atom feed
From: "Mark Pearson" <mpearson-lenovo@squebb.ca>
To: "Breno Leitao" <leitao@debian.org>
Cc: "platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	ibm-acpi-devel@lists.sourceforge.net, "Limonciello,
	Mario" <mario.limonciello@amd.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] platform/x86: Add support for improved performance mode
Date: Wed, 22 Nov 2023 21:03:57 -0500	[thread overview]
Message-ID: <7ff45ca3-cf28-4a7c-aedf-3dcb51129a3d@app.fastmail.com> (raw)
In-Reply-To: <20231122194453.GA497690@gmail.com>

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


      reply	other threads:[~2023-11-23  2:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13 16:54 [PATCH v3] platform/x86: Add support for improved performance mode Mark Pearson
2023-11-13 16:59 ` Ilpo Järvinen
2023-11-13 17:15   ` Mark Pearson
2023-11-13 17:18     ` Mario Limonciello
2023-11-22 18:06     ` Mark Pearson
2023-11-22 19:44 ` Breno Leitao
2023-11-23  2:03   ` Mark Pearson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ff45ca3-cf28-4a7c-aedf-3dcb51129a3d@app.fastmail.com \
    --to=mpearson-lenovo@squebb.ca \
    --cc=hdegoede@redhat.com \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox