[dpdk-dev] Build with -Werror=declaration-after-statement

2016-09-02 Thread ASM
Hi folks!

Many groups have flag  -Werror=declaration-after-statement in the
their coding conventions. Dpdk have many code as static inline
function in the headers files and have trouble with it.

For example:
* lib/librte_ether/rte_ether.h, function rte_vlan_strip
* lib/librte_eal/common/include/rte_dev.h, function rte_pmd_debug_trace
* lib/librte_eal/common/include/arch/x86/rte_spinlock.h, fucntion rte_try_tm

Any project who use  -Werror=declaration-after-statement can't to
compile own projects without
patching this headers.

How do you look at to fix this problem?

---
Best regards,
Leonid Myravjev


Re: [dpdk-dev] [PATCH v5 5/8] hash: add read and write concurrency support

2018-08-17 Thread ASM
> I guess the try-locks still does not solve the overhead of multiple readers 
> contending the counter.  It just provides a non-blocking version of the same 
> algorithm.

DPDK project does not use any rwlock for solving any overhead problem
of multiple reader (at least I did not find it). For non-critical
sections it is often easier to write via rwlock (for to simplify the
code). The try locks, relock to read and other are use only for even
more simplifies uncritical code. For example some process need change
data (write lock), then reread the contents (read lock), it can
release write and lock read, but relock to read is easier. Process in
the write section can switch to read context and give control for
reader function.
I sought by third-party solution for rwlock, and decided that
rte_rwlock is the best choice for it, especially if there is a relock
to read, and try locks.

P.S. For solving the overhead problem of multiple readers (if using of
locks is _extremely_ required), best practice may be MCS lock and
rwlock based on the MCS locks.




---
Best regards,
Leonid Myravjev

On Fri, 13 Jul 2018 at 04:55, Wang, Yipeng1  wrote:
>
> Thanks for pointing me to this patch.
>
> I guess the try-locks still does not solve the overhead of multiple readers 
> contending the counter.  It just provides a non-blocking version of the same 
> algorithm.
>
> The relock function looks interesting. But it would be helpful if any special 
> use case or example is given. Specifically, who should call this function, 
> the reader or the writer?  Leonid, could you provide more context?
>
> The TLRW example I gave is potentially a better rw-lock algorithm. Paper 
> Reference:  D. Dice and N Shavit. "TLRW: return of the read-write lock". In 
> such scheme, readers won't contend the same reader counter which introduces 
> heavy cache bouncing that Stephen mentioned.  Maybe we should introduce 
> similar algorithm into rte_rwlock library.
>
> >-Original Message-
> >From: Thomas Monjalon [mailto:tho...@monjalon.net]
> >Sent: Thursday, July 12, 2018 1:30 PM
> >To: Wang, Yipeng1 ; Stephen Hemminger 
> >
> >Cc: dev@dpdk.org; De Lara Guarch, Pablo ; 
> >Richardson, Bruce ;
> >honnappa.nagaraha...@arm.com; vgu...@caviumnetworks.com; 
> >brijesh.s.si...@gmail.com; Wang, Ren ;
> >Gobriel, Sameh ; Tai, Charlie 
> >
> >Subject: Re: [dpdk-dev] [PATCH v5 5/8] hash: add read and write concurrency 
> >support
> >
> >12/07/2018 03:22, Wang, Yipeng1:
> >> From: Stephen Hemminger [mailto:step...@networkplumber.org]
> >>
> >> > For small windows, reader-writer locks are slower than a spin lock
> >> > because there are more cache bounces.
> >>
> >> Hi, Stephen,
> >>
> >> You are correct and we understand that spinlock might be slightly faster 
> >> than counter based rwlock in this case. However, the
> >counter based rwlock is the exception path when TSX fails.
> >>
> >> If performance of this exception path is a big concern, a more optimal 
> >> read-write lock scheme (e.g. TLRW) should be introduced into
> >rte_rwlock in the future.
> >
> >Something like this?
> >   eal/rwlocks: Try read/write and relock write to read locks added
> >   https://patches.dpdk.org/patch/40254/
> >
> >
>


[dpdk-dev] Please add commit c12d22f65b132c56db7b4fdbfd5ddce27d1e9572

2017-09-12 Thread ASM
Hi folks!

I found that the LTS version does not have the important commit
c12d22f65b132c56db7b4fdbfd5ddce27d1e9572
That I need do to add it to the LTS version?

---
Best regards,
Leonid Myravjev


[dpdk-dev] PCI memory sync (kvm,dpdk,e1000,packet stalled)

2019-11-20 Thread ASM
Hi folks!

I trying solve the problem, with packets stopping (e1000,tap,kvm).
My studies led to the following:
1. From flatview_write_continue() I see, what e1000 writes the number
"7" to the STAT register.
2. The driver from target OS reads STAT register with number "7" and
writes to the register the number "0".
3. From flatview_write_continue() (I make edits):
memcpy(ptr, buf, l);
new1=ptr[0xc];
usleep(100);
new2=ptr[0xc];
invalidate_and_set_dirty(mr, addr1, l);
new3=ptr[0xc];
printf("Old: %i, new1, %i, new2: %i, new3: %i\n", old,new1,new2,new3);

I see what memory in first printf is "7", but after usleep() is "0".
Do I understand correctly that this should not be? Or RCU lock
suggests the ability to the multiple writers?

The problem is that qemu(e1000) writes the number 7, after which
target(dpdk driver) reads 7, on the basis of this it writes the number
0, but as a result (extremely rarely), the value STATUS still remains
7. Therefore, packet processing is interrupted. This behavior is
observed only on kvm (it is not observed on tcg).

Please help with advice or ideas.

P.S. I started a bug report earlier. There is more detailed
information. In my broken English:
bugs.launchpad.net/qemu/+bug/1853123

---
Best regards,
Leonid Myravjev


[dpdk-dev] rte_reorder_free_mbufs function for librte_reorder

2016-05-18 Thread ASM
Hi folks.

I want to use stand alone rte_ring and rte_reorder library's.
Without mempool.

For rte_ring I can call rte_ring_get_memsize() function, alloc memory
by self and use rte_ring.
But reorder don't have rte_reorder_get_memsize. Struct
rte_reorder_buffer is private.

Furthermore, code have DRY (don't repeat yourself ) problem.
For example:
line 86: const unsigned int min_bufsize = sizeof(*b) +  (2 * size *
sizeof(struct rte_mbuf *));
line 132: const unsigned int bufsize = sizeof(struct
rte_reorder_buffer) +(2 * size * sizeof(struct rte_mbuf *));

Is it possible to add rte_reorder_get_memsize for librte_reorder?

Thanks.

---
Best regards,
Leonid Myravjev