Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

page_pool: store detach_time as ktime_t to avoid false-negatives

While testing other changes in vng I noticed that
nl_netdev.page_pool_check flakes. This never happens in real CI.

Turns out vng may boot and get to that test in less than a second.
page_pool_detached() records the detach time in seconds, so if
vng is fast enough detach time is set to 0. Other code treats
0 as "not detached". detach_time is only used to report the state
to the user, so it's not a huge deal in practice but let's fix it.
Store the raw ktime_t (nanoseconds) instead. A nanosecond value
of 0 is practically impossible.

Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
Fixes: 69cb4952b6f6 ("net: page_pool: report when page pool was destroyed")
Link: https://patch.msgid.link/20260310003907.3540019-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+3 -3
+1 -1
include/net/page_pool/types.h
··· 247 247 /* User-facing fields, protected by page_pools_lock */ 248 248 struct { 249 249 struct hlist_node list; 250 - u64 detach_time; 250 + ktime_t detach_time; 251 251 u32 id; 252 252 } user; 253 253 };
+2 -2
net/core/page_pool_user.c
··· 245 245 goto err_cancel; 246 246 if (pool->user.detach_time && 247 247 nla_put_uint(rsp, NETDEV_A_PAGE_POOL_DETACH_TIME, 248 - pool->user.detach_time)) 248 + ktime_divns(pool->user.detach_time, NSEC_PER_SEC))) 249 249 goto err_cancel; 250 250 251 251 if (pool->mp_ops && pool->mp_ops->nl_fill(pool->mp_priv, rsp, NULL)) ··· 337 337 void page_pool_detached(struct page_pool *pool) 338 338 { 339 339 mutex_lock(&page_pools_lock); 340 - pool->user.detach_time = ktime_get_boottime_seconds(); 340 + pool->user.detach_time = ktime_get_boottime(); 341 341 netdev_nl_page_pool_event(pool, NETDEV_CMD_PAGE_POOL_CHANGE_NTF); 342 342 mutex_unlock(&page_pools_lock); 343 343 }