public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Mark Pearson <mpearson-lenovo@squebb.ca>
Cc: platform-driver-x86@vger.kernel.org, hdegoede@redhat.com,
	ilpo.jarvinen@linux.intel.com,
	ibm-acpi-devel@lists.sourceforge.net, 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 11:44:53 -0800	[thread overview]
Message-ID: <20231122194453.GA497690@gmail.com> (raw)
In-Reply-To: <20231113165453.6335-1-mpearson-lenovo@squebb.ca>

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.

  parent reply	other threads:[~2023-11-22 19:44 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 [this message]
2023-11-23  2:03   ` Mark Pearson

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=20231122194453.GA497690@gmail.com \
    --to=leitao@debian.org \
    --cc=hdegoede@redhat.com \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mpearson-lenovo@squebb.ca \
    --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