Re: [RFC PATCH 04/10] xen: add reference counter support

2023-02-19 Thread Volodymyr Babchuk
Hi Jan, Jan Beulich writes: > On 17.02.2023 02:56, Volodymyr Babchuk wrote: >> Jan Beulich writes: >>> On 31.08.2022 16:10, Volodymyr Babchuk wrote: --- /dev/null +++ b/xen/include/xen/refcnt.h @@ -0,0 +1,28 @@ +#ifndef __XEN_REFCNT_H__ +#define __XEN_REFCNT_H__

Re: [RFC PATCH 04/10] xen: add reference counter support

2023-02-16 Thread Jan Beulich
On 17.02.2023 02:56, Volodymyr Babchuk wrote: > Jan Beulich writes: >> On 31.08.2022 16:10, Volodymyr Babchuk wrote: >>> --- /dev/null >>> +++ b/xen/include/xen/refcnt.h >>> @@ -0,0 +1,28 @@ >>> +#ifndef __XEN_REFCNT_H__ >>> +#define __XEN_REFCNT_H__ >>> + >>> +#include >>> + >>> +typedef atomic_

Re: [RFC PATCH 04/10] xen: add reference counter support

2023-02-16 Thread Volodymyr Babchuk
Hello Jan, Jan Beulich writes: > On 31.08.2022 16:10, Volodymyr Babchuk wrote: >> --- /dev/null >> +++ b/xen/include/xen/refcnt.h >> @@ -0,0 +1,28 @@ >> +#ifndef __XEN_REFCNT_H__ >> +#define __XEN_REFCNT_H__ >> + >> +#include >> + >> +typedef atomic_t refcnt_t; > > Like Linux has it, I think

Re: [RFC PATCH 04/10] xen: add reference counter support

2023-02-15 Thread Jan Beulich
On 31.08.2022 16:10, Volodymyr Babchuk wrote: > --- /dev/null > +++ b/xen/include/xen/refcnt.h > @@ -0,0 +1,28 @@ > +#ifndef __XEN_REFCNT_H__ > +#define __XEN_REFCNT_H__ > + > +#include > + > +typedef atomic_t refcnt_t; Like Linux has it, I think this would better be a separate struct. At least i

[RFC PATCH 04/10] xen: add reference counter support

2022-08-31 Thread Volodymyr Babchuk
We can use reference counter to ease up object lifetime management. This patch adds very basic support for reference counters. refcnt should be used in the following way: 1. Protected structure should have refcnt_t field 2. This field should be initialized with refcnt_init() during object constru