search for: this_cpu_ptr

Displaying 20 results from an estimated 304 matches for "this_cpu_ptr".

2020 Feb 05
0
[PATCH] x86/mm/kmmio: Use this_cpu_ptr() instead get_cpu_var() for kmmio_ctx
Both call sites, that access kmmio_ctx, access kmmio_ctx with interrupts disabled. There is no need to use get_cpu_var() which additionally disables preemption. Use this_cpu_ptr() to access the kmmio_ctx variable of the current CPU. Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de> --- arch/x86/mm/kmmio.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c index 49d7814b59a9b..99...
2019 Jul 22
0
[vhost:linux-next 4/5] kernel/rcu/tiny.c:138:22: error: 'rcu_data' undeclared
...de/linux/wait.h:9, from include/linux/completion.h:12, from kernel/rcu/tiny.c:12: kernel/rcu/tiny.c: In function 'call_rcu_outstanding': >> kernel/rcu/tiny.c:138:22: error: 'rcu_data' undeclared (first use in this function) rdp = this_cpu_ptr(&rcu_data); ^ include/linux/percpu-defs.h:220:47: note: in definition of macro '__verify_pcpu_ptr' const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ ^~~ >> include/linux/percpu-defs.h:2...
2013 Aug 21
1
[PATCH-v3 1/4] idr: Percpu ida
...ourse). > + * > + * Will not fail if passed __GFP_WAIT. > + */ > +int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp) > +{ > + DEFINE_WAIT(wait); > + struct percpu_ida_cpu *tags; > + unsigned long flags; > + int tag; > + > + local_irq_save(flags); > + tags = this_cpu_ptr(pool->tag_cpu); You could drop this_cpu_ptr if you pass pool->tag_cpu to alloc_local_tag. > +/** > + * percpu_ida_free - free a tag > + * @pool: pool @tag was allocated from > + * @tag: a tag previously allocated with percpu_ida_alloc() > + * > + * Safe to be called from i...
2013 Aug 21
1
[PATCH-v3 1/4] idr: Percpu ida
...ourse). > + * > + * Will not fail if passed __GFP_WAIT. > + */ > +int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp) > +{ > + DEFINE_WAIT(wait); > + struct percpu_ida_cpu *tags; > + unsigned long flags; > + int tag; > + > + local_irq_save(flags); > + tags = this_cpu_ptr(pool->tag_cpu); You could drop this_cpu_ptr if you pass pool->tag_cpu to alloc_local_tag. > +/** > + * percpu_ida_free - free a tag > + * @pool: pool @tag was allocated from > + * @tag: a tag previously allocated with percpu_ida_alloc() > + * > + * Safe to be called from i...
2012 Jun 05
1
[net-next RFC PATCH] virtio_net: collect satistics and export through ethtool
...o { struct virtio_device *vdev; struct virtqueue *rvq, *svq, *cvq; @@ -142,6 +171,11 @@ static struct page *get_a_page(struct virtnet_info *vi, gfp_t gfp_mask) static void skb_xmit_done(struct virtqueue *svq) { struct virtnet_info *vi = svq->vdev->priv; + struct virtnet_stats *stats = this_cpu_ptr(vi->stats); + + u64_stats_update_begin(&stats->syncp); + stats->tx_callbacks++; + u64_stats_update_end(&stats->syncp); /* Suppress further interrupts. */ virtqueue_disable_cb(svq); @@ -461,6 +495,7 @@ static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) { int e...
2012 Jun 05
1
[net-next RFC PATCH] virtio_net: collect satistics and export through ethtool
...o { struct virtio_device *vdev; struct virtqueue *rvq, *svq, *cvq; @@ -142,6 +171,11 @@ static struct page *get_a_page(struct virtnet_info *vi, gfp_t gfp_mask) static void skb_xmit_done(struct virtqueue *svq) { struct virtnet_info *vi = svq->vdev->priv; + struct virtnet_stats *stats = this_cpu_ptr(vi->stats); + + u64_stats_update_begin(&stats->syncp); + stats->tx_callbacks++; + u64_stats_update_end(&stats->syncp); /* Suppress further interrupts. */ virtqueue_disable_cb(svq); @@ -461,6 +495,7 @@ static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) { int e...
2020 Sep 15
0
[PATCH RFC v1 06/18] x86/hyperv: allocate output arg pages if required
...x); > > @@ -75,14 +78,29 @@ static int hv_cpu_init(unsigned int cpu) > u64 msr_vp_index; > struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id()]; > void **input_arg; > - struct page *pg; > + struct page *input_pg; > > input_arg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg); > /* hv_cpu_init() can be called with IRQs disabled from hv_resume() */ > - pg = alloc_page(irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); > - if (unlikely(!pg)) > + input_pg = alloc_page(irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); > + if (unlikely(!input_pg))...
2011 Jun 15
3
[PATCH] virtio-net: per cpu 64 bit stats
...turn -EINVAL; } + if (len > PAGE_SIZE) len = PAGE_SIZE; @@ -230,6 +242,7 @@ static int receive_mergeable(struct virt static void receive_buf(struct net_device *dev, void *buf, unsigned int len) { struct virtnet_info *vi = netdev_priv(dev); + struct virtnet_stats __percpu *stats = this_cpu_ptr(vi->stats); struct sk_buff *skb; struct page *page; struct skb_vnet_hdr *hdr; @@ -265,8 +278,11 @@ static void receive_buf(struct net_devic hdr = skb_vnet_hdr(skb); skb->truesize += skb->data_len; - dev->stats.rx_bytes += skb->len; - dev->stats.rx_packets++; + + u64_st...
2011 Jun 15
3
[PATCH] virtio-net: per cpu 64 bit stats
...turn -EINVAL; } + if (len > PAGE_SIZE) len = PAGE_SIZE; @@ -230,6 +242,7 @@ static int receive_mergeable(struct virt static void receive_buf(struct net_device *dev, void *buf, unsigned int len) { struct virtnet_info *vi = netdev_priv(dev); + struct virtnet_stats __percpu *stats = this_cpu_ptr(vi->stats); struct sk_buff *skb; struct page *page; struct skb_vnet_hdr *hdr; @@ -265,8 +278,11 @@ static void receive_buf(struct net_devic hdr = skb_vnet_hdr(skb); skb->truesize += skb->data_len; - dev->stats.rx_bytes += skb->len; - dev->stats.rx_packets++; + + u64_st...
2017 Feb 17
0
[PATCH net-next] virtio-net: batch stats updating
...-static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq, - void *buf, unsigned int len) +static int receive_buf(struct virtnet_info *vi, struct receive_queue *rq, + void *buf, unsigned int len) { struct net_device *dev = vi->dev; - struct virtnet_stats *stats = this_cpu_ptr(vi->stats); struct sk_buff *skb; struct virtio_net_hdr_mrg_rxbuf *hdr; + int ret; if (unlikely(len < vi->hdr_len + ETH_HLEN)) { pr_debug("%s: short packet %i\n", dev->name, len); @@ -739,7 +739,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_que...
2017 Feb 17
0
[PATCH net-next] virtio-net: batch stats updating
...-static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq, - void *buf, unsigned int len) +static int receive_buf(struct virtnet_info *vi, struct receive_queue *rq, + void *buf, unsigned int len) { struct net_device *dev = vi->dev; - struct virtnet_stats *stats = this_cpu_ptr(vi->stats); struct sk_buff *skb; struct virtio_net_hdr_mrg_rxbuf *hdr; + int ret; if (unlikely(len < vi->hdr_len + ETH_HLEN)) { pr_debug("%s: short packet %i\n", dev->name, len); @@ -739,7 +739,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_que...
2014 Oct 15
2
[RFC PATCH net-next 5/6] virtio-net: enable tx interrupt
...19,40 @@ static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask) return p; } +static int free_old_xmit_skbs(struct send_queue *sq, int budget) +{ + struct sk_buff *skb; + unsigned int len; + struct virtnet_info *vi = sq->vq->vdev->priv; + struct virtnet_stats *stats = this_cpu_ptr(vi->stats); + u64 tx_bytes = 0, tx_packets = 0; + + while (tx_packets < budget && + (skb = virtqueue_get_buf(sq->vq, &len)) != NULL) { + pr_debug("Sent skb %p\n", skb); + + tx_bytes += skb->len; + tx_packets++; + + dev_kfree_skb_any(skb); + } + + u64_sta...
2014 Oct 15
2
[RFC PATCH net-next 5/6] virtio-net: enable tx interrupt
...19,40 @@ static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask) return p; } +static int free_old_xmit_skbs(struct send_queue *sq, int budget) +{ + struct sk_buff *skb; + unsigned int len; + struct virtnet_info *vi = sq->vq->vdev->priv; + struct virtnet_stats *stats = this_cpu_ptr(vi->stats); + u64 tx_bytes = 0, tx_packets = 0; + + while (tx_packets < budget && + (skb = virtqueue_get_buf(sq->vq, &len)) != NULL) { + pr_debug("Sent skb %p\n", skb); + + tx_bytes += skb->len; + tx_packets++; + + dev_kfree_skb_any(skb); + } + + u64_sta...
2017 Apr 06
2
[bug report] virtio_net: rework mergeable buffer handling
.../virtio_net.c 1030 static int virtnet_receive(struct receive_queue *rq, int budget) 1031 { 1032 struct virtnet_info *vi = rq->vq->vdev->priv; 1033 unsigned int len, received = 0, bytes = 0; 1034 void *buf; 1035 struct virtnet_stats *stats = this_cpu_ptr(vi->stats); 1036 1037 if (vi->mergeable_rx_bufs) { 1038 void *ctx; ^^^ 1039 1040 while (received < budget && 1041 (buf = virtqueue_get_buf_ctx(rq->vq, &len, &...
2017 Apr 06
2
[bug report] virtio_net: rework mergeable buffer handling
.../virtio_net.c 1030 static int virtnet_receive(struct receive_queue *rq, int budget) 1031 { 1032 struct virtnet_info *vi = rq->vq->vdev->priv; 1033 unsigned int len, received = 0, bytes = 0; 1034 void *buf; 1035 struct virtnet_stats *stats = this_cpu_ptr(vi->stats); 1036 1037 if (vi->mergeable_rx_bufs) { 1038 void *ctx; ^^^ 1039 1040 while (received < budget && 1041 (buf = virtqueue_get_buf_ctx(rq->vq, &len, &...
2012 Jun 06
2
[V2 RFC net-next PATCH 1/2] virtio_net: convert the statistics into array
Currently, we store the statistics in the independent fields of virtnet_stats, this is not scalable when we want to add more counters. As suggested by Michael, this patch convert it to an array and use the enum as the index to access them. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/net/virtio_net.c | 30 +++++++++++++++++------------- 1 files changed, 17
2012 Jun 06
2
[V2 RFC net-next PATCH 1/2] virtio_net: convert the statistics into array
Currently, we store the statistics in the independent fields of virtnet_stats, this is not scalable when we want to add more counters. As suggested by Michael, this patch convert it to an array and use the enum as the index to access them. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/net/virtio_net.c | 30 +++++++++++++++++------------- 1 files changed, 17
2014 Oct 15
2
[RFC PATCH net-next 5/6] virtio-net: enable tx interrupt
...gt;> > >> > +static int free_old_xmit_skbs(struct send_queue *sq, int budget) >> > +{ >> > + struct sk_buff *skb; >> > + unsigned int len; >> > + struct virtnet_info *vi = sq->vq->vdev->priv; >> > + struct virtnet_stats *stats = this_cpu_ptr(vi->stats); >> > + u64 tx_bytes = 0, tx_packets = 0; >> > + >> > + while (tx_packets < budget && >> > + (skb = virtqueue_get_buf(sq->vq, &len)) != NULL) { >> > + pr_debug("Sent skb %p\n", skb); >> > + >&...
2014 Oct 15
2
[RFC PATCH net-next 5/6] virtio-net: enable tx interrupt
...gt;> > >> > +static int free_old_xmit_skbs(struct send_queue *sq, int budget) >> > +{ >> > + struct sk_buff *skb; >> > + unsigned int len; >> > + struct virtnet_info *vi = sq->vq->vdev->priv; >> > + struct virtnet_stats *stats = this_cpu_ptr(vi->stats); >> > + u64 tx_bytes = 0, tx_packets = 0; >> > + >> > + while (tx_packets < budget && >> > + (skb = virtqueue_get_buf(sq->vq, &len)) != NULL) { >> > + pr_debug("Sent skb %p\n", skb); >> > + >&...
2020 Sep 15
0
[PATCH RFC v1 09/18] x86/hyperv: provide a bunch of helper functions
...ve we will never overrun the 2048 bytes we 'allocated' for 'counts' above. While 'if (num_pages > HV_DEPOSIT_MAX)' presumably guarantees that, this is not really obvious. > + num_allocations++; > + } > + > + local_irq_save(flags); > + > + input_page = *this_cpu_ptr(hyperv_pcpu_input_arg); > + > + input_page->partition_id = partition_id; > + > + /* Populate gpa_page_list - these will fit on the input page */ > + for (i = 0, page_count = 0; i < num_allocations; ++i) { > + base_pfn = page_to_pfn(pages[i]); > + for (j = 0; j < coun...