Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1281943pxx; Fri, 30 Oct 2020 06:37:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZBkqmGWK2ieK4S6BXLp5PTzRj3GW+UHQ8Fpo4CeH19TjlDom2JkWeJi08rOgZEfik2SRx X-Received: by 2002:a17:906:aec1:: with SMTP id me1mr2593710ejb.225.1604065058952; Fri, 30 Oct 2020 06:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604065058; cv=none; d=google.com; s=arc-20160816; b=zAgMvgaLMSolQtBH3BnjruqpMctJlGXEERf6IlfnZZk48GCnsNPiC5vbJj2oRxv4Km p/LW6S1dh91Tro1rA/7tRWfKF1RUKB0En6BZ/Abq4gP5i2mPVWdcGlp3skF9hSJMkbRq g2045Nj7ae8aMNPelEIh6bsMSryIuZeigOeIyNAJeWmqYAcpvU3ZCR5j451lKyZRnzFB aNLx4AZHW/oa40EwAXPoDpG6T7wCndNp+/V2qVMMuekeWiZrYM2EwNUekUfxJP+EKD4S yPL2YuWDkS5m9SjKIKqe/fJn8t97TqiQ2iXMkZ6rO9dqxg789rGhlx6ogekdR2bgGw/y Mjrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=0xsC2u3VBe/xFD2Ko4VRHk+WyMUCitBIG419P9pQMzI=; b=ib7Pm3Y9GDd6v2k1Li1TDuvlT+NI5Xzcog44H4J5s7Df9q1nn89z+mmFQM1R9GCsPY pDKq/5PwY4V7L/GSJuEZP5rX1cXVSBlSyi38gXSkPjQEqmaEv+WuCBfqHFRhihL9DFcd bh864wEXMHI9XBR8KR80KUVG2gSJhxZfIn5Unz4zXTg46xXMTQsEjCZGO8xsl6qD6Zze 5Tssmo3G9DH/39Nwe6SyjE12yxBFn/9/BD6cogbzUl0f6VqzbXCkrJck1k8aW5NBA9n9 WFxg/F0Q7gCNLIb1toq+OyCJTfeSYFY5CW/XsMdOVCPFlshSzn78WM22V2UzJCUk+nOY 4uSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ObyIPxRD; 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 n12si1412020eje.452.2020.10.30.06.37.15; Fri, 30 Oct 2020 06:37:38 -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=ObyIPxRD; 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 S1726601AbgJ3Nfo (ORCPT + 99 others); Fri, 30 Oct 2020 09:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgJ3Nfn (ORCPT ); Fri, 30 Oct 2020 09:35:43 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72C5EC0613D4 for ; Fri, 30 Oct 2020 06:35:43 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id t22so2938612plr.9 for ; Fri, 30 Oct 2020 06:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0xsC2u3VBe/xFD2Ko4VRHk+WyMUCitBIG419P9pQMzI=; b=ObyIPxRDRhvsSjXM8pz8yphyT7mluNa36YVmthE0VS+gljtXpZXqKVQ8xI4R9RTCN+ Hn4klegQI1mXDClorCPv6wSzdOqEfEpAvRSCKjsz2x325CYWIykCaX9RX5HjKBzhcMhQ /6sm8A/mwXYOy4ZK9T/wHbTBASKNnNa6Ti5i5naL9wsBt6nzVAMm2yX5tV+bz8GaDgnM j4qyxjC9i7eauFkvKfJksRbSHGe9t0F6JMuqkopVUlJq8aAMrMF/Bw3m3qatb13zDIDo b+tol0zv4byQEcSNOidpUxDQT6jEdmkbgZdbamuGxqJj823JcHVYnor1+etkWyrzh6EC 2RlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0xsC2u3VBe/xFD2Ko4VRHk+WyMUCitBIG419P9pQMzI=; b=fXNaRFWZSmPB4yomrBRb2+CJQEdWTnbytR470DGT+A/igHGUWzjwJ8WkoRMT1NPfzg hTRl3K1pbI8KOFcbshsSg6NtKiW5uUunaiBYHhOaX3lpVZ0pyHhqAFx90ZZdsmGNojbD cycAxHvlTRfVe8pRJIDbEPMYzK9UQnwvOxv3TONs2tgxCV99a1d7GoNMu1ak+TOjdIip P6DELfH+CSmClP1m50Pc/oofJgG2JsIo0JwWl14jKmyHY5DWFnaVUXOzcqKKVR62B6Eh UQUF9gmIh8mvG2sGQTNsBNo6+4CMSvGNVD4jb542NxOV/aPNjeNx49GKkmAKs2QEia+O h2Sg== X-Gm-Message-State: AOAM532JVRSLtxR4eASaq9wIubu64n7zqDwfrWcwNv3dd0SpOu/WtV+u STQ+KMW9b5fmKoUd28s2xViF X-Received: by 2002:a17:902:db82:b029:d6:3fe4:9825 with SMTP id m2-20020a170902db82b02900d63fe49825mr8849882pld.29.1604064942827; Fri, 30 Oct 2020 06:35:42 -0700 (PDT) Received: from Mani-XPS-13-9360 ([2409:4072:918:28fe:10d5:aaf5:e319:ec72]) by smtp.gmail.com with ESMTPSA id z30sm6239197pfq.87.2020.10.30.06.35.37 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Oct 2020 06:35:42 -0700 (PDT) Date: Fri, 30 Oct 2020 19:05:34 +0530 From: Manivannan Sadhasivam To: Bhaumik Bhatt Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 02/12] bus: mhi: core: Move to using high priority workqueue Message-ID: <20201030133534.GF3818@Mani-XPS-13-9360> References: <1604031057-32820-1-git-send-email-bbhatt@codeaurora.org> <1604031057-32820-3-git-send-email-bbhatt@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1604031057-32820-3-git-send-email-bbhatt@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 09:10:47PM -0700, Bhaumik Bhatt wrote: > MHI work is currently scheduled on the global/system workqueue and can > encounter delays on a stressed system. To avoid those unforeseen > delays which can hamper bootup or shutdown times, use a dedicated high > priority workqueue instead of the global/system workqueue. > > Signed-off-by: Bhaumik Bhatt You are not destroying the workqueue in mhi_unregister_controller(). With that fixed, Reviewed-by: Manivannan Sadhasivam Thanks, Mani > --- > drivers/bus/mhi/core/init.c | 8 ++++++++ > drivers/bus/mhi/core/pm.c | 2 +- > include/linux/mhi.h | 2 ++ > 3 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c > index 0ffdebd..23b6dd6 100644 > --- a/drivers/bus/mhi/core/init.c > +++ b/drivers/bus/mhi/core/init.c > @@ -880,6 +880,13 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, > INIT_WORK(&mhi_cntrl->st_worker, mhi_pm_st_worker); > init_waitqueue_head(&mhi_cntrl->state_event); > > + mhi_cntrl->hiprio_wq = alloc_ordered_workqueue > + ("mhi_hiprio_wq", WQ_MEM_RECLAIM | WQ_HIGHPRI); > + if (!mhi_cntrl->hiprio_wq) { > + dev_err(mhi_cntrl->cntrl_dev, "Failed to allocate workqueue\n"); > + goto error_alloc_cmd; > + } > + > mhi_cmd = mhi_cntrl->mhi_cmd; > for (i = 0; i < NR_OF_CMD_RINGS; i++, mhi_cmd++) > spin_lock_init(&mhi_cmd->lock); > @@ -969,6 +976,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, > error_alloc_cmd: > vfree(mhi_cntrl->mhi_chan); > kfree(mhi_cntrl->mhi_event); > + destroy_workqueue(mhi_cntrl->hiprio_wq); > > return ret; > } > diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c > index 3de7b16..805b6fa74 100644 > --- a/drivers/bus/mhi/core/pm.c > +++ b/drivers/bus/mhi/core/pm.c > @@ -597,7 +597,7 @@ int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl, > list_add_tail(&item->node, &mhi_cntrl->transition_list); > spin_unlock_irqrestore(&mhi_cntrl->transition_lock, flags); > > - schedule_work(&mhi_cntrl->st_worker); > + queue_work(mhi_cntrl->hiprio_wq, &mhi_cntrl->st_worker); > > return 0; > } > diff --git a/include/linux/mhi.h b/include/linux/mhi.h > index d4841e5..8961cbc 100644 > --- a/include/linux/mhi.h > +++ b/include/linux/mhi.h > @@ -337,6 +337,7 @@ struct mhi_controller_config { > * @wlock: Lock for protecting device wakeup > * @mhi_link_info: Device bandwidth info > * @st_worker: State transition worker > + * @hiprio_wq: High priority workqueue for MHI work such as state transitions > * @state_event: State change event > * @status_cb: CB function to notify power states of the device (required) > * @wake_get: CB function to assert device wake (optional) > @@ -419,6 +420,7 @@ struct mhi_controller { > spinlock_t wlock; > struct mhi_link_info mhi_link_info; > struct work_struct st_worker; > + struct workqueue_struct *hiprio_wq; > wait_queue_head_t state_event; > > void (*status_cb)(struct mhi_controller *mhi_cntrl, > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >