Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp149676rdd; Wed, 22 Nov 2023 11:46:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqAlyjuqjo1GqVX7kM74ivrh3aQFwY6G9zYBnvE52H149EKoi4r3NcVaDt3liKldpeIr7o X-Received: by 2002:a05:6830:22f7:b0:6d3:1272:34b8 with SMTP id t23-20020a05683022f700b006d3127234b8mr3622627otc.31.1700682375335; Wed, 22 Nov 2023 11:46:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700682375; cv=none; d=google.com; s=arc-20160816; b=n/C5yrX5t+67JE2AIvb1fdoBZtT7KYUh3EhRup/9zh+eThUAVP8KZ1l1gLu+FFhKdo +U6rSLWFEb5iWyEsW1EFj8pVrhq2NVXq1Q/5mVb77fbG1MFDo9e/cQ5eSbYkRoMXN/oS mGxOGeXYvScBU7YSpP0+9kJtWO44pbbO8wMATR0Yi24sX+ZdTVSK2odpzXKi3ueoa2WM GvzTvIAd5JeUdNovTDCwWvgED0jFcECNf+tPfWlV+sOPArD1tRkvqy7GvkQL91YhvNKo whVnY/tBDj3O/oe+07lJCSMtzAYslvI75sNKk7yqsMgKSkb9QMee+CMv6/YaAzxR52RQ dLzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=khlJpqJuft4n03C9Ho0HlV0suFMRaRR1X49QgmayVfk=; fh=3SevyrSlMCfDCoTYltSBmW8/OBekykamX5fAbSaZ9ak=; b=cv1SDrWVdReGCoL5cQpzoDdPZLyfyHZak+HiKSFwDWUrBrptsKHBYVNvt0Pvfc0DBx UR8P7gl9PgVKIpHHf12IKKVvdh3P1eDO568bi4VNwH1FbyKfS/r99Lis9faC7LLM7vtr ckjcy+VOSkme6nBp8n1hefj5yYrOZOM26HOzAF+hfA2+wu4NmnRpHBokVx7/tcMGULQY Fq6QLw0Kn44fHfBWC+Gk1iMaTexDATg41mnLtPZ4/Oxp5gjDiU3rls6KmDwBJnpnHI8B mqZuK+y0S7bX8scVxVm2MacbObJN7IjtGRETRqhVEVQHsVHPCCZmSAZ/O8BlBNRDp81B gkzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id x5-20020a631705000000b005b86142ee56si111323pgl.277.2023.11.22.11.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 11:46:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 1F2FC8074407; Wed, 22 Nov 2023 11:45:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231459AbjKVTo7 (ORCPT + 99 others); Wed, 22 Nov 2023 14:44:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbjKVTo6 (ORCPT ); Wed, 22 Nov 2023 14:44:58 -0500 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4DAF12A; Wed, 22 Nov 2023 11:44:54 -0800 (PST) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2c5071165d5so2127161fa.0; Wed, 22 Nov 2023 11:44:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700682293; x=1701287093; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=khlJpqJuft4n03C9Ho0HlV0suFMRaRR1X49QgmayVfk=; b=gziyusxaJDPfsF8+YY8x1HP8OhHTGzpeBbYyDAqUgsZMfVTgI75UfqiZs6hWs9qP5D EVNbMcIQmzj/bTbZfboK6iDA0AZHE5BEA250QfyAnltHAqmAvxMAFd8YALgsEp4x/Uks YX5SPDck8XFMkKovO8z7iBYTJlm7fUF6xr+e1XaX1CitXMZdhqBnBI9IzrGOA3niwxOf fDMVwrX/s+6U7uBoiWO/JxfZDK1r2L2Gl09FLI/MnQ7zx0e3urqkDuvOso3S/wKyIrDo mqMxlkV6MPN8t/4Q3Dr4qFPHvT8iHNYuFLuiULZwaSeDZoFKZsquFP/j/SxecCShHGnx TtGA== X-Gm-Message-State: AOJu0Ywnpe5W8X8thj255BCKn9zCjW36UMznBj+qcPwqqcCJoAu8FZYu /M6Tk4RnVj0JJzFj0yYQPwc= X-Received: by 2002:a05:651c:1047:b0:2c8:8813:2e7b with SMTP id x7-20020a05651c104700b002c888132e7bmr2380549ljm.2.1700682292637; Wed, 22 Nov 2023 11:44:52 -0800 (PST) Received: from gmail.com ([2a02:c7c:5b4b:e600:751f:437c:bb5f:eda2]) by smtp.gmail.com with ESMTPSA id e17-20020a05600c4e5100b004077219aed5sm436545wmq.6.2023.11.22.11.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 11:44:52 -0800 (PST) Date: Wed, 22 Nov 2023 11:44:53 -0800 From: Breno Leitao To: Mark Pearson 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 Message-ID: <20231122194453.GA497690@gmail.com> References: <20231113165453.6335-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231113165453.6335-1-mpearson-lenovo@squebb.ca> X-Spam-Status: No, score=0.6 required=5.0 tests=FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Wed, 22 Nov 2023 11:45:15 -0800 (PST) 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.