Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2138016pxu; Fri, 9 Oct 2020 08:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEPgfKRE8n23WFhEC65xx7tAzNbp0M1B+lYSe5RZaqFuta+5xGtyzLpk2MzDYJ9Z7vhUHt X-Received: by 2002:aa7:c915:: with SMTP id b21mr15270050edt.25.1602258729963; Fri, 09 Oct 2020 08:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602258729; cv=none; d=google.com; s=arc-20160816; b=rYsZ+wQLOUDHu+c1+LEIjOyFVx7hB/7yBXYVAJGBMeD1+NK02pOXRX5TqXN2aXSlbh 8SxbW//Z4FooIn1Qrb9fVwN886F3ZiWHsU5W87JFHXG0dkh6qkOzjuP3CjA4d4SRzGuJ 8XR+2vD6ZGXegKqtp2xlP6+rYmam/EK9JzXC/txTUhQlVHLok3ZLfquzkq+A/FxfpDHd NuK/bFDTgkXo3SGMC5drAXt+PFgTZXd6o97AykA4cxwLXu6I9krg/UgrkoU73FStCxka uSwiMUkVTftKiEQpM6hQL3uDfzJIABvmytkEVgvl/s/8FlPJjwcFbakWVWgROW2sRVNU rVfQ== 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=h1HEHBOion93MLuzoQuc94mGi98U7sgqTmm3qL/oASo=; b=JlwjcBNCKxuHIZKRwNQuzwK2+QFjfdfInpbXumvMWgnByKerFVv5OBoC7LDLQzJ9cd /wGAYhNamxxCM/L7tqMeWn8V5bExC52AUDojxvdTpYZZiPkyonmMoKhd5VxhsaS8nUl+ De/fnKojJRSYyLYEE/phx4ithtwNXv0c0vTvyte53Z4bSXAlh5/YwlLWc1DMzHTHxh3t X94r8deAgaDA/vaJTkW7xjpDEoP8Lcpz/ojv5zAMZCSRZjviMMArz2wq5UPEaGXFQelf q2RQpzfd9RWfCkwYkxwKbsWOFKI/OI6XHR4bz4GakBgy6uaQkqiJncbUQ/xod2FwBaVy DiAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CUqOzKTU; 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 p10si6161825edq.458.2020.10.09.08.51.44; Fri, 09 Oct 2020 08:52:09 -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=CUqOzKTU; 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 S2389417AbgJIPtL (ORCPT + 99 others); Fri, 9 Oct 2020 11:49:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388745AbgJIPtK (ORCPT ); Fri, 9 Oct 2020 11:49:10 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B58C4C0613D2 for ; Fri, 9 Oct 2020 08:49:09 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id g29so7513020pgl.2 for ; Fri, 09 Oct 2020 08:49:09 -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=h1HEHBOion93MLuzoQuc94mGi98U7sgqTmm3qL/oASo=; b=CUqOzKTUgZsduo47Nq6rZCIV7/fJXfEyh3NmSl07zo2XBRvYtDRrydUi0XObgLoQVZ m/1Xf6X6vVlpZ/TdHlCcNGBfTesExjRmycqh3+PJUtWRR/YBGhjhrfgZhnc0YpcMJ2xG CQlbmGQ1SW1eZLZC25P0Z2HKSgTIfCNFcuIIxZEucTHza+PxpnTMrTlUyzC8NX808NAm tJubWQw4aJ4s2TBT0JvmtF3cYhAIUWc4UC0j7iBDrO+y4jynVquPdpD6LYOMxIN+MOVo 23Tb2gUn+dBYqswqfyUjy8F/OkiT5maogQmKi+RLDs8fmbWjXs8pGrddYhqh7SNU3lVB DL8Q== 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=h1HEHBOion93MLuzoQuc94mGi98U7sgqTmm3qL/oASo=; b=TwuBeyZJm3IerG4tpNXB9hhI8xOl6FL37L5MHVqrQjh4A8JoGaRZ3CAn4yOWgPV96H 2UxAQT/suxkTmIqnPwFN0WHJyAHvm7OFL1emuph6k2ue8kCTr3JtOhJJ1T1qWySZEyUK bHBEnefKz4Wi8BWcEU7CoVBhgcmYmqV8DwTnAIubTfoLysXYFDzWnmFcARx5azf+5/m/ VE1qF/QLpWTwrcnWXkBkctwtv+EY7FgyTbTZ9HN5osBpXo6NH1udUTe5eIIMcNyAcCxF T47LfpmpgrqTn3X/gtvG0P+Hp0UqsGRr9/3BGEixw8+Fyz8THCsAruGMUFVw/1ZLDDoK XmmA== X-Gm-Message-State: AOAM533RSje4cWVxBCixcrhzlOnkbsWe7NlfbRUZZl2L7PGq4axMzdFO XYtAiSWK3QKB/8T2MmdKgAAy X-Received: by 2002:a63:f84f:: with SMTP id v15mr3827674pgj.180.1602258549020; Fri, 09 Oct 2020 08:49:09 -0700 (PDT) Received: from Mani-XPS-13-9360 ([2409:4072:6292:5a21:d5ff:f3e8:fcf2:ccc7]) by smtp.gmail.com with ESMTPSA id y5sm12547501pge.62.2020.10.09.08.49.05 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Oct 2020 08:49:08 -0700 (PDT) Date: Fri, 9 Oct 2020 21:19:02 +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 v1 02/10] bus: mhi: core: Move to using high priority workqueue Message-ID: <20201009154902.GC4810@Mani-XPS-13-9360> References: <1600480955-16827-1-git-send-email-bbhatt@codeaurora.org> <1600480955-16827-3-git-send-email-bbhatt@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1600480955-16827-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 Fri, Sep 18, 2020 at 07:02:27PM -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 > --- > drivers/bus/mhi/core/init.c | 7 +++++++ > drivers/bus/mhi/core/pm.c | 2 +- > include/linux/mhi.h | 2 ++ > 3 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c > index 1b4161e..ca32563 100644 > --- a/drivers/bus/mhi/core/init.c > +++ b/drivers/bus/mhi/core/init.c > @@ -890,6 +890,11 @@ 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) Printing an error here would be helpful. > + 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); > @@ -977,10 +982,12 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, > > error_alloc_dev: > kfree(mhi_cntrl->mhi_cmd); > + destroy_workqueue(mhi_cntrl->hiprio_wq); So you're destroying the queue two times? You don't need it here. > > 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 ce4d969..9d4789d 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 fb45a0f..7677676 100644 > --- a/include/linux/mhi.h > +++ b/include/linux/mhi.h > @@ -338,6 +338,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 what? Please state the purpose. Thanks, Mani > * @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) > @@ -421,6 +422,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 >