All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Levitsky <mlevitsk@redhat.com>
To: John Snow <jsnow@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>,
	 qemu-block@nongnu.org
Cc: Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/5] block/nvme: don't flip CQ phase bits
Date: Tue, 11 Jun 2019 11:50:21 +0300	[thread overview]
Message-ID: <70eecc1c95485798c6fe1dfdbd1d091254de885b.camel@redhat.com> (raw)
In-Reply-To: <449e8bb0-8936-bcdc-9142-c2730ac24f4e@redhat.com>

On Fri, 2019-06-07 at 15:28 -0400, John Snow wrote:
> 
> On 6/7/19 7:08 AM, Paolo Bonzini wrote:
> > On 06/06/19 23:23, John Snow wrote:
> > > So: This looks right; does this fix a bug that can be observed? Do we
> > > have any regression tests for block/NVMe?
> > 
> > I don't think it fixes a bug; by the time the CQ entry is picked up by
> > QEMU, the device is not supposed to touch it anymore.
> > 
> > However, the idea behind the phase bits is that you can decide whether
> > the driver has placed a completion in the queue.  When we get here, we have
> > 
> > 	le16_to_cpu(c->status) & 0x1) == !q->cq_phase
> > 
> > On the next pass through the ring buffer q->cq_phase will be flipped,
> > and thus when we see this element we'll get
> > 
> > 	le16_to_cpu(c->status) & 0x1) == q->cq_phase
> > 
> > and not process it.  Since block/nvme.c flips the bit, this mechanism
> > does not work and the loop termination relies on the other part of the
> > condition, "if (!c->cid) break;".
> > 
> > So the patch is correct, but it would also be nice to also either remove
> > phase handling altogether, or check that the phase handling works
> > properly and drop the !c->cid test.
> > 
> > Paolo


I agree with that and I'll send an updated patch soon.

The driver should not touch the completion entries at all, but rather just scan for the entries whose
phase bit was flipped by the hardware.

in fact I don't even think that the 'c->cid' became the exit condition, but rather since the device is not allowed 
to fully fill the compleiton queue (it must alway keep at least one free entry there), the end condition would still
be the check on the flipped phase bit.


I'll fix that to be up to the spec,

Best regards,
	Maxim Levitskky



  reply	other threads:[~2019-06-11  8:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 19:53 [Qemu-devel] [PATCH v2 0/5] Few fixes for userspace NVME driver Maxim Levitsky
2019-04-17 19:53 ` Maxim Levitsky
2019-04-17 19:53 ` [Qemu-devel] [PATCH v2 1/5] block/nvme: don't flip CQ phase bits Maxim Levitsky
2019-04-17 19:53   ` Maxim Levitsky
2019-06-03 22:25   ` [Qemu-devel] [Qemu-block] " John Snow
2019-06-05  7:47     ` Maxim Levitsky
2019-06-06 21:23       ` John Snow
2019-06-07 11:08         ` Paolo Bonzini
2019-06-07 19:28           ` John Snow
2019-06-11  8:50             ` Maxim Levitsky [this message]
2019-04-17 19:53 ` [Qemu-devel] [PATCH v2 2/5] block/nvme: fix doorbell stride Maxim Levitsky
2019-04-17 19:53   ` Maxim Levitsky
2019-04-17 19:53 ` [Qemu-devel] [PATCH v2 3/5] block/nvme: support larger that 512 bytes sector devices Maxim Levitsky
2019-04-17 19:53   ` Maxim Levitsky
2019-04-17 19:53 ` [Qemu-devel] [PATCH v2 4/5] block/nvme: add support for write zeros Maxim Levitsky
2019-04-17 19:53   ` Maxim Levitsky
2019-06-06  2:56   ` Fam Zheng
2019-04-17 19:53 ` [Qemu-devel] [PATCH v2 5/5] block/nvme: add support for discard Maxim Levitsky
2019-04-17 19:53   ` Maxim Levitsky
2019-06-06  3:19   ` Fam Zheng
2019-06-06  7:31     ` Maxim Levitsky
2019-06-03 12:26 ` [Qemu-devel] [PATCH v2 0/5] Few fixes for userspace NVME driver Maxim Levitsky

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=70eecc1c95485798c6fe1dfdbd1d091254de885b.camel@redhat.com \
    --to=mlevitsk@redhat.com \
    --cc=fam@euphon.net \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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.