DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Missing an increment on  vq->log_cache_nb_elem ?
@ 2018-06-14 12:44 HePeng
       [not found] ` <CGME20180615123208eucas1p1e5d258f95e9621a31c2fcfbf1f494476@eucas1p1.samsung.com>
  0 siblings, 1 reply; 4+ messages in thread
From: HePeng @ 2018-06-14 12:44 UTC (permalink / raw)
  To: maxime.coquelin; +Cc: dev

Hi, 


In the latest dpdk master branch, in the function *vhost_log_cache_page*:


static __rte_always_inline void
vhost_log_cache_page(struct virtio_net *dev, struct vhost_virtqueue *vq,
			uint64_t page)
{
	uint32_t bit_nr = page % (sizeof(unsigned long) << 3);
	uint32_t offset = page / (sizeof(unsigned long) << 3);
	int i;

	for (i = 0; i < vq->log_cache_nb_elem; i++) {
		struct log_cache_entry *elem = vq->log_cache + i;

		if (elem->offset == offset) {
			elem->val |= (1UL << bit_nr);
			return;
		}
	}

	if (unlikely(i >= VHOST_LOG_CACHE_NR)) {
		/*
		 * No more room for a new log cache entry,
		 * so write the dirty log map directly.
		 */
		rte_smp_wmb();
		vhost_log_page((uint8_t *)(uintptr_t)dev->log_base, page);

		return;
	}

	vq->log_cache[i].offset = offset;
	vq->log_cache[i].val = (1UL << bit_nr);
}

Did it just miss an increment on vq->log_cache_nb_elem ?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Missing an increment on vq->log_cache_nb_elem ?
       [not found] ` <CGME20180615123208eucas1p1e5d258f95e9621a31c2fcfbf1f494476@eucas1p1.samsung.com>
@ 2018-06-15 12:32   ` Ilya Maximets
  2018-06-15 13:24     ` Maxime Coquelin
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Maximets @ 2018-06-15 12:32 UTC (permalink / raw)
  To: dev, Maxime Coquelin; +Cc: HePeng, Tiwei Bie, Zhihong Wang

> Hi, 
> 
> 
> In the latest dpdk master branch, in the function *vhost_log_cache_page*:
> 
> 
> static __rte_always_inline void
> vhost_log_cache_page(struct virtio_net *dev, struct vhost_virtqueue *vq,
> 			uint64_t page)
> {
> 	uint32_t bit_nr = page % (sizeof(unsigned long) << 3);
> 	uint32_t offset = page / (sizeof(unsigned long) << 3);
> 	int i;
> 
> 	for (i = 0; i < vq->log_cache_nb_elem; i++) {
> 		struct log_cache_entry *elem = vq->log_cache + i;
> 
> 		if (elem->offset == offset) {
> 			elem->val |= (1UL << bit_nr);
> 			return;
> 		}
> 	}
> 
> 	if (unlikely(i >= VHOST_LOG_CACHE_NR)) {
> 		/*
> 		 * No more room for a new log cache entry,
> 		 * so write the dirty log map directly.
> 		 */
> 		rte_smp_wmb();
> 		vhost_log_page((uint8_t *)(uintptr_t)dev->log_base, page);
> 
> 		return;
> 	}
> 
> 	vq->log_cache[i].offset = offset;
> 	vq->log_cache[i].val = (1UL << bit_nr);
> }
> 
> Did it just miss an increment on vq->log_cache_nb_elem ?

Hi. Thanks for pointing that.

I looked through the code and I see no updates of 'vq->log_cache_nb_elem'.
Looks like it always equal to initial zero value.

Maxime, I'm afraid that this means that currently pages logging is not
performed at all. Could you please check?

Best regards, Ilya Maximets.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Missing an increment on vq->log_cache_nb_elem ?
  2018-06-15 12:32   ` Ilya Maximets
@ 2018-06-15 13:24     ` Maxime Coquelin
  2018-06-15 13:28       ` HePeng
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Coquelin @ 2018-06-15 13:24 UTC (permalink / raw)
  To: Ilya Maximets, dev, HePeng; +Cc: Tiwei Bie, Zhihong Wang

Hi,

On 06/15/2018 02:32 PM, Ilya Maximets wrote:
>> Hi,
>>
>>
>> In the latest dpdk master branch, in the function *vhost_log_cache_page*:
>>
>>
>> static __rte_always_inline void
>> vhost_log_cache_page(struct virtio_net *dev, struct vhost_virtqueue *vq,
>> 			uint64_t page)
>> {
>> 	uint32_t bit_nr = page % (sizeof(unsigned long) << 3);
>> 	uint32_t offset = page / (sizeof(unsigned long) << 3);
>> 	int i;
>>
>> 	for (i = 0; i < vq->log_cache_nb_elem; i++) {
>> 		struct log_cache_entry *elem = vq->log_cache + i;
>>
>> 		if (elem->offset == offset) {
>> 			elem->val |= (1UL << bit_nr);
>> 			return;
>> 		}
>> 	}
>>
>> 	if (unlikely(i >= VHOST_LOG_CACHE_NR)) {
>> 		/*
>> 		 * No more room for a new log cache entry,
>> 		 * so write the dirty log map directly.
>> 		 */
>> 		rte_smp_wmb();
>> 		vhost_log_page((uint8_t *)(uintptr_t)dev->log_base, page);
>>
>> 		return;
>> 	}
>>
>> 	vq->log_cache[i].offset = offset;
>> 	vq->log_cache[i].val = (1UL << bit_nr);
>> }
>>
>> Did it just miss an increment on vq->log_cache_nb_elem ?
> 
> Hi. Thanks for pointing that.
> 
> I looked through the code and I see no updates of 'vq->log_cache_nb_elem'.
> Looks like it always equal to initial zero value.
> 
> Maxime, I'm afraid that this means that currently pages logging is not
> performed at all. Could you please check?
> 
> Best regards, Ilya Maximets.
> 

Thanks Ilya for the heads-up and HePeng for reporting the issue.
It is broken indeed... We didn't noticed corruption when running
our non-reg tests, I guess they have to be improved.

I will post a patch shortly to fix this.

HePeng, how does your name spells in the form "$firstname $lastname"?
I would need this info to credit you for reporting the issue.

Regards,
Maxime

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Missing an increment on vq->log_cache_nb_elem ?
  2018-06-15 13:24     ` Maxime Coquelin
@ 2018-06-15 13:28       ` HePeng
  0 siblings, 0 replies; 4+ messages in thread
From: HePeng @ 2018-06-15 13:28 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: Ilya Maximets, dev, Tiwei Bie, Zhihong Wang

Hi, Maxime,

  My name is Peng He. 

  Thanks. 

> 在 2018年6月15日,下午9:24,Maxime Coquelin <maxime.coquelin@redhat.com> 写道:
> 
> Hi,
> 
> On 06/15/2018 02:32 PM, Ilya Maximets wrote:
>>> Hi,
>>> 
>>> 
>>> In the latest dpdk master branch, in the function *vhost_log_cache_page*:
>>> 
>>> 
>>> static __rte_always_inline void
>>> vhost_log_cache_page(struct virtio_net *dev, struct vhost_virtqueue *vq,
>>> 			uint64_t page)
>>> {
>>> 	uint32_t bit_nr = page % (sizeof(unsigned long) << 3);
>>> 	uint32_t offset = page / (sizeof(unsigned long) << 3);
>>> 	int i;
>>> 
>>> 	for (i = 0; i < vq->log_cache_nb_elem; i++) {
>>> 		struct log_cache_entry *elem = vq->log_cache + i;
>>> 
>>> 		if (elem->offset == offset) {
>>> 			elem->val |= (1UL << bit_nr);
>>> 			return;
>>> 		}
>>> 	}
>>> 
>>> 	if (unlikely(i >= VHOST_LOG_CACHE_NR)) {
>>> 		/*
>>> 		 * No more room for a new log cache entry,
>>> 		 * so write the dirty log map directly.
>>> 		 */
>>> 		rte_smp_wmb();
>>> 		vhost_log_page((uint8_t *)(uintptr_t)dev->log_base, page);
>>> 
>>> 		return;
>>> 	}
>>> 
>>> 	vq->log_cache[i].offset = offset;
>>> 	vq->log_cache[i].val = (1UL << bit_nr);
>>> }
>>> 
>>> Did it just miss an increment on vq->log_cache_nb_elem ?
>> Hi. Thanks for pointing that.
>> I looked through the code and I see no updates of 'vq->log_cache_nb_elem'.
>> Looks like it always equal to initial zero value.
>> Maxime, I'm afraid that this means that currently pages logging is not
>> performed at all. Could you please check?
>> Best regards, Ilya Maximets.
> 
> Thanks Ilya for the heads-up and HePeng for reporting the issue.
> It is broken indeed... We didn't noticed corruption when running
> our non-reg tests, I guess they have to be improved.
> 
> I will post a patch shortly to fix this.
> 
> HePeng, how does your name spells in the form "$firstname $lastname"?
> I would need this info to credit you for reporting the issue.
> 
> Regards,
> Maxime

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-15 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 12:44 [dpdk-dev] Missing an increment on vq->log_cache_nb_elem ? HePeng
     [not found] ` <CGME20180615123208eucas1p1e5d258f95e9621a31c2fcfbf1f494476@eucas1p1.samsung.com>
2018-06-15 12:32   ` Ilya Maximets
2018-06-15 13:24     ` Maxime Coquelin
2018-06-15 13:28       ` HePeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).