[dpdk-dev] [PATCH v2 2/6] vhost: introduce vhost_log_write

2015-12-22 Thread Yuanhan Liu
On Tue, Dec 22, 2015 at 01:11:02PM +0800, Peter Xu wrote: > On Thu, Dec 17, 2015 at 11:11:57AM +0800, Yuanhan Liu wrote: > > +static inline void __attribute__((always_inline)) > > +vhost_log_write(struct virtio_net *dev, uint64_t addr, uint64_t len) > > +{ > > + uint64_t page; > > + > > + if

[dpdk-dev] [PATCH v2 2/6] vhost: introduce vhost_log_write

2015-12-22 Thread Peter Xu
On Thu, Dec 17, 2015 at 11:11:57AM +0800, Yuanhan Liu wrote: > +static inline void __attribute__((always_inline)) > +vhost_log_write(struct virtio_net *dev, uint64_t addr, uint64_t len) > +{ > + uint64_t page; > + > + if (likely(((dev->features & (1ULL << VHOST_F_LOG_ALL)) == 0) || > +

[dpdk-dev] [PATCH v2 2/6] vhost: introduce vhost_log_write

2015-12-22 Thread Yuanhan Liu
On Tue, Dec 22, 2015 at 02:45:52AM +, Xie, Huawei wrote: > >>> +static inline void __attribute__((always_inline)) > >>> +vhost_log_write(struct virtio_net *dev, uint64_t addr, uint64_t len) > >>> +{ > >>> + uint64_t page; > >>> + > >> Before we log, we need memory barrier to make sure updates

[dpdk-dev] [PATCH v2 2/6] vhost: introduce vhost_log_write

2015-12-22 Thread Yuanhan Liu
On Mon, Dec 21, 2015 at 03:06:43PM +, Xie, Huawei wrote: > On 12/17/2015 11:11 AM, Yuanhan Liu wrote: > > Introduce vhost_log_write() helper function to log the dirty pages we > > touched. Page size is harded code to 4096 (VHOST_LOG_PAGE), and each > > log is presented by 1 bit. > > > >

[dpdk-dev] [PATCH v2 2/6] vhost: introduce vhost_log_write

2015-12-22 Thread Xie, Huawei
On 12/22/2015 11:03 AM, Yuanhan Liu wrote: > On Tue, Dec 22, 2015 at 02:45:52AM +, Xie, Huawei wrote: > +static inline void __attribute__((always_inline)) > +vhost_log_write(struct virtio_net *dev, uint64_t addr, uint64_t len) > +{ > + uint64_t page; > + Before we log,

[dpdk-dev] [PATCH v2 2/6] vhost: introduce vhost_log_write

2015-12-22 Thread Xie, Huawei
On 12/22/2015 10:40 AM, Yuanhan Liu wrote: > On Mon, Dec 21, 2015 at 03:06:43PM +, Xie, Huawei wrote: >> On 12/17/2015 11:11 AM, Yuanhan Liu wrote: >>> Introduce vhost_log_write() helper function to log the dirty pages we >>> touched. Page size is harded code to 4096 (VHOST_LOG_PAGE), and each

[dpdk-dev] [PATCH v2 2/6] vhost: introduce vhost_log_write

2015-12-21 Thread Xie, Huawei
On 12/17/2015 11:11 AM, Yuanhan Liu wrote: > Introduce vhost_log_write() helper function to log the dirty pages we > touched. Page size is harded code to 4096 (VHOST_LOG_PAGE), and each > log is presented by 1 bit. > > Therefore, vhost_log_write() simply finds the right bit for related > page we