Content-Type: multipart/mixed; boundary="===============7628453042148911725==" MIME-Version: 1.0 From: zbhhbz Subject: [SPDK] Re: The difference between vhost-nvme and vhost-blk Date: Tue, 08 Mar 2022 17:54:14 +0000 Message-ID: <6a951d53.44791.17f6aaab7c5.Coremail.zbhhbz@yeah.net> In-Reply-To: BYAPR11MB28241A1D7D8295837494DDEEEF099@BYAPR11MB2824.namprd11.prod.outlook.com List-ID: To: spdk@lists.01.org --===============7628453042148911725== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable thank you very much, i understand now ---- =E5=9B=9E=E5=A4=8D=E7=9A=84=E5=8E=9F=E9=82=AE=E4=BB=B6 ---- | =E5=8F=91=E4=BB=B6=E4=BA=BA | Walker, Benjamin | | =E6=97=A5=E6=9C=9F | 2022=E5=B9=B403=E6=9C=8809=E6=97=A5 00:45 | | =E6=94=B6=E4=BB=B6=E4=BA=BA | Storage Performance Development Kit | | =E6=8A=84=E9=80=81=E8=87=B3 | | | =E4=B8=BB=E9=A2=98 | [SPDK] Re: The difference between vhost-nvme and vho= st-blk | To clarify the flow of a request for vfio-user: 1) At start up time the guest shares it's memory by passing an fd over the = socket to the SPDK backing process, which SPDK maps. 2) The guest then issues an NVMe read request into the "virtual" NVMe submi= ssion queue and rings the (shadow) doorbell 3) The SPDK side sees the doorbell write, reads the requests that were plac= ed into the virtual queue, and then constructs bdev I/O requests to it's ba= ck-end, which could be any kind of device. 4) If the backing bdev happens to be a local NVMe SSD, the bdev I/O request= is translated into an NVMe request that's put onto the NVMe device's submi= ssion queue and the doorbell is rung. 5) When SPDK detects a completion from the backing device (by polling the C= Q if it's an NVMe device) it passes the completion back up the bdev stack a= nd into the nvmf target which places a CQE on the virtual completion queue 6) After writing completion queue entries to the queue, SPDK will generate = an interrupt by kicking a pre-created file descriptor that represents the i= nterrupt vector (if interrupts are enabled). 7) QEMU wakes up on the fd kick and emulates an interrupt into the guest During this whole process, the data is never copied or moved - only the req= uest structure. The backing device ends up doing DMA directly to guest memo= ry (that's been mapped into the SPDK process). If the guest is using "virtu= al" NVMe queues that do not have interrupts enabled, the SPDK process will = not generate interrupts. So if the guest is polling, no VM_EXITs are genera= ted at all during the entire process. Note that the flow here is mostly the same as for vhost-user. The main diff= erence is that with vfio-user we're free to emulate any device type, so we'= ve chosen to emulate NVMe. That means the guest can run it's standard NVMe = driver rather than requiring virtio drivers. > -----Original Message----- > From: zbhhbz > Sent: Tuesday, March 8, 2022 7:46 AM > To: spdk > Subject: [SPDK] Re: The difference between vhost-nvme and vhost-blk > > OK=EF=BC=8Cthanks, > I'm also curious about how the spdk interrupt the guestOS does the interr= upt go > through the qemu/kvm or does it go straight to the guestOS? > 1.in Vhost-user the guestOS is in poll mode, so it should wait for an int= errupt > from the nic.Will the interrupt from the nic go through qemu/kvm first? > 2.in vfio-user , since the guestOS has direct access to the "pcie address= "(DRAM), > can the spdk interrupt the guestOS directly? (a nvme interrupt) > > > > ---- =E5=9B=9E=E5=A4=8D=E7=9A=84=E5=8E=9F=E9=82=AE=E4=BB=B6 ---- > | =E5=8F=91=E4=BB=B6=E4=BA=BA | Thanos Makatos | > | =E6=97=A5=E6=9C=9F | 2022=E5=B9=B403=E6=9C=8808=E6=97=A5 22:19 | > | =E6=94=B6=E4=BB=B6=E4=BA=BA | Storage Performance Development Kit | > | =E6=8A=84=E9=80=81=E8=87=B3 | | > | =E4=B8=BB=E9=A2=98 | [SPDK] Re: The difference between vhost-nvme and v= host-blk | > > > -----Original Message----- > > From: zbhhbz > > Sent: 08 March 2022 14:16 > > To: Storage Performance Development Kit > > Subject: [SPDK] Re: The difference between vhost-nvme and vhost-blk > > > > > > > > > > > > > > > > > > > > > > what i meat is that : > > in vhost-user: > > 1. the guestOS should put an (vhost) request in the virtqueue 2. then > > the spdk polling discover this request 3. spdk should put an nvme > > request in the actual device and knock the door bell. > > this is two data(not the actual data but the request struct itself). > > > > > > in vfio-user: > > 1. the guestOS put an (nvme) request struct in the DRAM region 2. the > > spdk discovers this and then what ? still needs to inform the nvme > > physical device right? > > this is still two data copy(DMA) in the manner of nvme request struct. > > You're right, it does need to create a new request an put in the queue th= at can > be seen by the physical controller. However, I believe the read and write= payload > doesn't require this additional step. > > > > > > > > > > > > > > > > > > > At 2022-03-08 22:02:48, "Thanos Makatos" > > wrote: > > >> -----Original Message----- > > >> From: Liu, Xiaodong > > >> Sent: 08 March 2022 14:00 > > >> To: Storage Performance Development Kit > > >> Subject: [SPDK] Re: The difference between vhost-nvme and vhost-blk > > >> > > >> No, Vhost-user will just do once data DMA from Guest DRAM region to > > >> device buffer. > > > > > >Same for vfio-user, the guest has shared its memory to SPDK so the > > >physical > > device can access that memory directly. > > > > > >> > > >> -----Original Message----- > > >> From: zbhhbz > > >> Sent: Tuesday, March 8, 2022 9:54 PM > > >> To: Storage Performance Development Kit > > >> Subject: [SPDK] Re: The difference between vhost-nvme and vhost-blk > > >> > > >> > > >> > > >> > > >> ok, thanks, > > >> one more follow up question: > > >> isn't this leads to double DMA of data? one from guest to DRAM > > >> region > > and > > >> one from DRAM region to device buffer. > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> At 2022-03-08 21:31:44, "Thanos Makatos" > > > > >> wrote: > > >> >> -----Original Message----- > > >> >> From: zbhhbz > > >> >> Sent: 08 March 2022 13:20 > > >> >> To: Storage Performance Development Kit > > >> >> Subject: [SPDK] Re: The difference between vhost-nvme and vhost- > > blk > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> thanks, this helps a lot. > > >> >> > > >> >> > > >> >> about the vfio-user, > > >> >> > > >> >> > > >> >> I understand that in the vfio-user, the guestOS can issue DMA > > >> >> read/write to a "pcie space " of a virtual device, but I'm > > >> >> confused: > > >> >> 1. does the guestOS issue DMA read/write to region on actual > > >> >> physical device or just a DRAM region? > > >> > > > >> >A DRAM region. > > >> > > > >> >> if the guestOS directly access the physical > > >> >> device(DMA,IOMMU), where does spdk stands? > > >> >> 2. why do vfio-user need a socket, what kind of data does the > > >> >> socket > > >> carries? > > >> > > > >> >The vfio-user protocol allows a device to be emulated outside QEMU > > (the > > >> vfio-user client), in a separate process (the vfio-user server, > > >> SPDK running the nvmf/vfio-user target in our case). The UNIX > > >> domain socket is used between QEMU and SPDK for initial device > > >> setup, virtual IRQs, and other infrequent operations. > > >> > > > >> >> 3. Does the vfio-user look like the vhost-user except for direct > > >> >> DMA access instead of shared memory communication? > > >> > > > >> >vfio-user allows any kind of device to be emulated in a separate > > >> >process > > >> (even non-PCI), while vhost-user is mainly for VirtIO devices. > > >> > > > >> >> > > >> >> > > >> >> thanks > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> At 2022-03-08 17:40:12, "Thanos Makatos" > > >> > > >> >> wrote: > > >> >> >> -----Original Message----- > > >> >> >> From: zbhhbz > > >> >> >> Sent: 08 March 2022 09:29 > > >> >> >> To: spdk > > >> >> >> Subject: [SPDK] Re: The difference between vhost-nvme and > > >> >> >> vhost-blk > > >> >> >> > > >> >> >> thanks, follow up questions: > > >> >> >> 1. if I still use Vhost-user-blk-pci in qemu and with nvme > > >> >> >> ssd(bdev), > > i > > >> cant' > > >> >> >> have access to the nvme feature in guest(shadow door bell). > > >> >> >> is that > > >> >> correct? > > >> >> > > > >> >> >Correct. > > >> >> > > > >> >> >> 2. in the vfio-user solution, does the interrupt sending from > > >> >> >> the > > >> >> ssd(nvme) > > >> >> >> go through the qemu/kvm? or it go straight to the guest kernel? > > >> >> > > > >> >> >It doesn't go to QEMU/KVM. It depends on how you've set it up > > >> >> >in > > >> >> >SPDK: it > > >> >> can either go the host kernel or to SPDK. > > >> >> > > > >> >> >> 3. when will the vfio-user be available? does kvm have same > > >> >> >> delima > > >> here? > > >> >> > > > >> >> >vfio-user is under review in QEMU, so we can't predict when it > > >> >> >will be > > >> >> accepted upstream. This doesn't mean you can't use it though, > > >> >> have a look > > >> >> here: https://urldefense.proofpoint.com/v2/url?u=3Dhttps- > > >> >> 3A__github.com_nutanix_libvfio- > > >> >> > > >> > > 2Duser_blob_master_docs_spdk.md&d=3DDwIGaQ&c=3Ds883GpUCOChKOHiocY > > >> >> > > >> > > tGcg&r=3DXTpYsh5Ps2zJvtw6ogtti46atk736SI4vgsJiUKIyDE&m=3D5xzcHgA4AEwEk > > >> >> wrWO3u9vZt5Fmg2QcvFmOxjMr4NL5Usz4o_2HIoCisBygQ9- > > >> >> D1Q&s=3Dk2t1I2xi9Och5KIeiaXyo2wo9wFbhIyALcMUph5xLK0&e=3D > > >> >> > > > >> >> >> > > >> >> >> > > >> >> >> thank you very much! > > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> ---- =E5=9B=9E=E5=A4=8D=E7=9A=84=E5=8E=9F=E9=82=AE=E4=BB=B6 --= -- > > >> >> >> | =E5=8F=91=E4=BB=B6=E4=BA=BA | Liu, Changpeng | > > >> >> >> | =E6=97=A5=E6=9C=9F | 2022=E5=B9=B403=E6=9C=8808=E6=97=A5 16:= 33 | > > >> >> >> | =E6=94=B6=E4=BB=B6=E4=BA=BA | Storage Performance Development > > Kit > > >> | > > >> >> >> | =E6=8A=84=E9=80=81=E8=87=B3 | | > > >> >> >> | =E4=B8=BB=E9=A2=98 | [SPDK] Re: The difference between vhost= -nvme and > > vhost- > > >> blk > > >> >> >> | | > > >> >> >> Previously SPDK extended QEMU with a separate driver to > > >> >> >> enable > > >> >> >> vhost- nvme, this driver was not accepted by QEMU, so now we > > >> >> >> support emulated NVMe with a > > >> >> new > > >> >> >> solution > > >> >> >> "vfio-user", again the driver for supporting this is still > > >> >> >> under code review > > >> >> of > > >> >> >> QEMU community, > > >> >> >> but SPDK already supports this. > > >> >> >> > > >> >> >> > -----Original Message----- > > >> >> >> > From: zbhhbz(a)yeah.net > > >> >> >> > Sent: Tuesday, March 8, 2022 4:29 PM > > >> >> >> > To: spdk(a)lists.01.org > > >> >> >> > Subject: [SPDK] The difference between vhost-nvme and > > >> >> >> > vhost- > > blk > > >> >> >> > > > >> >> >> > Could someone help me understand the difference between > > vhost- > > >> >> nvme > > >> >> >> and > > >> >> >> > vhost-blk? > > >> >> >> > The online doc only shows there is vhost-user-blk-pci, why > > >> >> >> > not > > >> >> >> > vhost- > > >> >> user- > > >> >> >> nvme- > > >> >> >> > pci? > > >> >> >> > There is little doc fined in github/spdk and the qemu > > >> >> >> > itself doesn't help > > >> >> >> either > > >> >> >> > Thanks! > > >> >> >> > _______________________________________________ > > >> >> >> > SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send > > >> >> >> > an email to spdk-leave(a)lists.01.org > > >> >> >> _______________________________________________ > > >> >> >> SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an > > >> >> >> email to spdk-leave(a)lists.01.org > > >> >> >> _______________________________________________ > > >> >> >> SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an > > >> >> >> email to spdk-leave(a)lists.01.org > > >> >> >_______________________________________________ > > >> >> >SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an > > >> >> >email to spdk-leave(a)lists.01.org > > >> >> _______________________________________________ > > >> >> SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an > > >> >> email to spdk-leave(a)lists.01.org > > >> >_______________________________________________ > > >> >SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an > > >> >email to spdk-leave(a)lists.01.org > > >> _______________________________________________ > > >> SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an email > > >> to spdk-leave(a)lists.01.org > > >> _______________________________________________ > > >> SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an email > > >> to spdk-leave(a)lists.01.org > > >_______________________________________________ > > >SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an email > > >to spdk-leave(a)lists.01.org > > _______________________________________________ > > SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an email to > > spdk-leave(a)lists.01.org > _______________________________________________ > SPDK mailing list -- spdk(a)lists.01.org > To unsubscribe send an email to spdk-leave(a)lists.01.org > _______________________________________________ > SPDK mailing list -- spdk(a)lists.01.org > To unsubscribe send an email to spdk-leave(a)lists.01.org _______________________________________________ SPDK mailing list -- spdk(a)lists.01.org To unsubscribe send an email to spdk-leave(a)lists.01.org --===============7628453042148911725==--