search for: busy_wait

Displaying 20 results from an estimated 47 matches for "busy_wait".

Did you mean: busy_bit
2018 Jan 25
2
[PATCH net-next 12/12] tools/virtio: fix smp_mb on x86
...-- tools/virtio/ringtest/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h index 593a328..301d59b 100644 --- a/tools/virtio/ringtest/main.h +++ b/tools/virtio/ringtest/main.h @@ -111,7 +111,7 @@ static inline void busy_wait(void) } #if defined(__x86_64__) || defined(__i386__) -#define smp_mb() asm volatile("lock; addl $0,-128(%%rsp)" ::: "memory", "cc") +#define smp_mb() asm volatile("lock; addl $0,-132(%%rsp)" ::: "memory", "cc") #else /* *...
2018 Jan 25
2
[PATCH net-next 12/12] tools/virtio: fix smp_mb on x86
...-- tools/virtio/ringtest/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h index 593a328..301d59b 100644 --- a/tools/virtio/ringtest/main.h +++ b/tools/virtio/ringtest/main.h @@ -111,7 +111,7 @@ static inline void busy_wait(void) } #if defined(__x86_64__) || defined(__i386__) -#define smp_mb() asm volatile("lock; addl $0,-128(%%rsp)" ::: "memory", "cc") +#define smp_mb() asm volatile("lock; addl $0,-132(%%rsp)" ::: "memory", "cc") #else /* *...
2017 Jun 20
2
[PATCH v11 6/6] virtio-balloon: VIRTIO_BALLOON_F_CMD_VQ
...ei Wang wrote: > - if (!virtqueue_indirect_desc_table_add(vq, desc, num)) { > + if (!virtqueue_indirect_desc_table_add(vq, desc, *num)) { > virtqueue_kick(vq); > - wait_event(vb->acked, virtqueue_get_buf(vq, &len)); > - vb->balloon_page_chunk.chunk_num = 0; > + if (busy_wait) > + while (!virtqueue_get_buf(vq, &len) && > + !virtqueue_is_broken(vq)) > + cpu_relax(); > + else > + wait_event(vb->acked, virtqueue_get_buf(vq, &len)); This is something I didn't previously notice. As you always keep a single buffer in fl...
2017 Jun 20
2
[PATCH v11 6/6] virtio-balloon: VIRTIO_BALLOON_F_CMD_VQ
...ei Wang wrote: > - if (!virtqueue_indirect_desc_table_add(vq, desc, num)) { > + if (!virtqueue_indirect_desc_table_add(vq, desc, *num)) { > virtqueue_kick(vq); > - wait_event(vb->acked, virtqueue_get_buf(vq, &len)); > - vb->balloon_page_chunk.chunk_num = 0; > + if (busy_wait) > + while (!virtqueue_get_buf(vq, &len) && > + !virtqueue_is_broken(vq)) > + cpu_relax(); > + else > + wait_event(vb->acked, virtqueue_get_buf(vq, &len)); This is something I didn't previously notice. As you always keep a single buffer in fl...
2017 Mar 10
0
[virtio-dev] Re: [PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER
..._balloon *vb) >> +{ >> + int i; >> + >> + for (i = 0; i < vb->nr_page_bmap; i++) >> + memset(vb->page_bitmap[i], 0, PAGE_BMAP_SIZE); >> +} >> + >> +static void send_resp_data(struct virtio_balloon *vb, struct virtqueue *vq, >> + bool busy_wait) >> +{ >> + struct scatterlist sg[2]; >> + struct virtio_balloon_resp_hdr *hdr = &vb->resp_hdr; >> unsigned int len; >> >> - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); >> + len = hdr->data_len = vb->resp_...
2016 Jan 21
1
[PATCH] tools/virtio: add ringtest utilities
...olatile("" ::: "memory") + +/* Is there a portable way to do this? */ +#if defined(__x86_64__) || defined(__i386__) +#define cpu_relax() asm ("rep; nop" ::: "memory") +#else +#define cpu_relax() assert(0) +#endif + +extern bool do_relax; + +static inline void busy_wait(void) +{ + if (do_relax) + cpu_relax(); + else + /* prevent compiler from removing busy loops */ + barrier(); +} + +/* + * Not using __ATOMIC_SEQ_CST since gcc docs say they are only synchronized + * with other __ATOMIC_SEQ_CST calls. + */ +#define smp_mb() __sync_synchronize() + +/* + * This a...
2016 Jan 21
1
[PATCH] tools/virtio: add ringtest utilities
...olatile("" ::: "memory") + +/* Is there a portable way to do this? */ +#if defined(__x86_64__) || defined(__i386__) +#define cpu_relax() asm ("rep; nop" ::: "memory") +#else +#define cpu_relax() assert(0) +#endif + +extern bool do_relax; + +static inline void busy_wait(void) +{ + if (do_relax) + cpu_relax(); + else + /* prevent compiler from removing busy loops */ + barrier(); +} + +/* + * Not using __ATOMIC_SEQ_CST since gcc docs say they are only synchronized + * with other __ATOMIC_SEQ_CST calls. + */ +#define smp_mb() __sync_synchronize() + +/* + * This a...
2017 Mar 08
3
[PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER
...void clear_page_bitmap(struct virtio_balloon *vb) > +{ > + int i; > + > + for (i = 0; i < vb->nr_page_bmap; i++) > + memset(vb->page_bitmap[i], 0, PAGE_BMAP_SIZE); > +} > + > +static void send_resp_data(struct virtio_balloon *vb, struct virtqueue *vq, > + bool busy_wait) > +{ > + struct scatterlist sg[2]; > + struct virtio_balloon_resp_hdr *hdr = &vb->resp_hdr; > unsigned int len; > > - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); > + len = hdr->data_len = vb->resp_pos * sizeof(__le64); > + s...
2017 Mar 08
3
[PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER
...void clear_page_bitmap(struct virtio_balloon *vb) > +{ > + int i; > + > + for (i = 0; i < vb->nr_page_bmap; i++) > + memset(vb->page_bitmap[i], 0, PAGE_BMAP_SIZE); > +} > + > +static void send_resp_data(struct virtio_balloon *vb, struct virtqueue *vq, > + bool busy_wait) > +{ > + struct scatterlist sg[2]; > + struct virtio_balloon_resp_hdr *hdr = &vb->resp_hdr; > unsigned int len; > > - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); > + len = hdr->data_len = vb->resp_pos * sizeof(__le64); > + s...
2016 Dec 21
0
[PATCH v6 kernel 3/5] virtio-balloon: speed up inflate/deflate process
...free(vb->page_bitmap[i]); +} + +static void clear_page_bitmap(struct virtio_balloon *vb) +{ + int i; + + for (i = 0; i < vb->nr_page_bmap; i++) + memset(vb->page_bitmap[i], 0, BALLOON_BMAP_SIZE); +} + +static void send_resp_data(struct virtio_balloon *vb, struct virtqueue *vq, + bool busy_wait) +{ + struct scatterlist sg[2]; + struct virtio_balloon_resp_hdr *hdr = vb->resp_hdr; unsigned int len; - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); + len = hdr->data_len = vb->resp_pos * sizeof(__le64); + sg_init_table(sg, 2); + sg_set_buf(&sg[0],...
2017 Mar 03
0
[PATCH v7 kernel 3/5] virtio-balloon: implementation of VIRTIO_BALLOON_F_CHUNK_TRANSFER
...kfree(vb->page_bitmap[i]); +} + +static void clear_page_bitmap(struct virtio_balloon *vb) +{ + int i; + + for (i = 0; i < vb->nr_page_bmap; i++) + memset(vb->page_bitmap[i], 0, PAGE_BMAP_SIZE); +} + +static void send_resp_data(struct virtio_balloon *vb, struct virtqueue *vq, + bool busy_wait) +{ + struct scatterlist sg[2]; + struct virtio_balloon_resp_hdr *hdr = &vb->resp_hdr; unsigned int len; - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); + len = hdr->data_len = vb->resp_pos * sizeof(__le64); + sg_init_table(sg, 2); + sg_set_buf(&s...
2017 Apr 14
0
[virtio-dev] Re: [PATCH v9 2/5] virtio-balloon: VIRTIO_BALLOON_F_BALLOON_CHUNKS
...>> +{ >> + int i; >> + >> + for (i = 0; i < vb->page_bmaps; i++) >> + memset(vb->page_bmap[i], 0, PAGE_BMAP_SIZE); >> +} >> + >> +static void send_page_chunks(struct virtio_balloon *vb, struct virtqueue *vq, >> + int type, bool busy_wait) > busy_wait seems unused. pls drop. It will be used in the other patch (the 5th patch) for sending unused pages. Probably I can add it from that patch. > >> { >> struct scatterlist sg; >> + struct virtio_balloon_page_chunk_hdr *hdr; >> + void *buf; >>...
2017 Apr 13
3
[PATCH v9 2/5] virtio-balloon: VIRTIO_BALLOON_F_BALLOON_CHUNKS
...page_bmap(struct virtio_balloon *vb) > +{ > + int i; > + > + for (i = 0; i < vb->page_bmaps; i++) > + memset(vb->page_bmap[i], 0, PAGE_BMAP_SIZE); > +} > + > +static void send_page_chunks(struct virtio_balloon *vb, struct virtqueue *vq, > + int type, bool busy_wait) busy_wait seems unused. pls drop. > { > struct scatterlist sg; > + struct virtio_balloon_page_chunk_hdr *hdr; > + void *buf; > unsigned int len; > > - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); > + switch (type) { > + case PAGE_...
2017 Apr 13
3
[PATCH v9 2/5] virtio-balloon: VIRTIO_BALLOON_F_BALLOON_CHUNKS
...page_bmap(struct virtio_balloon *vb) > +{ > + int i; > + > + for (i = 0; i < vb->page_bmaps; i++) > + memset(vb->page_bmap[i], 0, PAGE_BMAP_SIZE); > +} > + > +static void send_page_chunks(struct virtio_balloon *vb, struct virtqueue *vq, > + int type, bool busy_wait) busy_wait seems unused. pls drop. > { > struct scatterlist sg; > + struct virtio_balloon_page_chunk_hdr *hdr; > + void *buf; > unsigned int len; > > - sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); > + switch (type) { > + case PAGE_...
2017 Mar 03
10
[PATCH v7 kernel 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration
Take over this work from Liang. This patch series implements two optimizations: 1) transfer pages in chuncks between the guest and host; 1) transfer the guest unused pages to the host so that they can be skipped to migrate in live migration. Please check patch 0003 for more details about optimization 1). For an idle guest with 8GB RAM, optimization 2) can help shorten the total live migration
2017 Mar 03
10
[PATCH v7 kernel 0/5] Extend virtio-balloon for fast (de)inflating & fast live migration
Take over this work from Liang. This patch series implements two optimizations: 1) transfer pages in chuncks between the guest and host; 1) transfer the guest unused pages to the host so that they can be skipped to migrate in live migration. Please check patch 0003 for more details about optimization 1). For an idle guest with 8GB RAM, optimization 2) can help shorten the total live migration
2018 Jan 25
0
[PATCH net-next 11/12] tools/virtio: copy READ/WRITE_ONCE
...h | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h index 5706e07..593a328 100644 --- a/tools/virtio/ringtest/main.h +++ b/tools/virtio/ringtest/main.h @@ -134,4 +134,61 @@ static inline void busy_wait(void) barrier(); \ } while (0) +#if defined(__i386__) || defined(__x86_64__) || defined(__s390x__) +#define smp_wmb() barrier() +#else +#define smp_wmb() smp_release() +#endif + +#ifdef __alpha__ +#define smp_read_barrier_depends() smp_acquire() +#else +#define smp_read_barrier_depends() do...
2018 Jan 26
0
[PATCH net-next 12/12] tools/virtio: fix smp_mb on x86
...2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h > index 593a328..301d59b 100644 > --- a/tools/virtio/ringtest/main.h > +++ b/tools/virtio/ringtest/main.h > @@ -111,7 +111,7 @@ static inline void busy_wait(void) > } > > #if defined(__x86_64__) || defined(__i386__) > -#define smp_mb() asm volatile("lock; addl $0,-128(%%rsp)" ::: "memory", "cc") Just wonder did "rsp" work for __i386__ ? Thanks > +#define smp_mb() asm volatile(&quo...
2014 Feb 27
0
[PATCH RFC v5 7/8] pvqspinlock, x86: Add qspinlock para-virtualization support
...me as the pvticketlock, using the same lock_spinning and unlock_lock hooks. The x86-specific codepath can use bit 1 in the ->wait byte as "I have halted, please kick me". value = _QSPINLOCK_WAITING; i = 0; do cpu_relax(); while (ACCESS_ONCE(slock->lock) && i++ < BUSY_WAIT); if (ACCESS_ONCE(slock->lock)) { value |= _QSPINLOCK_HALTED; xchg(&slock->wait, value >> 8); if (ACCESS_ONCE(slock->lock)) { ... call lock_spinning hook ... } } /* * Set the lock bit & clear the halted+waiting bits */ if (cmpxchg(&slock->lock_wait,...
2017 Jul 12
0
[virtio-dev] Re: [PATCH v11 6/6] virtio-balloon: VIRTIO_BALLOON_F_CMD_VQ
...+ if (!virtqueue_indirect_desc_table_add(vq, desc, *num)) { >>>>>> virtqueue_kick(vq); >>>>>> - wait_event(vb->acked, virtqueue_get_buf(vq, &len)); >>>>>> - vb->balloon_page_chunk.chunk_num = 0; >>>>>> + if (busy_wait) >>>>>> + while (!virtqueue_get_buf(vq, &len) && >>>>>> + !virtqueue_is_broken(vq)) >>>>>> + cpu_relax(); >>>>>> + else >>>>>> + wait_event(vb->acked, virtqueue_get_buf(vq, &amp...