Displaying 20 results from an estimated 35 matches for "ctx_lock".
Did you mean:
tx_lock
2020 Aug 05
2
[PATCH V5 1/6] vhost: introduce vhost_vring_call
On 2020/8/4 ??5:21, Michael S. Tsirkin wrote:
>>>>> ? +struct vhost_vring_call {
>>>>> +??? struct eventfd_ctx *ctx;
>>>>> +??? struct irq_bypass_producer producer;
>>>>> +??? spinlock_t ctx_lock;
>>>> It's not clear to me why we need ctx_lock here.
>>>>
>>>> Thanks
>>> Hi Jason,
>>>
>>> we use this lock to protect the eventfd_ctx and irq from race conditions,
>> We don't support irq notification from vDPA device d...
2020 Sep 09
0
[PATCH] vhost_vdpa: remove unnecessary spin_lock in vhost_vring_call
...x 3fab94f88894..bc679d0b7b87 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -97,26 +97,20 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid)
> return;
>
> irq = ops->get_vq_irq(vdpa, qid);
> - spin_lock(&vq->call_ctx.ctx_lock);
> irq_bypass_unregister_producer(&vq->call_ctx.producer);
> - if (!vq->call_ctx.ctx || irq < 0) {
> - spin_unlock(&vq->call_ctx.ctx_lock);
> + if (!vq->call_ctx.ctx || irq < 0)
> return;
> - }
>
> vq->call_ctx.producer.token = vq-...
2020 Aug 05
2
[PATCH V5 1/6] vhost: introduce vhost_vring_call
On 2020/8/4 ??5:21, Michael S. Tsirkin wrote:
>>>>> ? +struct vhost_vring_call {
>>>>> +??? struct eventfd_ctx *ctx;
>>>>> +??? struct irq_bypass_producer producer;
>>>>> +??? spinlock_t ctx_lock;
>>>> It's not clear to me why we need ctx_lock here.
>>>>
>>>> Thanks
>>> Hi Jason,
>>>
>>> we use this lock to protect the eventfd_ctx and irq from race conditions,
>> We don't support irq notification from vDPA device d...
2020 Aug 05
0
[PATCH V5 4/6] vhost_vdpa: implement IRQ offloading in vhost_vdpa
...{
>>> +??? struct vhost_virtqueue *vq = &v->vqs[qid];
>>> +??? const struct vdpa_config_ops *ops = v->vdpa->config;
>>> +??? struct vdpa_device *vdpa = v->vdpa;
>>> +??? int ret, irq;
>>> +
>>> +??? spin_lock(&vq->call_ctx.ctx_lock);
>>> +??? irq = ops->get_vq_irq(vdpa, qid);
>>> +??? if (!vq->call_ctx.ctx || irq < 0) {
>>> +??????? spin_unlock(&vq->call_ctx.ctx_lock);
>>> +??????? return;
>>> +??? }
>>> +
>>> +??? vq->call_ctx.producer.token =...
2020 Aug 04
3
[PATCH V5 1/6] vhost: introduce vhost_vring_call
...tic void vhost_vring_call_reset(struct vhost_vring_call
>>> *call_ctx)
>>> +{
>>> +??? call_ctx->ctx = NULL;
>>> +??? memset(&call_ctx->producer, 0x0, sizeof(struct
>>> irq_bypass_producer));
>>> +??? spin_lock_init(&call_ctx->ctx_lock);
>>> +}
>>> +
>>> ? static void vhost_vq_reset(struct vhost_dev *dev,
>>> ???????????????? struct vhost_virtqueue *vq)
>>> ? {
>>> @@ -319,13 +326,13 @@ static void vhost_vq_reset(struct vhost_dev *dev,
>>> ????? vq->log_base = NULL...
2020 Aug 04
3
[PATCH V5 1/6] vhost: introduce vhost_vring_call
...tic void vhost_vring_call_reset(struct vhost_vring_call
>>> *call_ctx)
>>> +{
>>> +??? call_ctx->ctx = NULL;
>>> +??? memset(&call_ctx->producer, 0x0, sizeof(struct
>>> irq_bypass_producer));
>>> +??? spin_lock_init(&call_ctx->ctx_lock);
>>> +}
>>> +
>>> ? static void vhost_vq_reset(struct vhost_dev *dev,
>>> ???????????????? struct vhost_virtqueue *vq)
>>> ? {
>>> @@ -319,13 +326,13 @@ static void vhost_vq_reset(struct vhost_dev *dev,
>>> ????? vq->log_base = NULL...
2020 Aug 05
0
[PATCH V5 4/6] vhost_vdpa: implement IRQ offloading in vhost_vdpa
...ue *vq = &v->vqs[qid];
>>>>> +??? const struct vdpa_config_ops *ops = v->vdpa->config;
>>>>> +??? struct vdpa_device *vdpa = v->vdpa;
>>>>> +??? int ret, irq;
>>>>> +
>>>>> +??? spin_lock(&vq->call_ctx.ctx_lock);
>>>>> +??? irq = ops->get_vq_irq(vdpa, qid);
>>>>> +??? if (!vq->call_ctx.ctx || irq < 0) {
>>>>> + spin_unlock(&vq->call_ctx.ctx_lock);
>>>>> +??????? return;
>>>>> +??? }
>>>>> +
>>&g...
2020 Aug 04
0
[PATCH V5 4/6] vhost_vdpa: implement IRQ offloading in vhost_vdpa
...d vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid)
> +{
> + struct vhost_virtqueue *vq = &v->vqs[qid];
> + const struct vdpa_config_ops *ops = v->vdpa->config;
> + struct vdpa_device *vdpa = v->vdpa;
> + int ret, irq;
> +
> + spin_lock(&vq->call_ctx.ctx_lock);
> + irq = ops->get_vq_irq(vdpa, qid);
> + if (!vq->call_ctx.ctx || irq < 0) {
> + spin_unlock(&vq->call_ctx.ctx_lock);
> + return;
> + }
> +
> + vq->call_ctx.producer.token = vq->call_ctx.ctx;
> + vq->call_ctx.producer.irq = irq;
> + ret = irq...
2020 Aug 05
0
[PATCH 2/2] vhost_vdpa: unified set_vq_irq() and update_vq_irq()
...166a8192e..044e1f54582a 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -122,8 +122,12 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid)
> struct vdpa_device *vdpa = v->vdpa;
> int ret, irq;
>
> - spin_lock(&vq->call_ctx.ctx_lock);
> + if (!ops->get_vq_irq)
> + return;
> +
> irq = ops->get_vq_irq(vdpa, qid);
> + spin_lock(&vq->call_ctx.ctx_lock);
> + irq_bypass_unregister_producer(&vq->call_ctx.producer);
> if (!vq->call_ctx.ctx || irq < 0) {
> spin_unlock(&vq-&g...
2020 Jul 17
0
[PATCH V2 4/6] vhost_vdpa: implement IRQ offloading in vhost_vdpa
...eturn IRQ_HANDLED;
> }
>
> +static void vhost_vdpa_setup_vq_irq(struct vdpa_device *dev, int qid, int irq)
> +{
> + struct vhost_vdpa *v = vdpa_get_drvdata(dev);
> + struct vhost_virtqueue *vq = &v->vqs[qid];
> + int ret;
> +
> + spin_lock(&vq->call_ctx.ctx_lock);
> + if (!vq->call_ctx.ctx) {
> + spin_unlock(&vq->call_ctx.ctx_lock);
> + return;
> + }
I think we can simply remove this check as what is done in
vhost_vdpq_update_vq_irq().
> +
> + vq->call_ctx.producer.token = vq->call_ctx.ctx;
> + vq->call_ctx.pr...
2020 Aug 04
0
[PATCH V5 4/6] vhost_vdpa: implement IRQ offloading in vhost_vdpa
...{
> +??? struct vhost_virtqueue *vq = &v->vqs[qid];
> +??? const struct vdpa_config_ops *ops = v->vdpa->config;
> +??? struct vdpa_device *vdpa = v->vdpa;
> +??? int ret, irq;
> +
> +??? spin_lock(&vq->call_ctx.ctx_lock);
> +??? irq = ops->get_vq_irq(vdpa, qid);
> +??? if (!vq->call_ctx.ctx || irq < 0) {
> +??????? spin_unlock(&vq->call_ctx.ctx_lock);
> +??????? return;
> +??? }
> +
> +??? vq->call_ctx.producer.token =...
2020 Jul 28
0
[PATCH V4 4/6] vhost_vdpa: implement IRQ offloading in vhost_vdpa
...d vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, int qid)
> +{
> + struct vhost_virtqueue *vq = &v->vqs[qid];
> + const struct vdpa_config_ops *ops = v->vdpa->config;
> + struct vdpa_device *vdpa = v->vdpa;
> + int ret, irq;
> +
> + spin_lock(&vq->call_ctx.ctx_lock);
> + irq = ops->get_vq_irq(vdpa, qid);
> + if (!vq->call_ctx.ctx || irq == -EINVAL) {
It's better to check returned irq as "irq < 0" to be more robust.
Forcing a specific errno value is not good.
> + spin_unlock(&vq->call_ctx.ctx_lock);
> + return;...
2020 Jul 13
0
[PATCH 3/7] vhost_vdpa: implement IRQ offloading functions in vhost_vdpa
...vdpa_device *dev, int qid, int irq)
> +{
> + struct vhost_vdpa *v = vdpa_get_drvdata(dev);
> + struct vhost_virtqueue *vq = &v->vqs[qid];
> + int ret;
> +
> + vq_err(vq, "setup irq bypass for vq %d with irq = %d\n", qid, irq);
> + spin_lock(&vq->call_ctx.ctx_lock);
> + if (!vq->call_ctx.ctx)
> + return;
> +
> + vq->call_ctx.producer.token = vq->call_ctx.ctx;
> + vq->call_ctx.producer.irq = irq;
> + ret = irq_bypass_register_producer(&vq->call_ctx.producer);
> + spin_unlock(&vq->call_ctx.ctx_lock);
> +
>...
2020 Jul 15
0
[PATCH 3/7] vhost_vdpa: implement IRQ offloading functions in vhost_vdpa
...gt; +??? struct vhost_virtqueue *vq = &v->vqs[qid];
>>>>> +??? int ret;
>>>>> +
>>>>> +??? vq_err(vq, "setup irq bypass for vq %d with irq = %d\n", qid,
>>>>> irq);
>>>>> +??? spin_lock(&vq->call_ctx.ctx_lock);
>>>>> +??? if (!vq->call_ctx.ctx)
>>>>> +??????? return;
>>>>> +
>>>>> +??? vq->call_ctx.producer.token = vq->call_ctx.ctx;
>>>>> +??? vq->call_ctx.producer.irq = irq;
>>>>> +??? ret = irq_bypass...
2020 Jul 15
0
[PATCH 3/7] vhost_vdpa: implement IRQ offloading functions in vhost_vdpa
...pa *v = vdpa_get_drvdata(dev);
>>> +??? struct vhost_virtqueue *vq = &v->vqs[qid];
>>> +??? int ret;
>>> +
>>> +??? vq_err(vq, "setup irq bypass for vq %d with irq = %d\n", qid,
>>> irq);
>>> +??? spin_lock(&vq->call_ctx.ctx_lock);
>>> +??? if (!vq->call_ctx.ctx)
>>> +??????? return;
>>> +
>>> +??? vq->call_ctx.producer.token = vq->call_ctx.ctx;
>>> +??? vq->call_ctx.producer.irq = irq;
>>> +??? ret = irq_bypass_register_producer(&vq->call_ctx.producer...
2020 Aug 04
0
[PATCH V5 1/6] vhost: introduce vhost_vring_call
...; __vhost_vq_meta_reset(d->vqs[i]);
> }
>
> +static void vhost_vring_call_reset(struct vhost_vring_call *call_ctx)
> +{
> + call_ctx->ctx = NULL;
> + memset(&call_ctx->producer, 0x0, sizeof(struct irq_bypass_producer));
> + spin_lock_init(&call_ctx->ctx_lock);
> +}
> +
> static void vhost_vq_reset(struct vhost_dev *dev,
> struct vhost_virtqueue *vq)
> {
> @@ -319,13 +326,13 @@ static void vhost_vq_reset(struct vhost_dev *dev,
> vq->log_base = NULL;
> vq->error_ctx = NULL;
> vq->kick = NULL;
>...
2020 Aug 04
0
[PATCH V5 1/6] vhost: introduce vhost_vring_call
...host_vring_call
> > > > *call_ctx)
> > > > +{
> > > > +??? call_ctx->ctx = NULL;
> > > > +??? memset(&call_ctx->producer, 0x0, sizeof(struct
> > > > irq_bypass_producer));
> > > > +??? spin_lock_init(&call_ctx->ctx_lock);
> > > > +}
> > > > +
> > > > ? static void vhost_vq_reset(struct vhost_dev *dev,
> > > > ???????????????? struct vhost_virtqueue *vq)
> > > > ? {
> > > > @@ -319,13 +326,13 @@ static void vhost_vq_reset(struct vhost_dev *dev,...
2020 Jul 17
0
[PATCH V2 1/6] vhost: introduce vhost_call_ctx
...> __vhost_vq_meta_reset(d->vqs[i]);
> }
>
> +static void vhost_call_ctx_reset(struct vhost_call_ctx *call_ctx)
> +{
> + call_ctx->ctx = NULL;
> + memset(&call_ctx->producer, 0x0, sizeof(struct irq_bypass_producer));
> + spin_lock_init(&call_ctx->ctx_lock);
> +}
> +
> static void vhost_vq_reset(struct vhost_dev *dev,
> struct vhost_virtqueue *vq)
> {
> @@ -319,13 +326,13 @@ static void vhost_vq_reset(struct vhost_dev *dev,
> vq->log_base = NULL;
> vq->error_ctx = NULL;
> vq->kick = NULL;
>...
2020 Jul 22
0
[PATCH V3 1/6] vhost: introduce vhost_vring_call
...; __vhost_vq_meta_reset(d->vqs[i]);
> }
>
> +static void vhost_vring_call_reset(struct vhost_vring_call *call_ctx)
> +{
> + call_ctx->ctx = NULL;
> + memset(&call_ctx->producer, 0x0, sizeof(struct irq_bypass_producer));
> + spin_lock_init(&call_ctx->ctx_lock);
> +}
> +
> static void vhost_vq_reset(struct vhost_dev *dev,
> struct vhost_virtqueue *vq)
> {
> @@ -319,13 +326,13 @@ static void vhost_vq_reset(struct vhost_dev *dev,
> vq->log_base = NULL;
> vq->error_ctx = NULL;
> vq->kick = NULL;
>...
2020 Jul 17
0
[PATCH V2 4/6] vhost_vdpa: implement IRQ offloading in vhost_vdpa
...ers/vhost/vdpa.c
117
118 static void vhost_vdpa_setup_vq_irq(struct vdpa_device *dev, int qid, int irq)
119 {
120 struct vhost_vdpa *v = vdpa_get_drvdata(dev);
121 struct vhost_virtqueue *vq = &v->vqs[qid];
> 122 int ret;
123
124 spin_lock(&vq->call_ctx.ctx_lock);
125 if (!vq->call_ctx.ctx) {
126 spin_unlock(&vq->call_ctx.ctx_lock);
127 return;
128 }
129
130 vq->call_ctx.producer.token = vq->call_ctx.ctx;
131 vq->call_ctx.producer.irq = irq;
132 ret = irq_bypass_register_producer(&vq->call_ctx.pro...