From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH V3 1/2] xen-netback: limit xen vif max queues number to online cpus Date: Fri, 23 Oct 2015 10:51:59 +0100 Message-ID: <562A033F.10702__2834.51270447603$1445594004$gmane$org@citrix.com> References: <562A0108.3070501@oracle.com> <562A018C.9060708@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZpZ12-0004HI-SB for xen-devel@lists.xenproject.org; Fri, 23 Oct 2015 09:52:04 +0000 In-Reply-To: <562A018C.9060708@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Joe Jin , wei.liu2@citrix.com, Ian Campbell , Boris Ostrovsky , Konrad Rzeszutek Wilk , "David S. Miller" , Jan Beulich Cc: netdev@vger.kernel.org, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On 23/10/15 10:44, Joe Jin wrote: > Should not allocate xen vif queues number more than online cpus. > > Signed-off-by: Joe Jin > Cc: Jan Beulich > Cc: Wei Liu > Cc: Ian Campbell > Cc: Boris Ostrovsky > Cc: Konrad Rzeszutek Wilk > --- > drivers/net/xen-netback/netback.c | 28 ++++++++++++++++++++++------ > 1 files changed, 22 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c > index ec98d43..021dcb0 100644 > --- a/drivers/net/xen-netback/netback.c > +++ b/drivers/net/xen-netback/netback.c > @@ -68,7 +68,9 @@ unsigned int rx_stall_timeout_msecs = 60000; > module_param(rx_stall_timeout_msecs, uint, 0444); > > unsigned int xenvif_max_queues; > -module_param_named(max_queues, xenvif_max_queues, uint, 0644); > +static int xennet_set_max_queues(const char *val, struct kernel_param *kp); > +module_param_call(max_queues, xennet_set_max_queues, param_get_uint, > + &xenvif_max_queues, 0644); > MODULE_PARM_DESC(max_queues, > "Maximum number of queues per virtual interface"); > > @@ -107,6 +109,20 @@ static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue > u16 size, > u16 flags); > > +static int xennet_set_max_queues(const char *val, struct kernel_param *kp) > +{ > + unsigned int cpus = num_online_cpus(); This calculation is problematic in the scenario where a guest boots up, then has more cpus hotplugged in, then wants to set up a sensible number of queues. ~Andrew