All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Jinhao Fan <fanjinhao21s@ict.ac.cn>
Cc: qemu-devel@nongnu.org, its@irrelevant.dk
Subject: Re: [PATCH] hw/nvme: Use ioeventfd to handle doorbell updates
Date: Wed, 29 Jun 2022 09:58:17 -0600	[thread overview]
Message-ID: <Yrx2mVPEO1MIiU4W@kbusch-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <8F470FDC-3213-4284-8A85-487ACE690FB7@ict.ac.cn>

On Wed, Jun 29, 2022 at 05:04:25PM +0800, Jinhao Fan wrote:
> Ping~
> 
> > @@ -4271,6 +4343,11 @@ static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,
> >     if (n->dbbuf_enabled) {
> >         sq->db_addr = n->dbbuf_dbs + (sqid << 3);
> >         sq->ei_addr = n->dbbuf_eis + (sqid << 3);
> > +            
> > +        if (n->params.ioeventfd && sq->sqid != 0) {
> > +            ret = nvme_init_sq_ioeventfd(sq);
> > +            sq->ioeventfd_enabled = ret == 0;
> > +        }
> >     }
> > 
> >     assert(n->cq[cqid]);
> 
> Is this “ret == 0” a correct way for error handling?

That looks correct since we don't need the ioevent is an optional optimization.

I would just suggest making this easier to read. For example, in
nvme_init_sq_ioeventfd(), instead of assigning within a conditional:

    if ((ret = event_notifier_init(&cq->notifier, 0))) {

Do each part separately:

    ret = event_notifier_init(&cq->notifier, 0);
    if (ret) {
 
> I’ve also been wondering whether using irqfd for sending interrupts can
> bring some benefits. I’m not familiar with how QEMU emulates interrupts.
> What do you think of irqfd’s?

Not sure about this mechanism, I'll need to look into it.


  reply	other threads:[~2022-06-29 15:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 10:48 [PATCH] hw/nvme: Use ioeventfd to handle doorbell updates Jinhao Fan
2022-06-29  9:04 ` Jinhao Fan
2022-06-29 15:58   ` Keith Busch [this message]
2022-06-30  2:04     ` Jinhao Fan
2022-06-29 20:13 ` Klaus Jensen
2022-06-30  3:06   ` Jinhao Fan

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=Yrx2mVPEO1MIiU4W@kbusch-mbp.dhcp.thefacebook.com \
    --to=kbusch@kernel.org \
    --cc=fanjinhao21s@ict.ac.cn \
    --cc=its@irrelevant.dk \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.