Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6007474pxv; Thu, 29 Jul 2021 04:15:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjEbgWuBbGPhh3HgPJft7pxjCEUaTEJjIGupJebp42DB9/qy7urBRLSkmPcDorDX/kJtHt X-Received: by 2002:a17:906:6855:: with SMTP id a21mr3061297ejs.97.1627557308845; Thu, 29 Jul 2021 04:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627557308; cv=none; d=google.com; s=arc-20160816; b=C66jgtyTqcL+YPmL0wqur6yVBFJBnk01XEVQAYp6CSWAB97QbCk5Pe+KjznZagtmKZ CT2L2180MhQuaPdxjDongtirBgY8ZkXTVMLTSUFEBkdX6n5b0V/77KPLU6rao1LzT5hN GUVAUjHDwLgPIomJ1FMhZKhXqqn7jt3MrvF5wSpjNVFD0uzdbbkTyoYjFclXZyLbpBaO fypAUWkCUcl8tiUNz6PV46hNfkNUy6qVOcswbJFue6l03t9K0JPA8JKi4Nr9xc1xCZHt iSkuuFR8RuhVNG/gpUDQEkIdJpZbrYyXIFfXZeoztraaVg9LiKEsGm7OPJ3Vr5jpO8WF TjrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=lOUMoQBJlC2PCMiLNu33SBSE7t64eq8DXrVqVBCho9I=; b=WRtp98eJORjy3H0ubyoEkzFrefocEZXe7trRgNpGiqzvJqFy6f1a5S8RFpwSmeP+Qw oJYX9VjuiLf0ZxagJ42G8Udz9AMPp/b013uwytuAEGXpFnDCNiro86gc/evrvia2IFbe bxkYLnTl72C2SMYEJH9vyLvnu/9ZGAYGTNO7O5etpX/g7lZIP63pR4FAf13WMCT7lLDn aHMp3qGHV+g2kHfT0uqaUGpDF15sPR+txFN5tP9Wtx8xVCVVgPgiHrI08jkgBRqPPWke uHeaU+Rm4NnzlHw45EhfR/PTq5OPHj3LUB7CLArlDpWVNVSbExWfnqF5mL/m8oLOmQUL tX+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EM3yDiQ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp5si2862989ejc.473.2021.07.29.04.14.45; Thu, 29 Jul 2021 04:15:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EM3yDiQ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236430AbhG2LN0 (ORCPT + 99 others); Thu, 29 Jul 2021 07:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbhG2LNZ (ORCPT ); Thu, 29 Jul 2021 07:13:25 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EBB5C061765 for ; Thu, 29 Jul 2021 04:13:21 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id c18so5541667qke.2 for ; Thu, 29 Jul 2021 04:13:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lOUMoQBJlC2PCMiLNu33SBSE7t64eq8DXrVqVBCho9I=; b=EM3yDiQ0U4Yp+T7AVgTDPkCJyMrodtUCZlGSw85FNQNPdx0HlQ2ZZJ65REaHOELkOd bbJHPh/ager50OlEtMsQsURuyJAP3lDYx+xm2TsSKu2pAUt9DkAnZGyd+mK8WN6ZbrYg jElXUooMNf6QNZrj+ryN/+xyYNOfB7KKVigs97Lo8zqygUBTAHW/4acixFmpIMjqw7yS BLke1ojWecBUl+S3l2WGLjCew78AEPvnWvo3sK2DHcuijirvyPKncVJ0bdCOOeXi2WhN LnaY58RwbKUiImMixKaDg9TRjnXXC7U/2+VeaOMWmbxYCC02pibH2M51odYNI1RcO04F 8Thw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lOUMoQBJlC2PCMiLNu33SBSE7t64eq8DXrVqVBCho9I=; b=HEN3dO/1unyFKv0gJ7DiIbUHKLqExW+6eqGD+RsIE4ktFxQG+TDhCQNhqvLIhP//ed 9AHJRp2BIROUz6Ste+1NBcVGXVfCqFBFXxH6t0QLEGaZVuw9GiyC0g3TSTVIimR22vDn PmkfPpQKq0r4WP/zGM3mPcaD2U+KKXbqp1DVmgsOIVtC4NWiIwTkrk6VG/1vQqEgXDeJ 4yC6ek6oIjemcPIKzbxvsfasAtrqEnciawRmyTkUrzxpHBWaRqh1hfwpp8lTIEpk9MB5 atphfs1cb/pBFIATIFXZYFwjIkp7pBwmKFexIgvOZkmgz0/cPfCtWMNsmciXR+5RCabA 2qoQ== X-Gm-Message-State: AOAM532eJYjNeHiH967kG2hfbQT+L6mAPrWQCFNhXpBWA2ReSjmmHVs4 TtgCUIgKJmYYJObOIqVo8PXdvA== X-Received: by 2002:a05:620a:139c:: with SMTP id k28mr4542836qki.292.1627557200642; Thu, 29 Jul 2021 04:13:20 -0700 (PDT) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id d4sm1096881qty.15.2021.07.29.04.13.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Jul 2021 04:13:20 -0700 (PDT) Subject: Re: [Patch v4 3/6] cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support To: Viresh Kumar Cc: agross@kernel.org, bjorn.andersson@linaro.org, rui.zhang@intel.com, daniel.lezcano@linaro.org, rjw@rjwysocki.net, robh+dt@kernel.org, steev@kali.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20210727152512.1098329-1-thara.gopinath@linaro.org> <20210727152512.1098329-4-thara.gopinath@linaro.org> <20210728035014.25mgvrpnraxfslq7@vireshk-i7> <9a257605-d282-cd06-cc44-5ad5a5f8484d@linaro.org> <20210729061713.kzhka7nymo53zw2o@vireshk-i7> From: Thara Gopinath Message-ID: <4d80594c-9088-5d36-44cd-19a98145095c@linaro.org> Date: Thu, 29 Jul 2021 07:13:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210729061713.kzhka7nymo53zw2o@vireshk-i7> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/29/21 2:17 AM, Viresh Kumar wrote: > On 28-07-21, 18:19, Thara Gopinath wrote: >> Ha! I was too lazy to write this down! So how about I make this a mutex and > > mutex may not work as you come here from irq. Hi! So the interrupt handler is a threaded handler. I moved it in v4 since one of the "_opp" api has an underlying mutex and was causing issues. So using a mutex should be pretty safe in this case. > >> put mod_delayed_work() inside the lock. So it will be something like below >> >> qcom_lmh_dcvs_notify() qcom_cpufreq_hw_lmh_exit() >> >> mutex_lock() mutex_lock() >> if (data->cancel_throttle) { cancel_throttle = true >> mutex_unlock() mutex_unlock() >> return cancel_delayed_work_sync() >> } free_irq() >> enable_irq() / mod_delayed_work() >> mutex_unlock() >> >> I will let you break it! > > I can't any further :) > > Consider merging below to this patch, it fixes sever other minor > issues I see in the code. IIUC, the main change you are suggesting below is to include enable_irq() / mod_delayed_work() under the spin_lock as well. Is that right ? In which case isn't a mutex better than spinlock? > -- Warm Regards Thara (She/Her/Hers)