Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Paul E. McKenney
On Mon, Jul 22, 2019 at 12:32:17PM -0400, Michael S. Tsirkin wrote: > On Mon, Jul 22, 2019 at 09:25:51AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 22, 2019 at 12:13:40PM -0400, Michael S. Tsirkin wrote: > > > On Mon, Jul 22, 2019 at 08:55:34AM -0700, Paul E. McKenney wrote: > > > > On Mon,

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 09:25:51AM -0700, Paul E. McKenney wrote: > On Mon, Jul 22, 2019 at 12:13:40PM -0400, Michael S. Tsirkin wrote: > > On Mon, Jul 22, 2019 at 08:55:34AM -0700, Paul E. McKenney wrote: > > > On Mon, Jul 22, 2019 at 11:47:24AM -0400, Michael S. Tsirkin wrote: > > > > On Mon,

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Paul E. McKenney
On Mon, Jul 22, 2019 at 12:13:40PM -0400, Michael S. Tsirkin wrote: > On Mon, Jul 22, 2019 at 08:55:34AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 22, 2019 at 11:47:24AM -0400, Michael S. Tsirkin wrote: > > > On Mon, Jul 22, 2019 at 11:14:39AM -0400, Joel Fernandes wrote: > > > > [snip] > > >

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Paul E. McKenney
On Mon, Jul 22, 2019 at 01:04:48PM -0300, Jason Gunthorpe wrote: > On Mon, Jul 22, 2019 at 08:52:35AM -0700, Paul E. McKenney wrote: > > So why then is there a problem? > > I'm not sure there is a real problem, I thought Michael was just > asking how to design with RCU in the case where the user

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 01:04:48PM -0300, Jason Gunthorpe wrote: > On Mon, Jul 22, 2019 at 08:52:35AM -0700, Paul E. McKenney wrote: > > So why then is there a problem? > > I'm not sure there is a real problem, I thought Michael was just > asking how to design with RCU in the case where the user

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 08:55:34AM -0700, Paul E. McKenney wrote: > On Mon, Jul 22, 2019 at 11:47:24AM -0400, Michael S. Tsirkin wrote: > > On Mon, Jul 22, 2019 at 11:14:39AM -0400, Joel Fernandes wrote: > > > [snip] > > > > > Would it make sense to have call_rcu() check to see if there are many >

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Jason Gunthorpe
On Mon, Jul 22, 2019 at 08:52:35AM -0700, Paul E. McKenney wrote: > So why then is there a problem? I'm not sure there is a real problem, I thought Michael was just asking how to design with RCU in the case where the user controls the kfree_rcu?? Sounds like the answer is "don't worry about it"

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Paul E. McKenney
On Mon, Jul 22, 2019 at 11:47:24AM -0400, Michael S. Tsirkin wrote: > On Mon, Jul 22, 2019 at 11:14:39AM -0400, Joel Fernandes wrote: > > [snip] > > > > Would it make sense to have call_rcu() check to see if there are many > > > > outstanding requests on this CPU and if so process them before > >

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Paul E. McKenney
On Mon, Jul 22, 2019 at 10:41:52AM -0300, Jason Gunthorpe wrote: > On Mon, Jul 22, 2019 at 04:51:49AM -0700, Paul E. McKenney wrote: > > > > > > Would it make sense to have call_rcu() check to see if there are many > > > > > outstanding requests on this CPU and if so process them before > > > >

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Michael S. Tsirkin
On Mon, Jul 22, 2019 at 11:14:39AM -0400, Joel Fernandes wrote: > [snip] > > > Would it make sense to have call_rcu() check to see if there are many > > > outstanding requests on this CPU and if so process them before returning? > > > That would ensure that frequent callers usually ended up doing

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Joel Fernandes
[snip] > > Would it make sense to have call_rcu() check to see if there are many > > outstanding requests on this CPU and if so process them before returning? > > That would ensure that frequent callers usually ended up doing their > > own processing. Other than what Paul already mentioned about

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Jason Gunthorpe
On Mon, Jul 22, 2019 at 04:51:49AM -0700, Paul E. McKenney wrote: > > > > Would it make sense to have call_rcu() check to see if there are many > > > > outstanding requests on this CPU and if so process them before > > > > returning? > > > > That would ensure that frequent callers usually ended

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Paul E. McKenney
On Mon, Jul 22, 2019 at 03:56:22AM -0400, Michael S. Tsirkin wrote: > On Sun, Jul 21, 2019 at 12:28:41PM -0700, Paul E. McKenney wrote: > > On Sun, Jul 21, 2019 at 01:53:23PM -0400, Michael S. Tsirkin wrote: > > > On Sun, Jul 21, 2019 at 06:17:25AM -0700, Paul E. McKenney wrote: > > > > On Sun,

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Paul E. McKenney
On Mon, Jul 22, 2019 at 03:52:05AM -0400, Michael S. Tsirkin wrote: > On Sun, Jul 21, 2019 at 04:31:13PM -0700, Paul E. McKenney wrote: > > On Sun, Jul 21, 2019 at 02:08:37PM -0700, Matthew Wilcox wrote: > > > On Sun, Jul 21, 2019 at 06:17:25AM -0700, Paul E. McKenney wrote: > > > > Also, the

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Michael S. Tsirkin
On Sun, Jul 21, 2019 at 12:28:41PM -0700, Paul E. McKenney wrote: > On Sun, Jul 21, 2019 at 01:53:23PM -0400, Michael S. Tsirkin wrote: > > On Sun, Jul 21, 2019 at 06:17:25AM -0700, Paul E. McKenney wrote: > > > On Sun, Jul 21, 2019 at 08:28:05AM -0400, Michael S. Tsirkin wrote: > > > > Hi Paul,

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-22 Thread Michael S. Tsirkin
On Sun, Jul 21, 2019 at 04:31:13PM -0700, Paul E. McKenney wrote: > On Sun, Jul 21, 2019 at 02:08:37PM -0700, Matthew Wilcox wrote: > > On Sun, Jul 21, 2019 at 06:17:25AM -0700, Paul E. McKenney wrote: > > > Also, the overhead is important. For example, as far as I know, > > > current RCU

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-21 Thread Paul E. McKenney
On Sun, Jul 21, 2019 at 02:08:37PM -0700, Matthew Wilcox wrote: > On Sun, Jul 21, 2019 at 06:17:25AM -0700, Paul E. McKenney wrote: > > Also, the overhead is important. For example, as far as I know, > > current RCU gracefully handles close(open(...)) in a tight userspace > > loop. But there

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-21 Thread Matthew Wilcox
On Sun, Jul 21, 2019 at 06:17:25AM -0700, Paul E. McKenney wrote: > Also, the overhead is important. For example, as far as I know, > current RCU gracefully handles close(open(...)) in a tight userspace > loop. But there might be trouble due to tight userspace loops around > lighter-weight

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-21 Thread Paul E. McKenney
On Sun, Jul 21, 2019 at 01:53:23PM -0400, Michael S. Tsirkin wrote: > On Sun, Jul 21, 2019 at 06:17:25AM -0700, Paul E. McKenney wrote: > > On Sun, Jul 21, 2019 at 08:28:05AM -0400, Michael S. Tsirkin wrote: > > > Hi Paul, others, > > > > > > So it seems that vhost needs to call kfree_rcu from an

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-21 Thread Michael S. Tsirkin
On Sun, Jul 21, 2019 at 06:17:25AM -0700, Paul E. McKenney wrote: > On Sun, Jul 21, 2019 at 08:28:05AM -0400, Michael S. Tsirkin wrote: > > Hi Paul, others, > > > > So it seems that vhost needs to call kfree_rcu from an ioctl. My worry > > is what happens if userspace starts cycling through lots

Re: RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-21 Thread Paul E. McKenney
On Sun, Jul 21, 2019 at 08:28:05AM -0400, Michael S. Tsirkin wrote: > Hi Paul, others, > > So it seems that vhost needs to call kfree_rcu from an ioctl. My worry > is what happens if userspace starts cycling through lots of these > ioctls. Given we actually use rcu as an optimization, we could

RFC: call_rcu_outstanding (was Re: WARNING in __mmdrop)

2019-07-21 Thread Michael S. Tsirkin
Hi Paul, others, So it seems that vhost needs to call kfree_rcu from an ioctl. My worry is what happens if userspace starts cycling through lots of these ioctls. Given we actually use rcu as an optimization, we could just disable the optimization temporarily - but the question would be how to