On Mon,  4 May 2020 11:37:53 +0300
Denis Kirjanov <[email protected]> wrote:

> +static int xennet_create_page_pool(struct netfront_queue *queue)
> +{
> +     int err;
> +     struct page_pool_params pp_params = {
> +             .order = 0,
> +             .flags = 0,
> +             .pool_size = NET_RX_RING_SIZE,
> +             .nid = NUMA_NO_NODE,
> +             .dev = &queue->info->netdev->dev,
> +             .offset = XDP_PACKET_HEADROOM,
> +             .max_len = XEN_PAGE_SIZE - XDP_PACKET_HEADROOM,
> +     };
> +
> +     queue->page_pool = page_pool_create(&pp_params);
> +     if (IS_ERR(queue->page_pool)) {
> +              err = PTR_ERR(queue->page_pool);
> +              queue->page_pool = NULL;
> +              return err;
> +     }
> +
> +     err = xdp_rxq_info_reg(&queue->xdp_rxq, queue->info->netdev,
> +                            queue->id);
> +     if (err) {
> +             netdev_err(queue->info->netdev, "xdp_rxq_info_reg failed\n");
> +             goto err_free_pp;
> +     }
> +
> +     err = xdp_rxq_info_reg_mem_model(&queue->xdp_rxq,
> +                                      MEM_TYPE_PAGE_ORDER0, NULL);

What!?! - You are creating a page_pool, but registering a MEM_TYPE_PAGE_ORDER0.

Have you even tested this?  The page_pool in-flight accounting will be
completely off.  This should show up when removing the page_pool again.

For driver developers do diagnose and catch stuff like this, we have
some bpftrace scripts that can help troubleshoot, here[1]:

[1] https://github.com/xdp-project/xdp-project/tree/master/areas/mem/bpftrace

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

Reply via email to