mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ed Tsai (蔡宗軒)" <Ed.Tsai@mediatek.com>
To: "kbusch@kernel.org" <kbusch@kernel.org>,
	"Powen Kao (高伯文)" <Powen.Kao@mediatek.com>
Cc: "Peter Wang (王信友)" <peter.wang@mediatek.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"CC Chou (周志杰)" <cc.chou@mediatek.com>,
	"Eddie Huang (黃智傑)" <eddie.huang@mediatek.com>,
	"Alice Chao (趙珮均)" <Alice.Chao@mediatek.com>,
	"sagi@grimberg.me" <sagi@grimberg.me>,
	wsd_upstream <wsd_upstream@mediatek.com>,
	"hch@lst.de" <hch@lst.de>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"Chun-Hung Wu (巫駿宏)" <Chun-hung.Wu@mediatek.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"Naomi Chu (朱詠田)" <Naomi.Chu@mediatek.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Stanley Chu (朱原陞)" <stanley.chu@mediatek.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>
Subject: Re: [PATCH v1 1/1] nvme: complete directly for hctx with only one ctx mapping
Date: Wed, 31 May 2023 01:14:33 +0000	[thread overview]
Message-ID: <67c4bc7b462565bb33ff97736e0d24bb432831c5.camel@mediatek.com> (raw)
In-Reply-To: <ZHY2TUrKVBj2xGE2@kbusch-mbp.dhcp.thefacebook.com>

On Tue, 2023-05-30 at 11:45 -0600, Keith Busch wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On Tue, May 30, 2023 at 10:41:19AM +0800, Po-Wen Kao wrote:
> > ---
> >  block/blk-mq.c           | 8 +++-----
> >  drivers/nvme/host/nvme.h | 4 ++++
> >  2 files changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > index 1749f5890606..b60c78f5ad46 100644
> > --- a/block/blk-mq.c
> > +++ b/block/blk-mq.c
> > @@ -1181,12 +1181,10 @@ bool blk_mq_complete_request_remote(struct
> request *rq)
> >  WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
> >  
> >  /*
> > - * For request which hctx has only one ctx mapping,
> > - * or a polled request, always complete locally,
> > - * it's pointless to redirect the completion.
> > + * For a polled request, always complete locally, it's pointless
> > + * to redirect the completion.
> >   */
> > -if (rq->mq_hctx->nr_ctx == 1 ||
> > -rq->cmd_flags & REQ_POLLED)
> > +if (rq->cmd_flags & REQ_POLLED)
> >  return false;
> >  
> >  if (blk_mq_complete_need_ipi(rq)) {
> > diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> > index 7cf8e44d135e..acc9b1ce071d 100644
> > --- a/drivers/nvme/host/nvme.h
> > +++ b/drivers/nvme/host/nvme.h
> > @@ -702,6 +702,10 @@ static inline bool
> nvme_try_complete_req(struct request *req, __le16 status,
> >  nvme_should_fail(req);
> >  if (unlikely(blk_should_fake_timeout(req->q)))
> >  return true;
> > +if (likely(req->mq_hctx->nr_ctx == 1)) {
> > +WRITE_ONCE(req->state, MQ_RQ_COMPLETE);
> > +return false;
> > +}
> 
> I don't think we want low level drivers directly messing with blk-mq
> request state.
> 
> Is the early nr_ctx check optimisation really worth it? Would the
> following work for your use case?

Ref to original discussion:

https://lore.kernel.org/lkml/1663432858-99743-1-git-send-email-liusong@linux.alibaba.com/

Seems it is what nvme hopes to optimize, so I put it back to nvme.
Otherwise, we can just remove the nr_ctx check from block, because the
submission and completion queues can be asymmetric in low level driver.

  reply	other threads:[~2023-05-31  1:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30  2:41 Po-Wen Kao
2023-05-30  2:49 ` Stanley Chu
2023-05-30 17:45 ` Keith Busch
2023-05-31  1:14   ` Ed Tsai (蔡宗軒) [this message]
2023-05-31  1:32   ` Ed Tsai (蔡宗軒)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67c4bc7b462565bb33ff97736e0d24bb432831c5.camel@mediatek.com \
    --to=ed.tsai@mediatek.com \
    --cc=Alice.Chao@mediatek.com \
    --cc=Chun-hung.Wu@mediatek.com \
    --cc=Naomi.Chu@mediatek.com \
    --cc=Powen.Kao@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=cc.chou@mediatek.com \
    --cc=eddie.huang@mediatek.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=peter.wang@mediatek.com \
    --cc=sagi@grimberg.me \
    --cc=stanley.chu@mediatek.com \
    --cc=wsd_upstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®