Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-10 Thread Alvaro Karsz
> I meant mutex doesn't prevent the preemption so the process could be > migrated to another cpu. Ok, I see it now, thanks. I'll add a spinlock in v3. Thanks. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxf

Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-10 Thread Jason Wang
在 2023/4/10 15:09, Alvaro Karsz 写道: In this case, I can just remove the wmb and that's it, right? But who or how to prevent the preemption? We use a mutex to protect the control mechanism (snet->ctrl_lock). I meant mutex doesn't prevent the preemption so the process could be migrated to an

Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-10 Thread Alvaro Karsz
> > In this case, I can just remove the wmb and that's it, right? > > But who or how to prevent the preemption? We use a mutex to protect the control mechanism (snet->ctrl_lock). ___ Virtualization mailing list Virtualization@lists.linux-foundation.org

Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-09 Thread Jason Wang
On Tue, Apr 4, 2023 at 3:35 PM Alvaro Karsz wrote: > > > > So it will arrive to the pci subsystem in program order, but the pci > > > subsystem may reorder, right? > > > > This is not what I read from the above doc. It said "to a particular > > device will arrive in program order". > > In this ca

Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-04 Thread Alvaro Karsz
> > So it will arrive to the pci subsystem in program order, but the pci > > subsystem may reorder, right? > > This is not what I read from the above doc. It said "to a particular > device will arrive in program order". In this case, I can just remove the wmb and that's it, right? Thanks __

Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-03 Thread Jason Wang
On Mon, Apr 3, 2023 at 5:18 PM Alvaro Karsz wrote: > > Hi Jason, > > > > + /* Overwrite the control register with the new buffer size (in 4B > > > words) */ > > > + snet_write_ctrl(regs, buf_words); > > > + /* Use a memory barrier, this must be written before the opcode > > > r

Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-03 Thread Alvaro Karsz
> I'm not sure how a spinlock can help in this case. > The entire control mechanism is protected by the spinlock snet->ctrl_lock, so > multiple CPUs won't use it simultaneously. Sorry, snet->ctrl_lock is a mutex, not a spinlock. ___ Virtualization maili

Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-03 Thread Alvaro Karsz
Hi Jason, > > + /* Overwrite the control register with the new buffer size (in 4B > > words) */ > > + snet_write_ctrl(regs, buf_words); > > + /* Use a memory barrier, this must be written before the opcode > > register. */ > > + wmb(); > > > At least you need to use smp

Re: [PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-02 Thread Jason Wang
On Sun, Apr 2, 2023 at 8:52 PM Alvaro Karsz wrote: > > This patch adds the get_vq_state and set_vq_state vDPA callbacks. > > In order to get the VQ state, the state needs to be read from the DPU. > In order to allow that, the old messaging mechanism is replaced with a new, > flexible control mecha

[PATCH resend 1/2] vdpa/snet: support getting and setting VQ state

2023-04-02 Thread Alvaro Karsz
This patch adds the get_vq_state and set_vq_state vDPA callbacks. In order to get the VQ state, the state needs to be read from the DPU. In order to allow that, the old messaging mechanism is replaced with a new, flexible control mechanism. This mechanism allows to read data from the DPU. The mec