Re: [PATCH v2 5/6] Add use of RCU for qemu_logfile.

2019-11-18 Thread Robert Foley
On Mon, 18 Nov 2019 at 11:41, Alex Bennée wrote: > > > >> > > OK, got it. > > We will need to make one other change to target/tilegx/translate.c > > since it conditionally unlocks depending on what qemu_log_lock() > > returns. > > Hmm I'd be tempted to drop the locking all together and drop the

Re: [PATCH v2 5/6] Add use of RCU for qemu_logfile.

2019-11-18 Thread Alex Bennée
Robert Foley writes: > On Mon, 18 Nov 2019 at 08:23, Alex Bennée wrote: >> >> >> Robert Foley writes: >> >> > On Mon, 18 Nov 2019 at 07:22, Alex Bennée wrote: >> >> >> >> >> >> > +if (logfile) { >> >> > +qemu_flockfile(logfile->fd); >> >> > +return logfile->fd; >> >> > +

Re: [PATCH v2 5/6] Add use of RCU for qemu_logfile.

2019-11-18 Thread Robert Foley
On Mon, 18 Nov 2019 at 08:23, Alex Bennée wrote: > > > Robert Foley writes: > > > On Mon, 18 Nov 2019 at 07:22, Alex Bennée wrote: > >> > >> > >> > +if (logfile) { > >> > +qemu_flockfile(logfile->fd); > >> > +return logfile->fd; > >> > +} else { > >> > +

Re: [PATCH v2 5/6] Add use of RCU for qemu_logfile.

2019-11-18 Thread Alex Bennée
Robert Foley writes: > On Mon, 18 Nov 2019 at 07:22, Alex Bennée wrote: >> >> >> > +if (logfile) { >> > +qemu_flockfile(logfile->fd); >> > +return logfile->fd; >> > +} else { >> > +rcu_read_unlock(); >> >> As qemu_log_lock() and unlock should be paired we can

Re: [PATCH v2 5/6] Add use of RCU for qemu_logfile.

2019-11-18 Thread Robert Foley
On Mon, 18 Nov 2019 at 07:22, Alex Bennée wrote: > > > > +if (logfile) { > > +qemu_flockfile(logfile->fd); > > +return logfile->fd; > > +} else { > > +rcu_read_unlock(); > > As qemu_log_lock() and unlock should be paired we can drop the unlock > here and do an

Re: [PATCH v2 5/6] Add use of RCU for qemu_logfile.

2019-11-18 Thread Alex Bennée
Robert Foley writes: > This now allows changing the logfile while logging is active, > and also solves the issue of a seg fault while changing the logfile. > > Any read access to the qemu_logfile handle will use > the rcu_read_lock()/unlock() around the use of the handle. > To fetch the handle

[PATCH v2 5/6] Add use of RCU for qemu_logfile.

2019-11-15 Thread Robert Foley
This now allows changing the logfile while logging is active, and also solves the issue of a seg fault while changing the logfile. Any read access to the qemu_logfile handle will use the rcu_read_lock()/unlock() around the use of the handle. To fetch the handle we will use atomic_rcu_read(). We