Netdev List
 help / color / mirror / Atom feed
* netif_set_xps_queue() before register_netdev(): correct from an API perspective?
@ 2023-08-02 14:57 Vladimir Oltean
  2023-08-02 15:04 ` Alexander Duyck
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Oltean @ 2023-08-02 14:57 UTC (permalink / raw)
  To: Ioana Ciornei, Antoine Tenart, Alexander Duyck; +Cc: netdev

Hi,

When drivers/net/ethernet/freescale/dpaa2/ fails to probe (including -EPROBE_DEFER),
I see lots of these:

$ cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff042845fbdac0 (size 64):
  comm "kworker/u16:1", pid 56, jiffies 4294893690 (age 859.844s)
  hex dump (first 32 bytes):
    01 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffc754095a7dfc>] slab_post_alloc_hook+0xa4/0x330
    [<ffffc754095a654c>] __kmem_cache_alloc_node+0x23c/0x308
    [<ffffc7540952fec0>] __kmalloc_node+0xc0/0x240
    [<ffffc7540a976934>] __netif_set_xps_queue+0x32c/0xa78
    [<ffffc7540a9771e4>] netif_set_xps_queue+0x44/0x70
    [<ffffc7540a1c3540>] update_xps+0xb0/0x158
    [<ffffc7540a1c0290>] dpaa2_eth_probe+0xd10/0x1368
    [<ffffc75409b1677c>] fsl_mc_driver_probe+0x2c/0x80
    [<ffffc75409eb764c>] really_probe+0x13c/0x2f8
    [<ffffc75409eb666c>] __driver_probe_device+0xac/0x140
    [<ffffc75409eb7340>] driver_probe_device+0x48/0x218
    [<ffffc75409eb71d8>] __device_attach_driver+0x128/0x158
    [<ffffc75409eb33e4>] bus_for_each_drv+0x12c/0x160
    [<ffffc75409eb63f4>] __device_attach+0xcc/0x1a0
    [<ffffc75409eb64e8>] device_initial_probe+0x20/0x38
    [<ffffc75409eb3620>] bus_probe_device+0xa0/0x118

I see that netif_set_xps_queue() allocates dev->xps_maps[], which is
eventually freed by reset_xps_maps() <- ... <- netif_reset_xps_queues_gt()
from a number of call sites, including from unregister_netdevice_many_notify().

This is nice, but dpaa2 (above) and emulex/benet/be_main.c call
netif_set_xps_queue() prior to registering the net device. So no
deregistration event will take place.

How is the memory supposed to be freed in this case?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-02 16:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 14:57 netif_set_xps_queue() before register_netdev(): correct from an API perspective? Vladimir Oltean
2023-08-02 15:04 ` Alexander Duyck
2023-08-02 15:22   ` Vladimir Oltean
2023-08-02 16:42     ` Alexander Duyck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox