[net-next PATCH V2] virtio-net: switch to use XPS to choose txq

2013-09-30 Thread Jason Wang
We used to use a percpu structure vq_index to record the cpu to queue
mapping, this is suboptimal since it duplicates the work of XPS and
loses all other XPS functionality such as allowing use to configure
their own transmission steering strategy.

So this patch switches to use XPS and suggest a default mapping when
the number of cpus is equal to the number of queues. With XPS support,
there's no need for keeping per-cpu vq_index and .ndo_select_queue(),
so they were removed also.

Cc: Rusty Russell ru...@rustcorp.com.au
Cc: Michael S. Tsirkin m...@redhat.com
Signed-off-by: Jason Wang jasow...@redhat.com
---
Changes from V1:
- use cpumask_of() instead of allocate dynamically

 drivers/net/virtio_net.c |   48 +
 1 files changed, 2 insertions(+), 46 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index defec2b..4eca652 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -127,9 +127,6 @@ struct virtnet_info {
/* Does the affinity hint is set for virtqueues? */
bool affinity_hint_set;
 
-   /* Per-cpu variable to show the mapping from CPU to virtqueue */
-   int __percpu *vq_index;
-
/* CPU hot plug notifier */
struct notifier_block nb;
 };
@@ -1063,7 +1060,6 @@ static int virtnet_vlan_rx_kill_vid(struct net_device 
*dev,
 static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu)
 {
int i;
-   int cpu;
 
if (vi-affinity_hint_set) {
for (i = 0; i  vi-max_queue_pairs; i++) {
@@ -1073,16 +1069,6 @@ static void virtnet_clean_affinity(struct virtnet_info 
*vi, long hcpu)
 
vi-affinity_hint_set = false;
}
-
-   i = 0;
-   for_each_online_cpu(cpu) {
-   if (cpu == hcpu) {
-   *per_cpu_ptr(vi-vq_index, cpu) = -1;
-   } else {
-   *per_cpu_ptr(vi-vq_index, cpu) =
-   ++i % vi-curr_queue_pairs;
-   }
-   }
 }
 
 static void virtnet_set_affinity(struct virtnet_info *vi)
@@ -1104,7 +1090,7 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
for_each_online_cpu(cpu) {
virtqueue_set_affinity(vi-rq[i].vq, cpu);
virtqueue_set_affinity(vi-sq[i].vq, cpu);
-   *per_cpu_ptr(vi-vq_index, cpu) = i;
+   netif_set_xps_queue(vi-dev, cpumask_of(cpu), i);
i++;
}
 
@@ -1217,28 +1203,6 @@ static int virtnet_change_mtu(struct net_device *dev, 
int new_mtu)
return 0;
 }
 
-/* To avoid contending a lock hold by a vcpu who would exit to host, select the
- * txq based on the processor id.
- */
-static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb)
-{
-   int txq;
-   struct virtnet_info *vi = netdev_priv(dev);
-
-   if (skb_rx_queue_recorded(skb)) {
-   txq = skb_get_rx_queue(skb);
-   } else {
-   txq = *__this_cpu_ptr(vi-vq_index);
-   if (txq == -1)
-   txq = 0;
-   }
-
-   while (unlikely(txq = dev-real_num_tx_queues))
-   txq -= dev-real_num_tx_queues;
-
-   return txq;
-}
-
 static const struct net_device_ops virtnet_netdev = {
.ndo_open= virtnet_open,
.ndo_stop= virtnet_close,
@@ -1250,7 +1214,6 @@ static const struct net_device_ops virtnet_netdev = {
.ndo_get_stats64 = virtnet_stats,
.ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
-   .ndo_select_queue = virtnet_select_queue,
 #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = virtnet_netpoll,
 #endif
@@ -1559,10 +1522,6 @@ static int virtnet_probe(struct virtio_device *vdev)
if (vi-stats == NULL)
goto free;
 
-   vi-vq_index = alloc_percpu(int);
-   if (vi-vq_index == NULL)
-   goto free_stats;
-
mutex_init(vi-config_lock);
vi-config_enable = true;
INIT_WORK(vi-config_work, virtnet_config_changed_work);
@@ -1589,7 +1548,7 @@ static int virtnet_probe(struct virtio_device *vdev)
/* Allocate/initialize the rx/tx queues, and invoke find_vqs */
err = init_vqs(vi);
if (err)
-   goto free_index;
+   goto free_stats;
 
netif_set_real_num_tx_queues(dev, 1);
netif_set_real_num_rx_queues(dev, 1);
@@ -1640,8 +1599,6 @@ free_recv_bufs:
 free_vqs:
cancel_delayed_work_sync(vi-refill);
virtnet_del_vqs(vi);
-free_index:
-   free_percpu(vi-vq_index);
 free_stats:
free_percpu(vi-stats);
 free:
@@ -1678,7 +1635,6 @@ static void virtnet_remove(struct virtio_device *vdev)
 
flush_work(vi-config_work);
 
-   free_percpu(vi-vq_index);
free_percpu(vi-stats);
free_netdev(vi-dev);
 }
-- 
1.7.1

___

Re: [net-next PATCH V2] virtio-net: switch to use XPS to choose txq

2013-09-30 Thread Michael S. Tsirkin
On Mon, Sep 30, 2013 at 03:37:17PM +0800, Jason Wang wrote:
 We used to use a percpu structure vq_index to record the cpu to queue
 mapping, this is suboptimal since it duplicates the work of XPS and
 loses all other XPS functionality such as allowing use to configure
 their own transmission steering strategy.
 
 So this patch switches to use XPS and suggest a default mapping when
 the number of cpus is equal to the number of queues. With XPS support,
 there's no need for keeping per-cpu vq_index and .ndo_select_queue(),
 so they were removed also.
 
 Cc: Rusty Russell ru...@rustcorp.com.au
 Cc: Michael S. Tsirkin m...@redhat.com
 Signed-off-by: Jason Wang jasow...@redhat.com

Acked-by: Michael S. Tsirkin m...@redhat.com

 ---
 Changes from V1:
 - use cpumask_of() instead of allocate dynamically
 
  drivers/net/virtio_net.c |   48 +
  1 files changed, 2 insertions(+), 46 deletions(-)
 
 diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
 index defec2b..4eca652 100644
 --- a/drivers/net/virtio_net.c
 +++ b/drivers/net/virtio_net.c
 @@ -127,9 +127,6 @@ struct virtnet_info {
   /* Does the affinity hint is set for virtqueues? */
   bool affinity_hint_set;
  
 - /* Per-cpu variable to show the mapping from CPU to virtqueue */
 - int __percpu *vq_index;
 -
   /* CPU hot plug notifier */
   struct notifier_block nb;
  };
 @@ -1063,7 +1060,6 @@ static int virtnet_vlan_rx_kill_vid(struct net_device 
 *dev,
  static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu)
  {
   int i;
 - int cpu;
  
   if (vi-affinity_hint_set) {
   for (i = 0; i  vi-max_queue_pairs; i++) {
 @@ -1073,16 +1069,6 @@ static void virtnet_clean_affinity(struct virtnet_info 
 *vi, long hcpu)
  
   vi-affinity_hint_set = false;
   }
 -
 - i = 0;
 - for_each_online_cpu(cpu) {
 - if (cpu == hcpu) {
 - *per_cpu_ptr(vi-vq_index, cpu) = -1;
 - } else {
 - *per_cpu_ptr(vi-vq_index, cpu) =
 - ++i % vi-curr_queue_pairs;
 - }
 - }
  }
  
  static void virtnet_set_affinity(struct virtnet_info *vi)
 @@ -1104,7 +1090,7 @@ static void virtnet_set_affinity(struct virtnet_info 
 *vi)
   for_each_online_cpu(cpu) {
   virtqueue_set_affinity(vi-rq[i].vq, cpu);
   virtqueue_set_affinity(vi-sq[i].vq, cpu);
 - *per_cpu_ptr(vi-vq_index, cpu) = i;
 + netif_set_xps_queue(vi-dev, cpumask_of(cpu), i);
   i++;
   }
  
 @@ -1217,28 +1203,6 @@ static int virtnet_change_mtu(struct net_device *dev, 
 int new_mtu)
   return 0;
  }
  
 -/* To avoid contending a lock hold by a vcpu who would exit to host, select 
 the
 - * txq based on the processor id.
 - */
 -static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb)
 -{
 - int txq;
 - struct virtnet_info *vi = netdev_priv(dev);
 -
 - if (skb_rx_queue_recorded(skb)) {
 - txq = skb_get_rx_queue(skb);
 - } else {
 - txq = *__this_cpu_ptr(vi-vq_index);
 - if (txq == -1)
 - txq = 0;
 - }
 -
 - while (unlikely(txq = dev-real_num_tx_queues))
 - txq -= dev-real_num_tx_queues;
 -
 - return txq;
 -}
 -
  static const struct net_device_ops virtnet_netdev = {
   .ndo_open= virtnet_open,
   .ndo_stop= virtnet_close,
 @@ -1250,7 +1214,6 @@ static const struct net_device_ops virtnet_netdev = {
   .ndo_get_stats64 = virtnet_stats,
   .ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
   .ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
 - .ndo_select_queue = virtnet_select_queue,
  #ifdef CONFIG_NET_POLL_CONTROLLER
   .ndo_poll_controller = virtnet_netpoll,
  #endif
 @@ -1559,10 +1522,6 @@ static int virtnet_probe(struct virtio_device *vdev)
   if (vi-stats == NULL)
   goto free;
  
 - vi-vq_index = alloc_percpu(int);
 - if (vi-vq_index == NULL)
 - goto free_stats;
 -
   mutex_init(vi-config_lock);
   vi-config_enable = true;
   INIT_WORK(vi-config_work, virtnet_config_changed_work);
 @@ -1589,7 +1548,7 @@ static int virtnet_probe(struct virtio_device *vdev)
   /* Allocate/initialize the rx/tx queues, and invoke find_vqs */
   err = init_vqs(vi);
   if (err)
 - goto free_index;
 + goto free_stats;
  
   netif_set_real_num_tx_queues(dev, 1);
   netif_set_real_num_rx_queues(dev, 1);
 @@ -1640,8 +1599,6 @@ free_recv_bufs:
  free_vqs:
   cancel_delayed_work_sync(vi-refill);
   virtnet_del_vqs(vi);
 -free_index:
 - free_percpu(vi-vq_index);
  free_stats:
   free_percpu(vi-stats);
  free:
 @@ -1678,7 +1635,6 @@ static void virtnet_remove(struct virtio_device *vdev)
  
   flush_work(vi-config_work);
  
 - free_percpu(vi-vq_index);
   

CFP: WorldCIST'14 - World Conference on IST, at Madeira Island

2013-09-30 Thread Maria Lemos
Apologies if you are receiving this mail more than once...


**
 WorldCIST'14
The 2014 World Conference on Information Systems and Technologies
April 15 - 18, Madeira Island, Portugal
   http://www.aisti.eu/worldcist14/
**

The 2014 World Conference on Information Systems and Technologies 
(WorldCIST'14: http://www.aisti.eu/worldcist14) is a global forum for 
researchers and practitioners to present and discuss the most recent 
innovations, trends, results, experiences and concerns in the several 
perspectives of Information Systems and Technologies.

We are pleased to invite you to submit your papers to WorldCISTI'14. All 
submissions will be reviewed on the basis of relevance, originality, importance 
and clarity.

 
THEMES

Submitted papers should be related with one or more of the main themes proposed 
for the Conference:

A) Information and Knowledge Management (IKM);

B) Organizational Models and Information Systems (OMIS);

C) Intelligent and Decision Support Systems (IDSS);

D) Software Systems, Architectures, Applications and Tools (SSAAT);

E) Computer Networks, Mobility and Pervasive Systems (CNMPS);

F) Human-Computer Interaction (HCI);

G) Health Informatics (HIS);

H) Information Technologies in Education (ITE).


TYPES OF SUBMISSIONS AND DECISIONS

Four types of papers can be submitted:

Full paper: Finished or consolidated RD works, to be included in one of the 
Conference themes. These papers are assigned a 10-page limit.

Short paper: Ongoing works with relevant preliminary results, open to 
discussion. These papers are assigned a 7-page limit.

Poster paper: Initial work with relevant ideas, open to discussion. These 
papers are assigned to a 4-page limit.

Company paper: Companies' papers that show practical experience, R  D, tools, 
etc., focused on some topics of the conference. These papers are assigned to a 
4-page limit.

Submitted papers must comply with the format of Advances in Intelligent Systems 
and Computing Series (see Instructions for Authors at Springer Website or 
download a DOC example) be written in English, must not have been published 
before, not be under review for any other conference or publication and not 
include any information leading to the authors’ identification. Therefore, the 
authors’ names, affiliations and bibliographic references should not be 
included in the version for evaluation by the Program Committee. This 
information should only be included in the camera-ready version, saved in Word 
or Latex format and also in PDF format. These files must be accompanied by the 
Consent to Publication form filled out, in a ZIP file, and uploaded at the 
conference management system.

All papers will be subjected to a “double-blind review” by at least two members 
of the Program Committee.

Based on Program Committee evaluation, a paper can be rejected or accepted by 
the Conference Chairs. In the later case, it can be accepted as the type 
originally submitted or as another type. Thus, full papers can be accepted as 
short papers or poster papers only. Similarly, short papers can be accepted as 
poster papers only. In these cases, the authors will be allowed to maintain the 
original number of pages in the camera-ready version.

The authors of accepted poster papers must also build and print a poster to be 
exhibited during the Conference. This poster must follow an A1 or A2 vertical 
format. The Conference includes Work Sessions where these posters are presented 
and orally discussed, with a 5 minute limit per poster.

The authors of accepted full papers will have 15 minutes to present their work 
in a Conference Work Session; approximately 5 minutes of discussion will follow 
each presentation. The authors of accepted short papers and company papers will 
have 11 minutes to present their work in a Conference Work Session; 
approximately 4 minutes of discussion will follow each presentation.


PUBLICATION AND INDEXING

To ensure that a full paper, short paper, poster paper or company paper is 
published in the Proceedings, at least one of the authors must be fully 
registered by the 24th of January 2014, and the paper must comply with the 
suggested layout and page-limit. Additionally, all recommended changes must be 
addressed by the authors before they submit the camera-ready version.

No more than one paper per registration will be published in the Conference 
Proceedings. An extra fee must be paid for publication of additional papers, 
with a maximum of one additional paper per registration.

Full and short papers will be published in Proceedings by Springer, in Advances 
in Intelligent Systems and Computing Series. Poster and company papers will be 
published in Proceedings by AISTI.

Published full and short papers will be submitted 

Re: [net-next PATCH V2] virtio-net: switch to use XPS to choose txq

2013-09-30 Thread Rusty Russell
Michael S. Tsirkin m...@redhat.com writes:
 On Mon, Sep 30, 2013 at 03:37:17PM +0800, Jason Wang wrote:
 We used to use a percpu structure vq_index to record the cpu to queue
 mapping, this is suboptimal since it duplicates the work of XPS and
 loses all other XPS functionality such as allowing use to configure
 their own transmission steering strategy.
 
 So this patch switches to use XPS and suggest a default mapping when
 the number of cpus is equal to the number of queues. With XPS support,
 there's no need for keeping per-cpu vq_index and .ndo_select_queue(),
 so they were removed also.
 
 Cc: Rusty Russell ru...@rustcorp.com.au
 Cc: Michael S. Tsirkin m...@redhat.com
 Signed-off-by: Jason Wang jasow...@redhat.com

 Acked-by: Michael S. Tsirkin m...@redhat.com

Acked-by: Rusty Russell ru...@rustcorp.com.au

Dave, please apply.

Cheers,
Rusty.
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: [net-next PATCH V2] virtio-net: switch to use XPS to choose txq

2013-09-30 Thread David Miller
From: Jason Wang jasow...@redhat.com
Date: Mon, 30 Sep 2013 15:37:17 +0800

 We used to use a percpu structure vq_index to record the cpu to queue
 mapping, this is suboptimal since it duplicates the work of XPS and
 loses all other XPS functionality such as allowing use to configure
 their own transmission steering strategy.
 
 So this patch switches to use XPS and suggest a default mapping when
 the number of cpus is equal to the number of queues. With XPS support,
 there's no need for keeping per-cpu vq_index and .ndo_select_queue(),
 so they were removed also.
 
 Cc: Rusty Russell ru...@rustcorp.com.au
 Cc: Michael S. Tsirkin m...@redhat.com
 Signed-off-by: Jason Wang jasow...@redhat.com
 ---
 Changes from V1:
 - use cpumask_of() instead of allocate dynamically

This generates build warnings:

drivers/net/virtio_net.c: In function ‘virtnet_set_affinity’:
drivers/net/virtio_net.c:1093:3: warning: passing argument 2 of 
‘netif_set_xps_queue’ discards ‘const’ qualifier from pointer target type 
[enabled by default]
In file included from drivers/net/virtio_net.c:20:0:
include/linux/netdevice.h:2275:5: note: expected ‘struct cpumask *’ but 
argument is of type ‘const struct cpumask *’
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization