2019-09-18 00:52:16

by Navid Emamdoost

[permalink] [raw]
Subject: [PATCH] ethernet/intel: release the local packet buffer

In e100_loopback_test the buffer allocated for the local packet needs to
be released.

Signed-off-by: Navid Emamdoost <[email protected]>
---
drivers/net/ethernet/intel/e100.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index a65d5a9ba7db..4de7dca341fc 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -2394,6 +2394,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
e100_hw_reset(nic);
err_clean_rx:
e100_rx_clean_list(nic);
+ dev_kfree_skb(skb);
return err;
}

--
2.17.1


2019-09-18 02:31:00

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ethernet/intel: release the local packet buffer

Hi Navid,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to v5.3 next-20190917]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Navid-Emamdoost/ethernet-intel-release-the-local-packet-buffer/20190918-080148
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sparc64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

In file included from include/linux/if_ether.h:19:0,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from include/linux/netdevice.h:37,
from drivers/net/ethernet/intel/e100.c:140:
drivers/net/ethernet/intel/e100.c: In function 'e100_loopback_test':
>> include/linux/skbuff.h:1149:26: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
#define dev_kfree_skb(a) consume_skb(a)
^~~~~~~~~~~
drivers/net/ethernet/intel/e100.c:2347:18: note: 'skb' was declared here
struct sk_buff *skb;
^~~
--
In file included from include/linux/if_ether.h:19:0,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from include/linux/netdevice.h:37,
from drivers/net//ethernet/intel/e100.c:140:
drivers/net//ethernet/intel/e100.c: In function 'e100_loopback_test':
>> include/linux/skbuff.h:1149:26: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
#define dev_kfree_skb(a) consume_skb(a)
^~~~~~~~~~~
drivers/net//ethernet/intel/e100.c:2347:18: note: 'skb' was declared here
struct sk_buff *skb;
^~~

vim +/skb +1149 include/linux/skbuff.h

cd0a137acbb662 Florian Fainelli 2017-08-22 1133
cd0a137acbb662 Florian Fainelli 2017-08-22 1134 /**
cd0a137acbb662 Florian Fainelli 2017-08-22 1135 * skb_pad - zero pad the tail of an skb
cd0a137acbb662 Florian Fainelli 2017-08-22 1136 * @skb: buffer to pad
cd0a137acbb662 Florian Fainelli 2017-08-22 1137 * @pad: space to pad
cd0a137acbb662 Florian Fainelli 2017-08-22 1138 *
cd0a137acbb662 Florian Fainelli 2017-08-22 1139 * Ensure that a buffer is followed by a padding area that is zero
cd0a137acbb662 Florian Fainelli 2017-08-22 1140 * filled. Used by network drivers which may DMA or transfer data
cd0a137acbb662 Florian Fainelli 2017-08-22 1141 * beyond the buffer end onto the wire.
cd0a137acbb662 Florian Fainelli 2017-08-22 1142 *
cd0a137acbb662 Florian Fainelli 2017-08-22 1143 * May return error in out of memory cases. The skb is freed on error.
cd0a137acbb662 Florian Fainelli 2017-08-22 1144 */
cd0a137acbb662 Florian Fainelli 2017-08-22 1145 static inline int skb_pad(struct sk_buff *skb, int pad)
cd0a137acbb662 Florian Fainelli 2017-08-22 1146 {
cd0a137acbb662 Florian Fainelli 2017-08-22 1147 return __skb_pad(skb, pad, true);
cd0a137acbb662 Florian Fainelli 2017-08-22 1148 }
ead2ceb0ec9f85 Neil Horman 2009-03-11 @1149 #define dev_kfree_skb(a) consume_skb(a)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1150

:::::: The code at line 1149 was first introduced by commit
:::::: ead2ceb0ec9f85cff19c43b5cdb2f8a054484431 Network Drop Monitor: Adding kfree_skb_clean for non-drops and modifying end-of-line points for skbs

:::::: TO: Neil Horman <[email protected]>
:::::: CC: David S. Miller <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (4.24 kB)
.config.gz (57.37 kB)
Download all attachments

2019-10-22 02:36:06

by Brown, Aaron F

[permalink] [raw]
Subject: RE: [PATCH] ethernet/intel: release the local packet buffer

> From: [email protected] [mailto:netdev-
> [email protected]] On Behalf Of Navid Emamdoost
> Sent: Tuesday, September 17, 2019 5:00 PM
> Cc: [email protected]; [email protected]; [email protected]; Navid
> Emamdoost <[email protected]>; Kirsher, Jeffrey T
> <[email protected]>; David S. Miller <[email protected]>;
> [email protected]; [email protected]; linux-
> [email protected]
> Subject: [PATCH] ethernet/intel: release the local packet bufferq
>
> In e100_loopback_test the buffer allocated for the local packet needs to
> be released.
>
> Signed-off-by: Navid Emamdoost <[email protected]>
> ---
> drivers/net/ethernet/intel/e100.c | 1 +
> 1 file changed, 1 insertion(+)

Sorry for the delay getting to this, took me a bit to get the hardware together.

NAK, this patch introduces a trace to my test machines when I run the ethtool diagnostic on an e100 port, the system will sometimes survive a bit after the trace, however if I try to run traffic across the interface after the trace the system panics and locks up with a kernel not syncing message. I do not have a capture of the lock up panic (I can probably get one via serial port or netconsole if really necessary.) The trace before the lock up panic is as follows:
---------------------------------------------------------------------------
[ 102.460446] BUG: Bad page state in process ethtool pfn:78db8
[ 102.460474] page:ffffd5bf41e36e00 refcount:-1 mapcount:0 mapping:0000000000000000 index:0x0
[ 102.460505] flags: 0xfffffc0000000()
[ 102.460523] raw: 000fffffc0000000 dead000000000100 dead000000000122 0000000000000000
[ 102.460553] raw: 0000000000000000 0000000000000000 ffffffffffffffff 0000000000000000
[ 102.460582] page dumped because: nonzero _refcount
[ 102.460602] Modules linked in: snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_intel_nhlt snd_hda_codec
snd_hwdep snd_hda_core snd_seq snd_seq_device snd_pcm mei_wdt snd_timer iTCO_wdt mei_me snd iTCO_vendor_support gpio_ic
h mei coretemp lpc_ich pcspkr sg soundcore i2c_i801 joydev acpi_cpufreq nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_t
ables xfs libcrc32c sd_mod sr_mod cdrom i915 video i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_
fops e1000e ata_generic firewire_ohci pata_marvell ata_piix drm pata_acpi serio_raw e100 firewire_core libata ptp pps_co
re mii crc_itu_t
[ 102.460800] CPU: 3 PID: 1541 Comm: ethtool Not tainted 5.4.0-rc1_next-queue_dev-queue_regress-00576-g16390e0 #3
[ 102.460836] Hardware name: /DQ35JO, BIOS JOQ3510J.86A.0954.2008.0922.2331 09/22/2008
[ 102.460865] Call Trace:
[ 102.460883] dump_stack+0x5a/0x73
[ 102.460900] bad_page+0xf5/0x10f
[ 102.460916] get_page_from_freelist+0x103e/0x1290
[ 102.460936] ? __switch_to_asm+0x40/0x70
[ 102.460955] ? __build_skb+0x20/0x190
[ 102.460972] __alloc_pages_nodemask+0x17d/0x320
[ 102.460991] page_frag_alloc+0x87/0x130
[ 102.461008] __netdev_alloc_skb+0x10b/0x130
[ 102.461029] e100_rx_alloc_skb+0x20/0x180 [e100]
[ 102.461050] e100_rx_alloc_list+0x98/0x160 [e100]
[ 102.461070] e100_up+0x11/0x120 [e100]
[ 102.461088] e100_diag_test+0x14e/0x157 [e100]
[ 102.461107] ? _cond_resched+0x15/0x30
[ 102.461125] ? dev_ethtool+0x1133/0x2c30
[ 102.461143] dev_ethtool+0x1159/0x2c30
[ 102.461161] ? inet_ioctl+0x1a0/0x1d0
[ 102.461178] ? netdev_run_todo+0x5d/0x2d0
[ 102.461196] dev_ioctl+0xb3/0x4e0
[ 102.461212] sock_do_ioctl+0xa0/0x140
[ 102.461228] ? do_anonymous_page+0x361/0x670
[ 102.461247] sock_ioctl+0x26e/0x380
[ 102.461264] do_vfs_ioctl+0xa9/0x630
[ 102.461281] ? handle_mm_fault+0xe2/0x1f0
[ 102.462101] ? __do_page_fault+0x247/0x490
[ 102.462911] ksys_ioctl+0x60/0x90
[ 102.463715] __x64_sys_ioctl+0x16/0x20
[ 102.464519] do_syscall_64+0x5b/0x1b0
[ 102.465321] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 102.466134] RIP: 0033:0x7f03e53f32f7
[ 102.466948] Code: 44 00 00 48 8b 05 79 1b 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 49 1b 2d 00 f7 d8 64 89 01 48
[ 102.468728] RSP: 002b:00007ffffc72ebf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 102.469657] RAX: ffffffffffffffda RBX: 00007ffffc72ec50 RCX: 00007f03e53f32f7
[ 102.470595] RDX: 00007ffffc72ec60 RSI: 0000000000008946 RDI: 0000000000000003
[ 102.471532] RBP: 0000000000000001 R08: 0000000000000002 R09: 0000000000000038
[ 102.472453] R10: 00007ffffc72e7c0 R11: 0000000000000246 R12: 0000000000000038
[ 102.473359] R13: 0000000001428010 R14: 00000000014280d0 R15: 00007ffffc72edc8
[ 102.474260] Disabling lock debugging due to kernel taint
[ 104.924447] e100 0000:06:00.0 eth0: NIC Link is Up 100 Mbps Full Duplex
---------------------------------------------------------------------------