Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-15 Thread Oleksandr Andrushchenko
On 15.02.22 10:30, Roger Pau Monné wrote: > On Mon, Feb 14, 2022 at 02:00:26PM +, Oleksandr Andrushchenko wrote: >> /* >> * FIXME: apply_map is called from dom0 specific init code when >> * system_state < SYS_STATE_active, so there is no race condition >> * possible between this code and vpci

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-15 Thread Roger Pau Monné
On Mon, Feb 14, 2022 at 02:00:26PM +, Oleksandr Andrushchenko wrote: > /* > * FIXME: apply_map is called from dom0 specific init code when > * system_state < SYS_STATE_active, so there is no race condition > * possible between this code and vpci_process_pending. So, neither > * vpci_process_pen

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 16:31, Jan Beulich wrote: > On 14.02.2022 15:26, Oleksandr Andrushchenko wrote: >> >> On 14.02.22 16:19, Jan Beulich wrote: >>> On 09.02.2022 14:36, Oleksandr Andrushchenko wrote: @@ -410,14 +428,37 @@ static void vpci_write_helper(const struct pci_dev *pdev,

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Jan Beulich
On 14.02.2022 15:26, Oleksandr Andrushchenko wrote: > > > On 14.02.22 16:19, Jan Beulich wrote: >> On 09.02.2022 14:36, Oleksandr Andrushchenko wrote: >>> @@ -410,14 +428,37 @@ static void vpci_write_helper(const struct pci_dev >>> *pdev, >>>r->private); >>> } >>> >>> +stati

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 16:19, Jan Beulich wrote: > On 09.02.2022 14:36, Oleksandr Andrushchenko wrote: >> @@ -410,14 +428,37 @@ static void vpci_write_helper(const struct pci_dev >> *pdev, >>r->private); >> } >> >> +static bool vpci_header_write_lock(const struct pci_dev *pdev, >> +

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Jan Beulich
On 09.02.2022 14:36, Oleksandr Andrushchenko wrote: > @@ -410,14 +428,37 @@ static void vpci_write_helper(const struct pci_dev > *pdev, > r->private); > } > > +static bool vpci_header_write_lock(const struct pci_dev *pdev, > + unsigned int start,

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Jan Beulich
On 14.02.2022 15:00, Oleksandr Andrushchenko wrote: > /* > * FIXME: apply_map is called from dom0 specific init code when > * system_state < SYS_STATE_active, so there is no race condition > * possible between this code and vpci_process_pending. So, neither > * vpci_process_pending may try to acqui

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 15:48, Jan Beulich wrote: > On 14.02.2022 14:27, Oleksandr Andrushchenko wrote: >> >> On 14.02.22 15:22, Jan Beulich wrote: >>> On 14.02.2022 14:13, Oleksandr Andrushchenko wrote: On 14.02.22 14:57, Jan Beulich wrote: > On 14.02.2022 12:37, Oleksandr Andrushchenko wrote:

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Jan Beulich
On 14.02.2022 14:27, Oleksandr Andrushchenko wrote: > > > On 14.02.22 15:22, Jan Beulich wrote: >> On 14.02.2022 14:13, Oleksandr Andrushchenko wrote: >>> >>> On 14.02.22 14:57, Jan Beulich wrote: On 14.02.2022 12:37, Oleksandr Andrushchenko wrote: > On 14.02.22 13:25, Roger Pau Monné wr

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 15:22, Jan Beulich wrote: > On 14.02.2022 14:13, Oleksandr Andrushchenko wrote: >> >> On 14.02.22 14:57, Jan Beulich wrote: >>> On 14.02.2022 12:37, Oleksandr Andrushchenko wrote: On 14.02.22 13:25, Roger Pau Monné wrote: > On Mon, Feb 14, 2022 at 11:15:27AM +, Oleksandr

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Jan Beulich
On 14.02.2022 14:13, Oleksandr Andrushchenko wrote: > > > On 14.02.22 14:57, Jan Beulich wrote: >> On 14.02.2022 12:37, Oleksandr Andrushchenko wrote: >>> >>> On 14.02.22 13:25, Roger Pau Monné wrote: On Mon, Feb 14, 2022 at 11:15:27AM +, Oleksandr Andrushchenko wrote: > On 14.02.22

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 14:57, Jan Beulich wrote: > On 14.02.2022 12:37, Oleksandr Andrushchenko wrote: >> >> On 14.02.22 13:25, Roger Pau Monné wrote: >>> On Mon, Feb 14, 2022 at 11:15:27AM +, Oleksandr Andrushchenko wrote: On 14.02.22 13:11, Roger Pau Monné wrote: > On Mon, Feb 14, 2022 at 10:

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Jan Beulich
On 14.02.2022 12:37, Oleksandr Andrushchenko wrote: > > > On 14.02.22 13:25, Roger Pau Monné wrote: >> On Mon, Feb 14, 2022 at 11:15:27AM +, Oleksandr Andrushchenko wrote: >>> >>> On 14.02.22 13:11, Roger Pau Monné wrote: On Mon, Feb 14, 2022 at 10:53:43AM +, Oleksandr Andrushchenko

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 13:25, Roger Pau Monné wrote: > On Mon, Feb 14, 2022 at 11:15:27AM +, Oleksandr Andrushchenko wrote: >> >> On 14.02.22 13:11, Roger Pau Monné wrote: >>> On Mon, Feb 14, 2022 at 10:53:43AM +, Oleksandr Andrushchenko wrote: On 14.02.22 12:34, Roger Pau Monné wrote: > On

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Roger Pau Monné
On Mon, Feb 14, 2022 at 11:15:27AM +, Oleksandr Andrushchenko wrote: > > > On 14.02.22 13:11, Roger Pau Monné wrote: > > On Mon, Feb 14, 2022 at 10:53:43AM +, Oleksandr Andrushchenko wrote: > >> > >> On 14.02.22 12:34, Roger Pau Monné wrote: > >>> On Mon, Feb 14, 2022 at 09:36:39AM +,

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 13:11, Roger Pau Monné wrote: > On Mon, Feb 14, 2022 at 10:53:43AM +, Oleksandr Andrushchenko wrote: >> >> On 14.02.22 12:34, Roger Pau Monné wrote: >>> On Mon, Feb 14, 2022 at 09:36:39AM +, Oleksandr Andrushchenko wrote: On 11.02.22 13:40, Roger Pau Monné wrote: > +

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Roger Pau Monné
On Mon, Feb 14, 2022 at 10:53:43AM +, Oleksandr Andrushchenko wrote: > > > On 14.02.22 12:34, Roger Pau Monné wrote: > > On Mon, Feb 14, 2022 at 09:36:39AM +, Oleksandr Andrushchenko wrote: > >> > >> On 11.02.22 13:40, Roger Pau Monné wrote: > >>> + > >> for ( i = 0; i < msix-

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 12:34, Roger Pau Monné wrote: > On Mon, Feb 14, 2022 at 09:36:39AM +, Oleksandr Andrushchenko wrote: >> >> On 11.02.22 13:40, Roger Pau Monné wrote: >>> + >> for ( i = 0; i < msix->max_entries; i++ ) >> { >> const struct vpci_msix_entry *ent

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Roger Pau Monné
On Mon, Feb 14, 2022 at 09:36:39AM +, Oleksandr Andrushchenko wrote: > > > On 11.02.22 13:40, Roger Pau Monné wrote: > > + > for ( i = 0; i < msix->max_entries; i++ ) > { > const struct vpci_msix_entry *entry = &msix->entries[i]; > >>> Since this functi

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 11.02.22 13:40, Roger Pau Monné wrote: > + for ( i = 0; i < msix->max_entries; i++ ) { const struct vpci_msix_entry *entry = &msix->entries[i]; >>> Since this function is now called with the per-domain rwlock read >>> locked it's likely not appropriate t

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Oleksandr Andrushchenko
On 14.02.22 10:47, Roger Pau Monné wrote: > On Mon, Feb 14, 2022 at 06:33:07AM +, Oleksandr Andrushchenko wrote: >> >> On 11.02.22 17:44, Roger Pau Monné wrote: >>> On Fri, Feb 11, 2022 at 12:13:38PM +, Oleksandr Andrushchenko wrote: On 11.02.22 13:40, Roger Pau Monné wrote: > On

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-14 Thread Roger Pau Monné
On Mon, Feb 14, 2022 at 06:33:07AM +, Oleksandr Andrushchenko wrote: > > > On 11.02.22 17:44, Roger Pau Monné wrote: > > On Fri, Feb 11, 2022 at 12:13:38PM +, Oleksandr Andrushchenko wrote: > >> > >> On 11.02.22 13:40, Roger Pau Monné wrote: > >>> On Fri, Feb 11, 2022 at 07:27:39AM +,

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-13 Thread Oleksandr Andrushchenko
On 11.02.22 17:44, Roger Pau Monné wrote: > On Fri, Feb 11, 2022 at 12:13:38PM +, Oleksandr Andrushchenko wrote: >> >> On 11.02.22 13:40, Roger Pau Monné wrote: >>> On Fri, Feb 11, 2022 at 07:27:39AM +, Oleksandr Andrushchenko wrote: Hi, Roger! On 10.02.22 18:16, Roger Pau

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-11 Thread Roger Pau Monné
On Fri, Feb 11, 2022 at 12:13:38PM +, Oleksandr Andrushchenko wrote: > > > On 11.02.22 13:40, Roger Pau Monné wrote: > > On Fri, Feb 11, 2022 at 07:27:39AM +, Oleksandr Andrushchenko wrote: > >> Hi, Roger! > >> > >> On 10.02.22 18:16, Roger Pau Monné wrote: > >>> On Wed, Feb 09, 2022 at 0

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-11 Thread Oleksandr Andrushchenko
On 11.02.22 13:51, Roger Pau Monné wrote: > On Fri, Feb 11, 2022 at 08:46:59AM +, Oleksandr Andrushchenko wrote: >> >> On 10.02.22 18:16, Roger Pau Monné wrote: >>> On Wed, Feb 09, 2022 at 03:36:27PM +0200, Oleksandr Andrushchenko wrote: From: Oleksandr Andrushchenko Introduce

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-11 Thread Oleksandr Andrushchenko
On 11.02.22 13:40, Roger Pau Monné wrote: > On Fri, Feb 11, 2022 at 07:27:39AM +, Oleksandr Andrushchenko wrote: >> Hi, Roger! >> >> On 10.02.22 18:16, Roger Pau Monné wrote: >>> On Wed, Feb 09, 2022 at 03:36:27PM +0200, Oleksandr Andrushchenko wrote: From: Oleksandr Andrushchenko

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-11 Thread Roger Pau Monné
On Fri, Feb 11, 2022 at 08:46:59AM +, Oleksandr Andrushchenko wrote: > > > On 10.02.22 18:16, Roger Pau Monné wrote: > > On Wed, Feb 09, 2022 at 03:36:27PM +0200, Oleksandr Andrushchenko wrote: > >> From: Oleksandr Andrushchenko > >> > >> Introduce a per-domain read/write lock to check wheth

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-11 Thread Roger Pau Monné
On Fri, Feb 11, 2022 at 07:27:39AM +, Oleksandr Andrushchenko wrote: > Hi, Roger! > > On 10.02.22 18:16, Roger Pau Monné wrote: > > On Wed, Feb 09, 2022 at 03:36:27PM +0200, Oleksandr Andrushchenko wrote: > >> From: Oleksandr Andrushchenko > >> > >> Introduce a per-domain read/write lock to c

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-11 Thread Oleksandr Andrushchenko
On 10.02.22 18:16, Roger Pau Monné wrote: > On Wed, Feb 09, 2022 at 03:36:27PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Introduce a per-domain read/write lock to check whether vpci is present, >> so we are sure there are no accesses to the contents of the vpci

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-10 Thread Oleksandr Andrushchenko
Hi, Roger! On 10.02.22 18:16, Roger Pau Monné wrote: > On Wed, Feb 09, 2022 at 03:36:27PM +0200, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Introduce a per-domain read/write lock to check whether vpci is present, >> so we are sure there are no accesses to the contents o

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure

2022-02-10 Thread Roger Pau Monné
On Wed, Feb 09, 2022 at 03:36:27PM +0200, Oleksandr Andrushchenko wrote: > From: Oleksandr Andrushchenko > > Introduce a per-domain read/write lock to check whether vpci is present, > so we are sure there are no accesses to the contents of the vpci struct > if not. This lock can be used (and in a