Subject: Re: [PATCH net-next 4/5] devlink: embed driver's priv data callback param into devlink_resource

From: kernel test robot <[email-masked]>
Date: Fri, 16 Aug 2024 16:33:47 +0800

Hello,

kernel test robot noticed "WARNING:at_net/devlink/resource.c:#devl_resource_occ_get_register" on:

commit: ee141889828a13aa804849ebda6af39d6a8ebf87 ("[PATCH net-next 4/5] devlink: embed driver's priv data callback param into devlink_resource")
url: https://github.com/intel-lab-lkp/linux/commits/Przemek-Kitszel/net-dsa-replace-devlink-resource-registration-calls-by-devl_-variants/20240806-224519
patch link: https://lore.kernel.org/all/[email-masked]/
patch subject: [PATCH net-next 4/5] devlink: embed driver's priv data callback param into devlink_resource

in testcase: kernel-selftests-bpf
version: 
with following parameters:

	group: net

compiler: gcc-12
test machine: 36 threads 1 sockets Intel(R) Core(TM) i9-10980XE CPU @ 3.00GHz (Cascade Lake) with 32G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email-masked]>
| Closes: https://lore.kernel.org/oe-lkp/[email-masked]

kern  :warn  : [   81.007570] ------------[ cut here ]------------
kern :warn : [   81.008076] WARNING: CPU: 18 PID: 7588 at net/devlink/resource.c:484 devl_resource_occ_get_register (net/devlink/resource.c:484) 
kern  :warn  : [   81.009035] Modules linked in: netdevsim macsec vxlan 8021q garp mrp bridge stp llc ip6_gre ip_gre gre cls_u32 sch_htb macvtap macvlan tap dummy tun nf_conntrack_broadcast fou ip_tunnel ip6_udp_tunnel udp_tunnel rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver netconsole openvswitch nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 psample ipmi_devintf ipmi_msghandler binfmt_misc intel_rapl_msr intel_rapl_common btrfs skx_edac_common nfit libnvdimm x86_pkg_temp_thermal intel_powerclamp blake2b_generic coretemp xor zstd_compress kvm_intel kvm raid6_pq crct10dif_pclmul crc32_pclmul libcrc32c crc32c_intel ghash_clmulni_intel sha512_ssse3 rapl intel_cstate ahci libahci wmi_bmof intel_wmi_thunderbolt nvme mxm_wmi mei_me libata intel_uncore nvme_core mei ioatdma wdat_wdt dca wmi drm dm_mod fuse ip_tables x_tables sch_fq_codel [last unloaded: test_bpf]
kern  :warn  : [   81.015492] CPU: 18 UID: 0 PID: 7588 Comm: rtnetlink.sh Tainted: G S                 6.11.0-rc1-00254-gee141889828a #1
kern  :warn  : [   81.016497] Tainted: [S]=CPU_OUT_OF_SPEC
kern  :warn  : [   81.016936] Hardware name: Gigabyte Technology Co., Ltd. X299 UD4 Pro/X299 UD4 Pro-CF, BIOS F8a 04/27/2021
kern :warn : [   81.017853] RIP: 0010:devl_resource_occ_get_register (net/devlink/resource.c:484) 
kern :warn : [ 81.018451] Code: b0 4d 89 c5 49 3b 5e 08 74 35 48 89 da 4c 89 f6 48 89 ef e8 34 fa ff ff 48 85 c0 75 59 49 8b 46 50 4c 8d 70 b0 49 39 c4 75 da <0f> 0b 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 4d
All code
========
   0:	b0 4d                	mov    $0x4d,%al
   2:	89 c5                	mov    %eax,%ebp
   4:	49 3b 5e 08          	cmp    0x8(%r14),%rbx
   8:	74 35                	je     0x3f
   a:	48 89 da             	mov    %rbx,%rdx
   d:	4c 89 f6             	mov    %r14,%rsi
  10:	48 89 ef             	mov    %rbp,%rdi
  13:	e8 34 fa ff ff       	call   0xfffffffffffffa4c
  18:	48 85 c0             	test   %rax,%rax
  1b:	75 59                	jne    0x76
  1d:	49 8b 46 50          	mov    0x50(%r14),%rax
  21:	4c 8d 70 b0          	lea    -0x50(%rax),%r14
  25:	49 39 c4             	cmp    %rax,%r12
  28:	75 da                	jne    0x4
  2a:*	0f 0b                	ud2		<-- trapping instruction
  2c:	48 83 c4 08          	add    $0x8,%rsp
  30:	5b                   	pop    %rbx
  31:	5d                   	pop    %rbp
  32:	41 5c                	pop    %r12
  34:	41 5d                	pop    %r13
  36:	41 5e                	pop    %r14
  38:	41 5f                	pop    %r15
  3a:	c3                   	ret
  3b:	cc                   	int3
  3c:	cc                   	int3
  3d:	cc                   	int3
  3e:	cc                   	int3
  3f:	4d                   	rex.WRB

Code starting with the faulting instruction
===========================================
   0:	0f 0b                	ud2
   2:	48 83 c4 08          	add    $0x8,%rsp
   6:	5b                   	pop    %rbx
   7:	5d                   	pop    %rbp
   8:	41 5c                	pop    %r12
   a:	41 5d                	pop    %r13
   c:	41 5e                	pop    %r14
   e:	41 5f                	pop    %r15
  10:	c3                   	ret
  11:	cc                   	int3
  12:	cc                   	int3
  13:	cc                   	int3
  14:	cc                   	int3
  15:	4d                   	rex.WRB
kern  :warn  : [   81.020118] RSP: 0018:ffffc90001a53b70 EFLAGS: 00010293
kern  :warn  : [   81.020662] RAX: ffff8888753fd400 RBX: 0000000000000002 RCX: ffff888894939048
kern  :warn  : [   81.021374] RDX: ffff8888753fd060 RSI: ffff8888753fd000 RDI: ffff888894939048
kern  :warn  : [   81.022085] RBP: ffff888894939000 R08: 0000000000000008 R09: 0000000000000000
kern  :warn  : [   81.022795] R10: ffff8888753fd400 R11: 000000008b95c1e3 R12: ffff888894939048
kern  :warn  : [   81.023510] R13: 0000000000000008 R14: ffff8888753fd400 R15: ffffffffc0e37800
kern  :warn  : [   81.024222] FS:  00007f0d9d0e9c40(0000) GS:ffff88889f500000(0000) knlGS:0000000000000000
kern  :warn  : [   81.025012] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
kern  :warn  : [   81.025599] CR2: 00005612292a7cd0 CR3: 0000000870ece002 CR4: 00000000003706f0
kern  :warn  : [   81.026311] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
kern  :warn  : [   81.027022] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
kern  :warn  : [   81.027731] Call Trace:
kern  :warn  : [   81.028052]  <TASK>
kern :warn : [   81.028344] ? __warn (kernel/panic.c:735) 
kern :warn : [   81.028728] ? devl_resource_occ_get_register (net/devlink/resource.c:484) 
kern :warn : [   81.029275] ? report_bug (lib/bug.c:180 lib/bug.c:219) 
kern :warn : [   81.029694] ? handle_bug (arch/x86/kernel/traps.c:239) 
kern :warn : [   81.030102] ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1)) 
kern :warn : [   81.030534] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:621) 
kern :warn : [   81.031000] ? __pfx_nsim_fib_ipv4_resource_occ_get (drivers/net/netdevsim/fib.c:1422) netdevsim
kern :warn : [   81.031689] ? devl_resource_occ_get_register (net/devlink/resource.c:484) 
kern :warn : [   81.032238] nsim_fib_create (drivers/net/netdevsim/fib.c:1606) netdevsim
kern :warn : [   81.032765] nsim_drv_probe (drivers/net/netdevsim/dev.c:1583) netdevsim
kern :warn : [   81.033287] really_probe (drivers/base/dd.c:578 drivers/base/dd.c:657) 
kern :warn : [   81.033698] ? __pfx___device_attach_driver (drivers/base/dd.c:921) 
kern :warn : [   81.034232] __driver_probe_device (drivers/base/dd.c:799) 
kern :warn : [   81.034707] driver_probe_device (drivers/base/dd.c:830) 
kern :warn : [   81.035164] __device_attach_driver (drivers/base/dd.c:958) 
kern :warn : [   81.035646] bus_for_each_drv (drivers/base/bus.c:457) 
kern :warn : [   81.036083] __device_attach (drivers/base/dd.c:1031) 
kern :warn : [   81.036514] bus_probe_device (drivers/base/bus.c:532) 
kern :warn : [   81.036946] device_add (drivers/base/core.c:3686) 
kern :warn : [   81.037353] new_device_store (drivers/net/netdevsim/bus.c:443 drivers/net/netdevsim/bus.c:173) netdevsim
kern :warn : [   81.037886] kernfs_fop_write_iter (fs/kernfs/file.c:334) 
kern :warn : [   81.038373] vfs_write (fs/read_write.c:497 fs/read_write.c:590) 
kern :warn : [   81.038772] ksys_write (fs/read_write.c:644) 
kern :warn : [   81.039164] do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83) 
kern :warn : [   81.039582] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) 
kern  :warn  : [   81.040116] RIP: 0033:0x7f0d9d1e3240
kern :warn : [ 81.040525] Code: 40 00 48 8b 15 c1 9b 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 80 3d a1 23 0e 00 00 74 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 28 48 89
All code
========
   0:	40 00 48 8b          	rex add %cl,-0x75(%rax)
   4:	15 c1 9b 0d 00       	adc    $0xd9bc1,%eax
   9:	f7 d8                	neg    %eax
   b:	64 89 02             	mov    %eax,%fs:(%rdx)
   e:	48 c7 c0 ff ff ff ff 	mov    $0xffffffffffffffff,%rax
  15:	eb b7                	jmp    0xffffffffffffffce
  17:	0f 1f 00             	nopl   (%rax)
  1a:	80 3d a1 23 0e 00 00 	cmpb   $0x0,0xe23a1(%rip)        # 0xe23c2
  21:	74 17                	je     0x3a
  23:	b8 01 00 00 00       	mov    $0x1,%eax
  28:	0f 05                	syscall
  2a:*	48 3d 00 f0 ff ff    	cmp    $0xfffffffffffff000,%rax		<-- trapping instruction
  30:	77 58                	ja     0x8a
  32:	c3                   	ret
  33:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)
  3a:	48 83 ec 28          	sub    $0x28,%rsp
  3e:	48                   	rex.W
  3f:	89                   	.byte 0x89

Code starting with the faulting instruction
===========================================
   0:	48 3d 00 f0 ff ff    	cmp    $0xfffffffffffff000,%rax
   6:	77 58                	ja     0x60
   8:	c3                   	ret
   9:	0f 1f 80 00 00 00 00 	nopl   0x0(%rax)
  10:	48 83 ec 28          	sub    $0x28,%rsp
  14:	48                   	rex.W
  15:	89                   	.byte 0x89

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240816/[email-masked]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki