From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH 1/2] xen-netback: limit xen vif max queues number to online cpus Date: Fri, 23 Oct 2015 02:20:24 -0600 Message-ID: <562A09E802000078000ADDE7__32444.3692261868$1445588520$gmane$org@prv-mh.provo.novell.com> References: <5629E796.5040203@oracle.com> <5629E8AF.9020108@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZpXaO-0002na-6q for xen-devel@lists.xenproject.org; Fri, 23 Oct 2015 08:20:28 +0000 In-Reply-To: <5629E8AF.9020108@oracle.com> Content-Disposition: inline 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 Cc: wei.liu2@citrix.com, Ian Campbell , netdev@vger.kernel.org, xen-devel@lists.xenproject.org, Boris Ostrovsky , "David S. Miller" List-Id: xen-devel@lists.xenproject.org >>> On 23.10.15 at 09:58, wrote: > --- 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_int, param_get_uint > + &xenvif_max_queues, 0600); Why the change from mode 0644 to 0600? > @@ -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(); > + unsigned int max_queues = simple_strtoul(val, NULL, 10); > + > + if (max_queues == 0 || max_queues > cpus) { > + pr_info("max_queues %d is out of range [0 - %d]!\n", %u in both cases. > + max_queues, cpus); > + return -EINVAL; Considering the message: -ERANGE? > + } > + > + return param_set_int(val, kp); param_set_uint() > @@ -2110,15 +2126,15 @@ int xenvif_dealloc_kthread(void *data) > static int __init netback_init(void) > { > int rc = 0; > + unsigned int cpus = num_online_cpus(); > > if (!xen_domain()) > return -ENODEV; > > - /* Allow as many queues as there are CPUs if user has not > - * specified a value. > - */ > - if (xenvif_max_queues == 0) > - xenvif_max_queues = num_online_cpus(); > + /* Allow at most as many queues as CPUs. */ > + if (xenvif_max_queues == 0 || xenvif_max_queues > cpus) > + xenvif_max_queues = cpus; > + pr_info("vif max_queues: %d\n", xenvif_max_queues); %u again. Jan