lkml.org 
[lkml]   [2023]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] platform/x86: Add support for improved performance mode
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.

\
 
 \ /
  Last update: 2023-11-22 20:45    [W:0.082 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site