search for: dec_in_flight_req

Displaying 13 results from an estimated 13 matches for "dec_in_flight_req".

2019 Oct 15
0
[PATCH 4/5] virtiofs: Count pending forgets as in_flight forgets
...e *vq_to_fpq(struct virtqueue *vq) return &vq_to_fsvq(vq)->fud->pq; } +/* Should be called with fsvq->lock held. */ +static inline void inc_in_flight_req(struct virtio_fs_vq *fsvq) +{ + fsvq->in_flight++; +} + +/* Should be called with fsvq->lock held. */ +static inline void dec_in_flight_req(struct virtio_fs_vq *fsvq) +{ + WARN_ON(fsvq->in_flight <= 0); + fsvq->in_flight--; +} + static void release_virtio_fs_obj(struct kref *ref) { struct virtio_fs *vfs = container_of(ref, struct virtio_fs, refcount); @@ -110,22 +123,6 @@ static void virtio_fs_drain_queue(struct virtio_fs_...
2019 Oct 30
0
[PATCH 1/3] virtiofs: Use a common function to send forget
.../ +static int send_forget_request(struct virtio_fs_vq *fsvq, + struct virtio_fs_forget *forget, + bool in_flight) +{ + struct scatterlist sg; + struct virtqueue *vq; + int ret = 0; + bool notify; + + spin_lock(&fsvq->lock); + if (!fsvq->connected) { + if (in_flight) + dec_in_flight_req(fsvq); + kfree(forget); + goto out; + } + + sg_init_one(&sg, forget, sizeof(*forget)); + vq = fsvq->vq; + dev_dbg(&vq->vdev->dev, "%s\n", __func__); + + ret = virtqueue_add_outbuf(vq, &sg, 1, forget, GFP_ATOMIC); + if (ret < 0) { + if (ret == -ENOMEM || ret == -...
2019 Oct 15
7
[PATCH 0/5] virtiofs: Fix couple of deadlocks
Hi, We have couple of places which can result in deadlock. This patch series fixes these. We can be called with fc->bg_lock (for background requests) while submitting a request. This leads to two constraints. - We can't end requests in submitter's context and call fuse_end_request() as it tries to take fc->bg_lock as well. So queue these requests on a list and use a worker to
2019 Oct 30
6
[PATCH 0/3] virtiofs: Small Cleanups for 5.5
Hi Miklos, Here are few small cleanups for virtiofs for 5.5. I had received some comments from Michael Tsirkin on original virtiofs patches and these cleanups are result of these comments. Thanks Vivek Vivek Goyal (3): virtiofs: Use a common function to send forget virtiofs: Do not send forget request "struct list_head" element virtiofs: Use completions while waiting for queue
2020 Jun 18
0
[PATCH AUTOSEL 5.4 096/266] virtiofs: schedule blocking async replies in separate worker
...ap->pages[i]; + zero_user_segment(page, len, thislen); + len = 0; + } else { + len -= thislen; + } + } + } + + spin_lock(&fpq->lock); + clear_bit(FR_SENT, &req->flags); + spin_unlock(&fpq->lock); + + fuse_request_end(fc, req); + spin_lock(&fsvq->lock); + dec_in_flight_req(fsvq); + spin_unlock(&fsvq->lock); +} + +static void virtio_fs_complete_req_work(struct work_struct *work) +{ + struct virtio_fs_req_work *w = + container_of(work, typeof(*w), done_work); + + virtio_fs_request_complete(w->req, w->fsvq); + kfree(w); +} + static void virtio_fs_requests...
2020 Jun 18
0
[PATCH AUTOSEL 5.7 131/388] virtiofs: schedule blocking async replies in separate worker
...ap->pages[i]; + zero_user_segment(page, len, thislen); + len = 0; + } else { + len -= thislen; + } + } + } + + spin_lock(&fpq->lock); + clear_bit(FR_SENT, &req->flags); + spin_unlock(&fpq->lock); + + fuse_request_end(fc, req); + spin_lock(&fsvq->lock); + dec_in_flight_req(fsvq); + spin_unlock(&fsvq->lock); +} + +static void virtio_fs_complete_req_work(struct work_struct *work) +{ + struct virtio_fs_req_work *w = + container_of(work, typeof(*w), done_work); + + virtio_fs_request_complete(w->req, w->fsvq); + kfree(w); +} + static void virtio_fs_requests...
2023 Jun 01
2
[PATCH V2] virtio-fs: Improved request latencies when Virtio queue is full
...flush_work(&fsvq->dispatch_work); > > >> } > > >> > > >> static void virtio_fs_drain_all_queues_locked(struct virtio_fs *fs) > > >> @@ -346,6 +346,9 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work) > > >> dec_in_flight_req(fsvq); > > >> } > > >> } while (!virtqueue_enable_cb(vq) && likely(!virtqueue_is_broken(vq))); > > >> + > > >> + if (!list_empty(&fsvq->queued_reqs)) > > >> + schedule_work(&fsvq->dispatch_work); > > >&...
2023 May 31
1
[PATCH V2] virtio-fs: Improved request latencies when Virtio queue is full
...ch_work); > >> + flush_work(&fsvq->dispatch_work); > >> } > >> > >> static void virtio_fs_drain_all_queues_locked(struct virtio_fs *fs) > >> @@ -346,6 +346,9 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work) > >> dec_in_flight_req(fsvq); > >> } > >> } while (!virtqueue_enable_cb(vq) && likely(!virtqueue_is_broken(vq))); > >> + > >> + if (!list_empty(&fsvq->queued_reqs)) > >> + schedule_work(&fsvq->dispatch_work); > >> spin_unlock(&fsvq-&g...
2023 May 31
1
[PATCH V2] virtio-fs: Improved request latencies when Virtio queue is full
...} flush_work(&fsvq->done_work); - flush_delayed_work(&fsvq->dispatch_work); + flush_work(&fsvq->dispatch_work); } static void virtio_fs_drain_all_queues_locked(struct virtio_fs *fs) @@ -346,6 +346,9 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work) dec_in_flight_req(fsvq); } } while (!virtqueue_enable_cb(vq) && likely(!virtqueue_is_broken(vq))); + + if (!list_empty(&fsvq->queued_reqs)) + schedule_work(&fsvq->dispatch_work); spin_unlock(&fsvq->lock); } @@ -353,7 +356,7 @@ static void virtio_fs_request_dispatch_work(struct...
2023 Jun 01
1
[PATCH V2] virtio-fs: Improved request latencies when Virtio queue is full
...k(&fsvq->dispatch_work); >>>>> } >>>>> >>>>> static void virtio_fs_drain_all_queues_locked(struct virtio_fs *fs) >>>>> @@ -346,6 +346,9 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work) >>>>> dec_in_flight_req(fsvq); >>>>> } >>>>> } while (!virtqueue_enable_cb(vq) && likely(!virtqueue_is_broken(vq))); >>>>> + >>>>> + if (!list_empty(&fsvq->queued_reqs)) >>>>> + schedule_work(&fsvq->dispatch_work); >&...
2023 Jul 03
2
[PATCH V4] virtio-fs: Improved request latencies when Virtio queue is full
...} flush_work(&fsvq->done_work); - flush_delayed_work(&fsvq->dispatch_work); + flush_work(&fsvq->dispatch_work); } static void virtio_fs_drain_all_queues_locked(struct virtio_fs *fs) @@ -346,6 +346,9 @@ static void virtio_fs_hiprio_done_work(struct work_struct *work) dec_in_flight_req(fsvq); } } while (!virtqueue_enable_cb(vq) && likely(!virtqueue_is_broken(vq))); + + if (!list_empty(&fsvq->queued_reqs)) + schedule_work(&fsvq->dispatch_work); spin_unlock(&fsvq->lock); } @@ -353,7 +356,7 @@ static void virtio_fs_request_dispatch_work(struct...
2019 Oct 21
0
[PATCH 5/5] virtiofs: Retry request submission from worker context
...msecs_to_jiffies(1)); > > + spin_unlock(&fsvq->lock); > > + return; > > + } > > + req->out.h.error = ret; > > + dec_in_flight_req(fsvq); > > Missing locking. Fixed. Good catch. Thanks. Vivek
2019 Oct 30
0
[PATCH 3/3] virtiofs: Use completions while waiting for queue to be drained
...a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -35,6 +35,7 @@ struct virtio_fs_vq { struct fuse_dev *fud; bool connected; long in_flight; + struct completion in_flight_zero; /* No inflight requests */ char name[24]; } ____cacheline_aligned_in_smp; @@ -85,6 +86,8 @@ static inline void dec_in_flight_req(struct virtio_fs_vq *fsvq) { WARN_ON(fsvq->in_flight <= 0); fsvq->in_flight--; + if (!fsvq->in_flight) + complete(&fsvq->in_flight_zero); } static void release_virtio_fs_obj(struct kref *ref) @@ -115,22 +118,23 @@ static void virtio_fs_drain_queue(struct virtio_fs_vq *f...