Netdev List
 help / color / mirror / Atom feed
* Re: mwifiex: make const arrays static to shink object code size
From: Kalle Valo @ 2017-09-20 12:47 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Amitkumar Karwar, Nishant Sarmukadam, Ganapathi Bhat, Xinming Hu,
	linux-wireless, netdev, kernel-janitors, linux-kernel
In-Reply-To: <20170916153424.28285-1-colin.king@canonical.com>

Colin Ian King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate const arrays on the stack, instead make them static
> Makes the object code smaller by nearly 300 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   69260	  16149	    576	  85985	  14fe1	cfg80211.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   68385	  16725	    576	  85686	  14eb6	cfg80211.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch applied to wireless-drivers-next.git, thanks.

d157bcfaf854 mwifiex: make const arrays static to shink object code size

-- 
https://patchwork.kernel.org/patch/9954375/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply

* Re: mwifiex: remove unnecessary call to memset
From: Kalle Valo @ 2017-09-20 12:47 UTC (permalink / raw)
  To: Himanshu Jha
  Cc: amitkarwar-Re5JQEeQqe8AvxtiuMwx3w,
	nishants-eYqpPyKDWXRBDgjK7y7TUQ, gbhat-eYqpPyKDWXRBDgjK7y7TUQ,
	huxm-eYqpPyKDWXRBDgjK7y7TUQ,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA, Himanshu Jha
In-Reply-To: <1505133964-376-1-git-send-email-himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Himanshu Jha <himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> call to memset to assign 0 value immediately after allocating
> memory with kzalloc is unnecesaary as kzalloc allocates the memory
> filled with 0 value.
> 
> Semantic patch used to resolve this issue:
> 
> @@
> expression e,e2; constant c;
> statement S;
> @@
> 
>   e = kzalloc(e2, c);
>   if(e == NULL) S
> - memset(e, 0, e2);
> 
> Signed-off-by: Himanshu Jha <himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Patch applied to wireless-drivers-next.git, thanks.

85dafc129196 mwifiex: remove unnecessary call to memset

-- 
https://patchwork.kernel.org/patch/9947331/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply

* [PATCH] net_sched/hfsc: fix curve activation in hfsc_change_class()
From: Konstantin Khlebnikov @ 2017-09-20 12:46 UTC (permalink / raw)
  To: netdev, David S. Miller; +Cc: Cong Wang, Jiri Pirko, Jamal Hadi Salim

If real-time or fair-share curves are enabled in hfsc_change_class()
class isn't inserted into rb-trees yet. Thus init_ed() and init_vf()
must be called in place of update_ed() and update_vf().

Remove isn't required because for now curves cannot be disabled.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 net/sched/sch_hfsc.c |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index daaf214e5201..3f88b75488b0 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -958,6 +958,8 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
 	}
 
 	if (cl != NULL) {
+		int old_flags;
+
 		if (parentid) {
 			if (cl->cl_parent &&
 			    cl->cl_parent->cl_common.classid != parentid)
@@ -978,6 +980,8 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
 		}
 
 		sch_tree_lock(sch);
+		old_flags = cl->cl_flags;
+
 		if (rsc != NULL)
 			hfsc_change_rsc(cl, rsc, cur_time);
 		if (fsc != NULL)
@@ -986,10 +990,21 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
 			hfsc_change_usc(cl, usc, cur_time);
 
 		if (cl->qdisc->q.qlen != 0) {
-			if (cl->cl_flags & HFSC_RSC)
-				update_ed(cl, qdisc_peek_len(cl->qdisc));
-			if (cl->cl_flags & HFSC_FSC)
-				update_vf(cl, 0, cur_time);
+			int len = qdisc_peek_len(cl->qdisc);
+
+			if (cl->cl_flags & HFSC_RSC) {
+				if (old_flags & HFSC_RSC)
+					update_ed(cl, len);
+				else
+					init_ed(cl, len);
+			}
+
+			if (cl->cl_flags & HFSC_FSC) {
+				if (old_flags & HFSC_FSC)
+					update_vf(cl, 0, cur_time);
+				else
+					init_vf(cl, len);
+			}
 		}
 		sch_tree_unlock(sch);
 

^ permalink raw reply related

* [PATCH] net_sched: always reset qdisc backlog in qdisc_reset()
From: Konstantin Khlebnikov @ 2017-09-20 12:45 UTC (permalink / raw)
  To: netdev, David S. Miller; +Cc: Cong Wang, Jiri Pirko, Jamal Hadi Salim

SKB stored in qdisc->gso_skb also counted into backlog.

Some qdiscs don't reset backlog to zero in ->reset(),
for example sfq just dequeue and free all queued skb.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too")
---
 net/sched/sch_generic.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 92237e75dbbc..bf8c81e07c70 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -685,6 +685,7 @@ void qdisc_reset(struct Qdisc *qdisc)
 		qdisc->gso_skb = NULL;
 	}
 	qdisc->q.qlen = 0;
+	qdisc->qstats.backlog = 0;
 }
 EXPORT_SYMBOL(qdisc_reset);
 

^ permalink raw reply related

* Re: [1/2] b43: fix unitialized reads of ret by initializing the array to zero
From: Kalle Valo @ 2017-09-20 12:41 UTC (permalink / raw)
  To: Colin Ian King
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	b43-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20170905181550.23839-1-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> wrote:

> From: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> 
> The u8 char array ret is not being initialized and elements outside
> the range start to end contain just garbage values from the stack.
> This results in a later scan of the array to read potentially
> uninitialized values.  Fix this by initializing the array to zero.
> This seems to have been an issue since the very first commit.
> 
> Detected by CoverityScan CID#139652 ("Uninitialized scalar variable")
> 
> Signed-off-by: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> Reviewed-by: Michael Buesch <m@bues.ch>

2 patches applied to wireless-drivers-next.git, thanks.

e31fbe1034d9 b43: fix unitialized reads of ret by initializing the array to zero
e3ae1c772046 b43legacy: fix unitialized reads of ret by initializing the array to zero

-- 
https://patchwork.kernel.org/patch/9939435/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply

* Re: [1/2] b43: fix unitialized reads of ret by initializing the array to zero
From: Kalle Valo @ 2017-09-20 12:41 UTC (permalink / raw)
  To: Colin Ian King
  Cc: linux-wireless, b43-dev, netdev, kernel-janitors, linux-kernel
In-Reply-To: <20170905181550.23839-1-colin.king@canonical.com>

Colin Ian King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> The u8 char array ret is not being initialized and elements outside
> the range start to end contain just garbage values from the stack.
> This results in a later scan of the array to read potentially
> uninitialized values.  Fix this by initializing the array to zero.
> This seems to have been an issue since the very first commit.
> 
> Detected by CoverityScan CID#139652 ("Uninitialized scalar variable")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Reviewed-by: Michael Buesch <m@bues.ch>

2 patches applied to wireless-drivers-next.git, thanks.

e31fbe1034d9 b43: fix unitialized reads of ret by initializing the array to zero
e3ae1c772046 b43legacy: fix unitialized reads of ret by initializing the array to zero

-- 
https://patchwork.kernel.org/patch/9939435/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply

* Re: rsi: fix a dereference on adapter before it has been null checked
From: Kalle Valo @ 2017-09-20 12:40 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Amitkumar Karwar, Prameela Rani Garnepudi, Karun Eagalapati,
	linux-wireless, netdev, kernel-janitors, linux-kernel
In-Reply-To: <20170908152452.3594-1-colin.king@canonical.com>

Colin Ian King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> The assignment of dev is dereferencing adapter before adapter has
> been null checked, potentially leading to a null pointer dereference.
> Fix this by simply moving the assignment of dev to a later point
> after the sanity null check of adapter.
> 
> Detected by CoverityScan CID#1398383 ("Dereference before null check")
> 
> Fixes: dad0d04fa7ba ("rsi: Add RS9113 wireless driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch applied to wireless-drivers-next.git, thanks.

6508497cbdc7 rsi: fix a dereference on adapter before it has been null checked

-- 
https://patchwork.kernel.org/patch/9944509/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply

* Re: Latest net-next from GIT panic
From: Paweł Staszewski @ 2017-09-20 12:23 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Linux Kernel Network Developers
In-Reply-To: <c278dec6-e018-62e0-a613-1fa79741aaab@itcare.pl>

Almost there

Bisecting: 6 revisions left to test after this (roughly 3 steps)
[ad65a2f05695aced349e308193c6e2a6b1d87112] ipv6: call dst_hold_safe() 
properly



W dniu 2017-09-20 o 13:02, Paweł Staszewski pisze:
> Ok resumed and soo far:
>
> Panic:
>
> # bad: [9cc9a5cb176ccb4f2cda5ac34da5a659926f125f] datapath: Avoid 
> using stack larger than 1024.
> git bisect bad 9cc9a5cb176ccb4f2cda5ac34da5a659926f125f
>
> No panic:
>
> # good: [073cf9e20c333ab29744717a23f9e43ec7512a20] Merge branch 
> 'udp-reduce-cache-pressure'
> git bisect good 073cf9e20c333ab29744717a23f9e43ec7512a20
>
>
> W dniu 2017-09-20 o 12:22, Paweł Staszewski pisze:
>> Soo far bisected and marked:
>>
>> git bisect start
>> # bad: [07dd6cc1fff160143e82cf5df78c1db0b6e03355] Linux 4.13.2
>> git bisect bad 07dd6cc1fff160143e82cf5df78c1db0b6e03355
>> # good: [5d7d2e03e0f01a992e3521b180c3d3e67905f269] Linux 4.12.13
>> git bisect good 5d7d2e03e0f01a992e3521b180c3d3e67905f269
>> # good: [6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c] Linux 4.12
>> git bisect good 6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c
>> # bad: [ac7b75966c9c86426b55fe1c50ae148aa4571075] Merge tag 
>> 'pinctrl-v4.13-1' of 
>> git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
>> git bisect bad ac7b75966c9c86426b55fe1c50ae148aa4571075
>> # good: [e24dd9ee5399747b71c1d982a484fc7601795f31] Merge branch 
>> 'next' of 
>> git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
>> git bisect good e24dd9ee5399747b71c1d982a484fc7601795f31
>> # good: [e24dd9ee5399747b71c1d982a484fc7601795f31] Merge branch 
>> 'next' of 
>> git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
>> git bisect good e24dd9ee5399747b71c1d982a484fc7601795f31
>> # good: [e24dd9ee5399747b71c1d982a484fc7601795f31] Merge branch 
>> 'next' of 
>> git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
>> git bisect good e24dd9ee5399747b71c1d982a484fc7601795f31
>>
>>
>>
>> W dniu 2017-09-20 o 12:21, Paweł Staszewski pisze:
>>> Ok kernel crashed with different panic that i didnt catch when i was 
>>> doing bisect and now my bisection is broken :)
>>>
>>> git bisect good
>>> Bisecting: 1787 revisions left to test after this (roughly 11 steps)
>>> error: Your local changes to the following files would be 
>>> overwritten by checkout:
>>>         Documentation/00-INDEX
>>>         Documentation/ABI/stable/sysfs-class-udc
>>>         Documentation/ABI/testing/configfs-usb-gadget-uac1
>>>         Documentation/ABI/testing/ima_policy
>>>         Documentation/ABI/testing/sysfs-bus-iio
>>>         Documentation/ABI/testing/sysfs-bus-iio-meas-spec
>>>         Documentation/ABI/testing/sysfs-bus-iio-timer-stm32
>>>         Documentation/ABI/testing/sysfs-class-net
>>>         Documentation/ABI/testing/sysfs-class-power-twl4030
>>>         Documentation/ABI/testing/sysfs-class-typec
>>>         Documentation/DMA-API.txt
>>>         Documentation/IRQ-domain.txt
>>>         Documentation/Makefile
>>>         Documentation/PCI/MSI-HOWTO.txt
>>>         Documentation/RCU/00-INDEX
>>> Documentation/RCU/Design/Requirements/Requirements.html
>>>         Documentation/RCU/checklist.txt
>>>         Documentation/admin-guide/README.rst
>>>         Documentation/admin-guide/devices.txt
>>>         Documentation/admin-guide/index.rst
>>>         Documentation/admin-guide/kernel-parameters.txt
>>>         Documentation/admin-guide/pm/cpufreq.rst
>>>         Documentation/admin-guide/pm/intel_pstate.rst
>>>         Documentation/admin-guide/ras.rst
>>>         Documentation/arm/Atmel/README
>>>         Documentation/block/biodoc.txt
>>>         Documentation/conf.py
>>>         Documentation/core-api/assoc_array.rst
>>>         Documentation/core-api/atomic_ops.rst
>>>         Documentation/core-api/index.rst
>>>         Documentation/crypto/asymmetric-keys.txt
>>>         Documentation/dev-tools/index.rst
>>>         Documentation/dev-tools/sparse.rst
>>>         Documentation/devicetree/bindings/arm/amlogic.txt
>>>         Documentation/devicetree/bindings/arm/atmel-at91.txt
>>>         Documentation/devicetree/bindings/arm/ccn.txt
>>>         Documentation/devicetree/bindings/arm/cpus.txt
>>>         Documentation/devicetree/bindings/arm/gemini.txt
>>> Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
>>> Documentation/devicetree/bindings/arm/keystone/keystone.txt
>>>         Documentation/devicetree/bindings/arm/mediatek.txt
>>>         Documentation/devicetree/bindings/arm/rockchip.txt
>>>         Documentation/devicetree/bindings/arm/shmobile.txt
>>>         Documentation/devicetree/bindings/arm/tegra.txt
>>> Documentation/devicetree/bindings/ata/ahci-fsl-qoriq.txt
>>> Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt
>>> Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt
>>> Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt
>>>         Documentation/devicetree/bindings/gpio/gpio_atmel.txt
>>> Documentation/devicetree/bindings/iio/adc/amlogic,meson-saradc.txt
>>> Documentation/devicetree/bindings/iio/adc/renesas,gyroadc.txt
>>> Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
>>> Documentation/devicetree/bindings/iio/imu/st_lsm6dsx.txt
>>> Documentation/devicetree/bindings/interrupt-controller/allwinner,sunxi-nmi.txt 
>>>
>>> Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2400-vic.txt 
>>>
>>> Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt 
>>>
>>>         Documentation/devicetree/bindings/leds/common.txt
>>>         Documentation/devicetree/bindings/mfd/hi6421.txt
>>>         Documentation/devicetree/bindings/mfd/tps65910.txt
>>>         Documentation/devicetree/bindings/mmc/fsl-esdhc.txt
>>>         Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
>>> Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt
>>> Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
>>>         Documentation/devicetree/bindings/mtd/atmel-nand.txt
>>>         Documentation/devicetree/bindings/net/dsa/b53.txt
>>>         Documentation/devicetree/bindings/net/ethernet.txt
>>>         Documentation/devicetree/bindings/net/macb.txt
>>> Documentation/devicetree/bindings/net/marvell-orion-mdio.txt
>>>         Documentation/devicetree/bindings/net/ti,wilink-st.txt
>>> Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt
>>> Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
>>>         Documentation/devicetree/bindings/opp/opp.txt
>>> Documentation/devicetree/bindings/phy/bcm-ns-usb3-phy.txt
>>> Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
>>> Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt
>>> Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
>>> Documentation/devicetree/bindings/power/rockchip-io-domain.txt
>>> Documentation/devicetree/bindings/power/supply/bq27xxx.txt
>>>         Documentation/devicetree/bindings/property-units.txt
>>> Documentation/devicetree/bindings/regulator/regulator.txt
>>>         Documentation/devicetree/bindings/serial/8
>>> error: The following untracked working tree files would be 
>>> overwritten by checkout:
>>>         Documentation/ABI/testing/sysfs-class-net-phydev
>>>         Documentation/DocBook/.gitignore
>>>         Documentation/DocBook/Makefile
>>>         Documentation/DocBook/filesystems.tmpl
>>>         Documentation/DocBook/kernel-hacking.tmpl
>>>         Documentation/DocBook/kernel-locking.tmpl
>>>         Documentation/DocBook/kgdb.tmpl
>>>         Documentation/DocBook/libata.tmpl
>>>         Documentation/DocBook/librs.tmpl
>>>         Documentation/DocBook/lsm.tmpl
>>>         Documentation/DocBook/mtdnand.tmpl
>>>         Documentation/DocBook/networking.tmpl
>>>         Documentation/DocBook/rapidio.tmpl
>>>         Documentation/DocBook/s390-drivers.tmpl
>>>         Documentation/DocBook/scsi.tmpl
>>>         Documentation/DocBook/sh.tmpl
>>>         Documentation/DocBook/stylesheet.xsl
>>>         Documentation/DocBook/w1.tmpl
>>>         Documentation/DocBook/z8530book.tmpl
>>>         Documentation/Makefile.sphinx
>>>         Documentation/RCU/trace.txt
>>>         Documentation/devicetree/bindings/i2c/i2c-mt6577.txt
>>> Documentation/devicetree/bindings/misc/allwinner,syscon.txt
>>>         Documentation/devicetree/bindings/net/cortina.txt
>>>         Documentation/devicetree/bindings/net/dsa/ksz.txt
>>>         Documentation/devicetree/bindings/net/dwmac-sun8i.txt
>>>         Documentation/devicetree/bindings/net/qca,qca7000.txt
>>> Documentation/devicetree/bindings/power/max8903-charger.txt
>>> Documentation/devicetree/bindings/power_supply/maxim,max14656.txt
>>>         Documentation/devicetree/bindings/ptp/brcm,ptp-dte.txt
>>> Documentation/devicetree/bindings/timer/moxa,moxart-timer.txt
>>>         Documentation/doc-guide/docbook.rst
>>>         Documentation/networking/tls.txt
>>>         Documentation/prctl/no_new_privs.txt
>>>         Documentation/prctl/seccomp_filter.txt
>>>         Documentation/security/00-INDEX
>>>         Documentation/security/IMA-templates.txt
>>>         Documentation/security/LSM.txt
>>>         Documentation/security/LoadPin.txt
>>>         Documentation/security/SELinux.txt
>>>         Documentation/security/Smack.txt
>>>         Documentation/security/Yama.txt
>>>         Documentation/security/apparmor.txt
>>>         Documentation/security/conf.py
>>>         Documentation/security/credentials.txt
>>>         Documentation/security/keys-ecryptfs.txt
>>>         Documentation/security/keys-request-key.txt
>>>         Documentation/security/keys-trusted-encrypted.txt
>>>         Documentation/security/keys.txt
>>>         Documentation/security/self-protection.txt
>>>         Documentation/security/tomoyo.txt
>>>         Documentation/sphinx/convert_template.sed
>>>         Documentation/sphinx/post_convert.sed
>>>         Documentation/sphinx/tmplcvt
>>>         Documentation/usb/typec.rst
>>>         Documentation/usb/usb3-debug-port.rst
>>>         arch/arm/boot/dts/rk1108-evb.dts
>>>         arch/arm/boot/dts/rk1108.dtsi
>>>         arch/arm/boot/dts/tegra20-whistler.dts
>>>         arch/arm/mach-omap2/opp.c
>>>         arch/arm/mach-omap2/pmu.c
>>>         arch/ia64/include/asm/siginfo.h
>>>         arch/m32r/include/uapi/asm/siginfo.h
>>>         arch/microblaze/include/asm/bitops.h
>>>         arch/microblaze/include/asm/bug.h
>>>         arch/microblaze/include/asm/bugs.h
>>>         arch/microblaze/include/asm/div64.h
>>>         arch/microblaze/include/asm/emergency-restart.h
>>>         arch/microblaze/include/asm/fb.h
>>>         arch/microblaze/include/asm/hardirq.h
>>>         arch/microblaze/include/asm/irq_regs.h
>>>         arch/microblaze/include/asm/kdebug.h
>>>         arch/microblaze/include/asm/kmap_types.h
>>>         arch/microblaze/include/asm/linkage.h
>>>         arch/microblaze/include/asm/local.h
>>>         arch/microblaze/include/asm/local64.h
>>>         arch/microblaze/include/asm/parport.h
>>>         arch/microblaze/include/asm/percpu.h
>>>         arch/microblaze/include/asm/serial.h
>>>         arch/microblaze/include/asm/shmparam.h
>>>         arch/microblaze/include/asm/topology.h
>>>         arch/microblaze/include/asm/ucontext.h
>>>         arch/microblaze/include/asm/vga.h
>>>         arch/microblaze/include/asm/xor.h
>>>         arch/microblaze/include/uapi/asm/bitsperlong.h
>>>         arch/microblaze/include/uapi/asm/errno.h
>>>         arch/microblaze/include/uapi/asm/fcntl.h
>>>         arch/microblaze/include/uapi/asm/ioctl.h
>>>         arch/microblaze/include/uapi/asm/ioctls.h
>>>         arch/microblaze/include/uapi/asm/ipcbuf.h
>>>         arch/microblaze/include/uapi/asm/kvm_para.h
>>>         arch/microblaze/include/uapi/asm/mman.h
>>>         arch/microblaze/include/uapi/asm/msgbuf.h
>>>         arch/microblaze/include/uapi/asm/param.h
>>>         arch/microblaze/include/uapi/asm/poll.h
>>>         arch/microblaze/include/uapi/asm/resource.h
>>>         arch/microblaze/include/uapi/asm/sembuf.h
>>>         arch/microblaze/include/uapi/asm/shmbuf.h
>>>         arch/microblaze/include/uapi/asm/siginfo.h
>>>         arch/microblaze/include/uapi/asm/signal.h
>>>         arch/microblaze/includ
>>> Aborting
>>>
>>>
>>>
>>> W dniu 2017-09-20 o 11:45, Paweł Staszewski pisze:
>>>> Ok looks like ending bisection
>>>>
>>>>
>>>> Latest bisected kernel when there is no kernel panic 4.12.0+ (from 
>>>> next)  - but only this warning:
>>>>
>>>> [  309.030019] NETDEV WATCHDOG: enp4s0f0 (ixgbe): transmit queue 0 
>>>> timed out
>>>> [  309.030034] ------------[ cut here ]------------
>>>> [  309.030040] WARNING: CPU: 35 PID: 0 at dev_watchdog+0xcf/0x139
>>>> [  309.030041] Modules linked in: bonding ipmi_si x86_pkg_temp_thermal
>>>> [  309.030045] CPU: 35 PID: 0 Comm: swapper/35 Not tainted 4.12.0+ #5
>>>> [  309.030046] task: ffff88086d98a000 task.stack: ffffc90003378000
>>>> [  309.030048] RIP: 0010:dev_watchdog+0xcf/0x139
>>>> [  309.030049] RSP: 0018:ffff88087fbc3ea8 EFLAGS: 00010246
>>>> [  309.030050] RAX: 000000000000003d RBX: ffff88046b680000 RCX: 
>>>> 0000000000000000
>>>> [  309.030050] RDX: ffff88087fbd2f01 RSI: 0000000000000000 RDI: 
>>>> ffff88087fbcda08
>>>> [  309.030051] RBP: ffff88087fbc3eb8 R08: 0000000000000000 R09: 
>>>> ffff88087ff80a04
>>>> [  309.030051] R10: 0000000000000000 R11: ffff88086d98a001 R12: 
>>>> 0000000000000000
>>>> [  309.030052] R13: ffff88087fbc3ef8 R14: ffff88086d98a000 R15: 
>>>> ffffffff81c06008
>>>> [  309.030053] FS:  0000000000000000(0000) 
>>>> GS:ffff88087fbc0000(0000) knlGS:0000000000000000
>>>> [  309.030054] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>>> [  309.030054] CR2: 00007fba600f6098 CR3: 000000086b955000 CR4: 
>>>> 00000000001406e0
>>>> [  309.030055] Call Trace:
>>>> [  309.030057]  <IRQ>
>>>> [  309.030059]  ? netif_tx_lock+0x79/0x79
>>>> [  309.030062]  call_timer_fn.isra.24+0x17/0x77
>>>> [  309.030063]  run_timer_softirq+0x118/0x161
>>>> [  309.030065]  ? netif_tx_lock+0x79/0x79
>>>> [  309.030066]  ? ktime_get+0x2b/0x42
>>>> [  309.030070]  ? lapic_next_deadline+0x21/0x27
>>>> [  309.030073]  ? clockevents_program_event+0xa8/0xc5
>>>> [  309.030076]  __do_softirq+0xa8/0x19d
>>>> [  309.030078]  irq_exit+0x5d/0x6b
>>>> [  309.030079]  smp_apic_timer_interrupt+0x2a/0x36
>>>> [  309.030082]  apic_timer_interrupt+0x89/0x90
>>>> [  309.030085] RIP: 0010:mwait_idle+0x4e/0x6a
>>>> [  309.030086] RSP: 0018:ffffc9000337be98 EFLAGS: 00000246 
>>>> ORIG_RAX: ffffffffffffff10
>>>> [  309.030087] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 
>>>> 0000000000000000
>>>> [  309.030087] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 
>>>> ffff88086d98a000
>>>> [  309.030088] RBP: ffffc9000337be98 R08: ffff88046f8279a0 R09: 
>>>> ffff88046f827040
>>>> [  309.030089] R10: ffff88086d98a000 R11: ffff88086d98a000 R12: 
>>>> 0000000000000000
>>>> [  309.030089] R13: ffff88086d98a000 R14: ffff88086d98a000 R15: 
>>>> ffff88086d98a000
>>>> [  309.030090]  </IRQ>
>>>> [  309.030094]  arch_cpu_idle+0xa/0xc
>>>> [  309.030095]  default_idle_call+0x19/0x1b
>>>> [  309.030102]  do_idle+0xbc/0x196
>>>> [  309.030104]  cpu_startup_entry+0x1d/0x20
>>>> [  309.030105]  start_secondary+0xd8/0xdc
>>>> [  309.030108]  secondary_startup_64+0x9f/0x9f
>>>> [  309.030109] Code: cc 75 bd eb 35 48 89 df c6 05 c3 dc 74 00 01 
>>>> e8 3a 62 fe ff 44 89 e1 48 89 de 48 89 c2 48 c7 c7 0f 65 a4 81 31 
>>>> c0 e8 3d 4c b5 ff <0f> ff 48 8b 83 e0 01 00 00 48 89 df ff 50 78 48 
>>>> 8b 05 a0 bc 6a
>>>> [  309.030128] ---[ end trace 9102cb25703ae2d9 ]---
>>>>
>>>>
>>>> I just marked it as good - cause this problem above is differend - 
>>>> and im going to:
>>>>
>>>> git bisect good
>>>> Bisecting: 1787 revisions left to test after this (roughly 11 steps)
>>>>
>>>>
>>>>
>>>>
>>>> W dniu 2017-09-20 o 10:44, Paweł Staszewski pisze:
>>>>> Trying to make video from ipmi :)
>>>>>
>>>>> with that results:
>>>>>
>>>>> https://bugzilla.kernel.org/attachment.cgi?id=258521
>>>>>
>>>>> catched two more lines where it starts - panic from 4.13.2.
>>>>>
>>>>>
>>>>> Now will try tro do some bisection
>>>>>
>>>>>
>>>>>
>>>>> W dniu 2017-09-20 o 09:58, Paweł Staszewski pisze:
>>>>>> Hi
>>>>>>
>>>>>>
>>>>>> Will try bisecting tonight
>>>>>>
>>>>>>
>>>>>>
>>>>>> W dniu 2017-09-20 o 05:24, Eric Dumazet pisze:
>>>>>>> On Wed, 2017-09-20 at 02:06 +0200, Paweł Staszewski wrote:
>>>>>>>> Just checked kernel 4.13.2 and same problem
>>>>>>>>
>>>>>>>> Just after start all 6 bgp sessions - and kernel starts to 
>>>>>>>> learn routes
>>>>>>>> it panic.
>>>>>>>>
>>>>>>>> https://bugzilla.kernel.org/attachment.cgi?id=258509
>>>>>>>>
>>>>>>>
>>>>>>> Unfortunately we have not enough information from these traces.
>>>>>>>
>>>>>>> Can you get a full stack trace ?
>>>>>>>
>>>>>>> Alternatively, can you bisect ?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

^ permalink raw reply

* Re: [PATCH v2 1/2] mac80211: Add rcu read side critical sections
From: Johannes Berg @ 2017-09-20 12:17 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, David S. Miller,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20170920121137.GZ4914-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Wed, 2017-09-20 at 15:11 +0300, Ville Syrjälä wrote:
> 
> > I guess since the outer pointer isn't protected, only the inner ...
> 
> I think just the fact that even the pointers in ieee80211_tx_data
> don't have the __rcu annotation makes it rather hard to see what is
> really rcu protected and what isn't. If every user of those pointers
> would have to do the rcu_dereference() things would be rather more
> explicit.

It wouldn't make sense though, because those users don't need to
provide the protection, and they don't need to make sure to use the
pointer in an RCU safe manner (access once etc.) since they're in code
that can't really go wrong... mostly.

> > Therefore, this patch is wrong.
> 
> OK, so the problem is in ath9k then.

I agree.

> > I actually think the same is true for ieee80211_tx_dequeue(), but 
[...]
> Well, I think this is as far as I want to dig into the matter. I can
> respin the patch once more with just tx_dequeue() fix in there, if
> you want (not sure you do if you think it's wrong as well). After
> that I'll leave it to someone who actually knows what they're doing
> with mac80211 ;)

:-)
I think we should rather document that RCU is required for that
function, I think for some usages it may be OK without but with keys
I'm pretty sure you'll need it.

johannes

^ permalink raw reply

* Re: [PATCH v2 1/2] mac80211: Add rcu read side critical sections
From: Ville Syrjälä @ 2017-09-20 12:11 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, David S. Miller,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1505903964.3026.14.camel-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>

On Wed, Sep 20, 2017 at 12:39:24PM +0200, Johannes Berg wrote:
> On Wed, 2017-09-20 at 13:11 +0300, Ville Syrjala wrote:
> 
> > --- a/net/mac80211/tx.c
> > +++ b/net/mac80211/tx.c
> > @@ -1770,15 +1770,21 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
> >  	struct ieee80211_tx_data tx;
> >  	struct sk_buff *skb2;
> >  
> > -	if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP)
> > +	rcu_read_lock();
> 
> The documentation says:
> 
> /**
>  * ieee80211_tx_prepare_skb - prepare an 802.11 skb for transmission
>  * @hw: pointer as obtained from ieee80211_alloc_hw()
>  * @vif: virtual interface
>  * @skb: frame to be sent from within the driver
>  * @band: the band to transmit on
>  * @sta: optional pointer to get the station to send the frame to
>  *
>  * Note: must be called under RCU lock
>  */
> 
> You can't even argue that it should be the function itself doing it,
> because the (admittedly optional) sta pointer would otherwise not have
> proper protection after you leave the function ... You can't pass out a
> sta pointer that's RCU protected.

Yeah, I suppose that would need rcu_handoff+some other mechanism to
make sure it stays around after that.

> 
> Side note: Perhaps some annotation should be there? not sure it's
> possible - would have to be something like
> 	struct ieee80211_sta * __rcu *sta;
> 
> I guess since the outer pointer isn't protected, only the inner ...

I think just the fact that even the pointers in ieee80211_tx_data don't
have the __rcu annotation makes it rather hard to see what is really rcu
protected and what isn't. If every user of those pointers would have to
do the rcu_dereference() things would be rather more explicit.

> Therefore, this patch is wrong.

OK, so the problem is in ath9k then.

> I actually think the same is true for ieee80211_tx_dequeue(), but I'm
> less sure about it - the sta pointer there clearly is somehow safely
> passed in (even if it's w/o RCU, the driver can potentially make that
> safe), but the key pointer seems unsafe in this case (as well) if
> there's no outer RCU protection.

Well, I think this is as far as I want to dig into the matter. I can
respin the patch once more with just tx_dequeue() fix in there, if you
want (not sure you do if you think it's wrong as well). After that I'll
leave it to someone who actually knows what they're doing with mac80211 ;)

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply

* [PATCH net-next 10/10] net/smc: no close wait in case of process shut down
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

Usually socket closing is delayed if there is still data available in
the send buffer to be transmitted. If a process is killed, the delay
should be avoided.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc_close.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index 5201bc103bd8..f0d16fb825f7 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -174,15 +174,15 @@ int smc_close_active(struct smc_sock *smc)
 {
 	struct smc_cdc_conn_state_flags *txflags =
 		&smc->conn.local_tx_ctrl.conn_state_flags;
-	long timeout = SMC_MAX_STREAM_WAIT_TIMEOUT;
 	struct smc_connection *conn = &smc->conn;
 	struct sock *sk = &smc->sk;
 	int old_state;
+	long timeout;
 	int rc = 0;
 
-	if (sock_flag(sk, SOCK_LINGER) &&
-	    !(current->flags & PF_EXITING))
-		timeout = sk->sk_lingertime;
+	timeout = current->flags & PF_EXITING ?
+		  0 : sock_flag(sk, SOCK_LINGER) ?
+		      sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT;
 
 again:
 	old_state = sk->sk_state;
@@ -413,13 +413,14 @@ void smc_close_sock_put_work(struct work_struct *work)
 int smc_close_shutdown_write(struct smc_sock *smc)
 {
 	struct smc_connection *conn = &smc->conn;
-	long timeout = SMC_MAX_STREAM_WAIT_TIMEOUT;
 	struct sock *sk = &smc->sk;
 	int old_state;
+	long timeout;
 	int rc = 0;
 
-	if (sock_flag(sk, SOCK_LINGER))
-		timeout = sk->sk_lingertime;
+	timeout = current->flags & PF_EXITING ?
+		  0 : sock_flag(sk, SOCK_LINGER) ?
+		      sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT;
 
 again:
 	old_state = sk->sk_state;
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 09/10] net/smc: parameter cleanup in smc_cdc_get_free_slot()
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

Use the smc_connection as first parameter with smc_cdc_get_free_slot().
This is just a small code cleanup, no functional change.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc_cdc.c | 7 ++++---
 net/smc/smc_cdc.h | 3 ++-
 net/smc/smc_tx.c  | 6 ++----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index a7294edbc221..5ef97e5a5f78 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -62,10 +62,12 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd,
 	bh_unlock_sock(&smc->sk);
 }
 
-int smc_cdc_get_free_slot(struct smc_link *link,
+int smc_cdc_get_free_slot(struct smc_connection *conn,
 			  struct smc_wr_buf **wr_buf,
 			  struct smc_cdc_tx_pend **pend)
 {
+	struct smc_link *link = &conn->lgr->lnk[SMC_SINGLE_LINK];
+
 	return smc_wr_tx_get_free_slot(link, smc_cdc_tx_handler, wr_buf,
 				       (struct smc_wr_tx_pend_priv **)pend);
 }
@@ -118,8 +120,7 @@ int smc_cdc_get_slot_and_msg_send(struct smc_connection *conn)
 	struct smc_wr_buf *wr_buf;
 	int rc;
 
-	rc = smc_cdc_get_free_slot(&conn->lgr->lnk[SMC_SINGLE_LINK], &wr_buf,
-				   &pend);
+	rc = smc_cdc_get_free_slot(conn, &wr_buf, &pend);
 	if (rc)
 		return rc;
 
diff --git a/net/smc/smc_cdc.h b/net/smc/smc_cdc.h
index 8e1d76f26007..56f883d1159c 100644
--- a/net/smc/smc_cdc.h
+++ b/net/smc/smc_cdc.h
@@ -206,7 +206,8 @@ static inline void smc_cdc_msg_to_host(struct smc_host_cdc_msg *local,
 
 struct smc_cdc_tx_pend;
 
-int smc_cdc_get_free_slot(struct smc_link *link, struct smc_wr_buf **wr_buf,
+int smc_cdc_get_free_slot(struct smc_connection *conn,
+			  struct smc_wr_buf **wr_buf,
 			  struct smc_cdc_tx_pend **pend);
 void smc_cdc_tx_dismiss_slots(struct smc_connection *conn);
 int smc_cdc_msg_send(struct smc_connection *conn, struct smc_wr_buf *wr_buf,
diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
index 3866573288dd..ec49bc3c3283 100644
--- a/net/smc/smc_tx.c
+++ b/net/smc/smc_tx.c
@@ -396,8 +396,7 @@ int smc_tx_sndbuf_nonempty(struct smc_connection *conn)
 	int rc;
 
 	spin_lock_bh(&conn->send_lock);
-	rc = smc_cdc_get_free_slot(&conn->lgr->lnk[SMC_SINGLE_LINK], &wr_buf,
-				   &pend);
+	rc = smc_cdc_get_free_slot(conn, &wr_buf, &pend);
 	if (rc < 0) {
 		if (rc == -EBUSY) {
 			struct smc_sock *smc =
@@ -466,8 +465,7 @@ void smc_tx_consumer_update(struct smc_connection *conn)
 	    ((to_confirm > conn->rmbe_update_limit) &&
 	     ((to_confirm > (conn->rmbe_size / 2)) ||
 	      conn->local_rx_ctrl.prod_flags.write_blocked))) {
-		rc = smc_cdc_get_free_slot(&conn->lgr->lnk[SMC_SINGLE_LINK],
-					   &wr_buf, &pend);
+		rc = smc_cdc_get_free_slot(conn, &wr_buf, &pend);
 		if (!rc)
 			rc = smc_cdc_msg_send(conn, wr_buf, pend);
 		if (rc < 0) {
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 08/10] net/smc: introduce a delay
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

The number of outstanding work requests is limited. If all work
requests are in use, tx processing is postponed to another scheduling
of the tx worker. Switch to a delayed worker to have a gap for tx
completion queue events before the next retry.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc.h       |  2 +-
 net/smc/smc_close.c | 12 +++++++-----
 net/smc/smc_tx.c    | 12 ++++++++----
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/net/smc/smc.h b/net/smc/smc.h
index 6e44313e4467..0ccd6fa387ad 100644
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -149,7 +149,7 @@ struct smc_connection {
 	atomic_t		sndbuf_space;	/* remaining space in sndbuf */
 	u16			tx_cdc_seq;	/* sequence # for CDC send */
 	spinlock_t		send_lock;	/* protect wr_sends */
-	struct work_struct	tx_work;	/* retry of smc_cdc_msg_send */
+	struct delayed_work	tx_work;	/* retry of smc_cdc_msg_send */
 
 	struct smc_host_cdc_msg	local_rx_ctrl;	/* filled during event_handl.
 						 * .prod cf. TCP rcv_nxt
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index 3c2e166b5d22..5201bc103bd8 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -208,7 +208,7 @@ int smc_close_active(struct smc_sock *smc)
 	case SMC_ACTIVE:
 		smc_close_stream_wait(smc, timeout);
 		release_sock(sk);
-		cancel_work_sync(&conn->tx_work);
+		cancel_delayed_work_sync(&conn->tx_work);
 		lock_sock(sk);
 		if (sk->sk_state == SMC_ACTIVE) {
 			/* send close request */
@@ -234,7 +234,7 @@ int smc_close_active(struct smc_sock *smc)
 		if (!smc_cdc_rxed_any_close(conn))
 			smc_close_stream_wait(smc, timeout);
 		release_sock(sk);
-		cancel_work_sync(&conn->tx_work);
+		cancel_delayed_work_sync(&conn->tx_work);
 		lock_sock(sk);
 		if (sk->sk_err != ECONNABORTED) {
 			/* confirm close from peer */
@@ -263,7 +263,9 @@ int smc_close_active(struct smc_sock *smc)
 		/* peer sending PeerConnectionClosed will cause transition */
 		break;
 	case SMC_PROCESSABORT:
-		cancel_work_sync(&conn->tx_work);
+		release_sock(sk);
+		cancel_delayed_work_sync(&conn->tx_work);
+		lock_sock(sk);
 		smc_close_abort(conn);
 		sk->sk_state = SMC_CLOSED;
 		smc_close_wait_tx_pends(smc);
@@ -425,7 +427,7 @@ int smc_close_shutdown_write(struct smc_sock *smc)
 	case SMC_ACTIVE:
 		smc_close_stream_wait(smc, timeout);
 		release_sock(sk);
-		cancel_work_sync(&conn->tx_work);
+		cancel_delayed_work_sync(&conn->tx_work);
 		lock_sock(sk);
 		/* send close wr request */
 		rc = smc_close_wr(conn);
@@ -439,7 +441,7 @@ int smc_close_shutdown_write(struct smc_sock *smc)
 		if (!smc_cdc_rxed_any_close(conn))
 			smc_close_stream_wait(smc, timeout);
 		release_sock(sk);
-		cancel_work_sync(&conn->tx_work);
+		cancel_delayed_work_sync(&conn->tx_work);
 		lock_sock(sk);
 		/* confirm close from peer */
 		rc = smc_close_wr(conn);
diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
index 3c656beb8820..3866573288dd 100644
--- a/net/smc/smc_tx.c
+++ b/net/smc/smc_tx.c
@@ -24,6 +24,8 @@
 #include "smc_cdc.h"
 #include "smc_tx.h"
 
+#define SMC_TX_WORK_DELAY	HZ
+
 /***************************** sndbuf producer *******************************/
 
 /* callback implementation for sk.sk_write_space()
@@ -406,7 +408,8 @@ int smc_tx_sndbuf_nonempty(struct smc_connection *conn)
 				goto out_unlock;
 			}
 			rc = 0;
-			schedule_work(&conn->tx_work);
+			schedule_delayed_work(&conn->tx_work,
+					      SMC_TX_WORK_DELAY);
 		}
 		goto out_unlock;
 	}
@@ -430,7 +433,7 @@ int smc_tx_sndbuf_nonempty(struct smc_connection *conn)
  */
 static void smc_tx_work(struct work_struct *work)
 {
-	struct smc_connection *conn = container_of(work,
+	struct smc_connection *conn = container_of(to_delayed_work(work),
 						   struct smc_connection,
 						   tx_work);
 	struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
@@ -468,7 +471,8 @@ void smc_tx_consumer_update(struct smc_connection *conn)
 		if (!rc)
 			rc = smc_cdc_msg_send(conn, wr_buf, pend);
 		if (rc < 0) {
-			schedule_work(&conn->tx_work);
+			schedule_delayed_work(&conn->tx_work,
+					      SMC_TX_WORK_DELAY);
 			return;
 		}
 		smc_curs_write(&conn->rx_curs_confirmed,
@@ -487,6 +491,6 @@ void smc_tx_consumer_update(struct smc_connection *conn)
 void smc_tx_init(struct smc_sock *smc)
 {
 	smc->sk.sk_write_space = smc_tx_write_space;
-	INIT_WORK(&smc->conn.tx_work, smc_tx_work);
+	INIT_DELAYED_WORK(&smc->conn.tx_work, smc_tx_work);
 	spin_lock_init(&smc->conn.send_lock);
 }
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 05/10] net/smc: adapt send request completion notification
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

The solicited flag is meaningful for the receive completion queue.
Ask for next work completion of any type on the send queue.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc_wr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c
index ab56bda66783..525d91e0d57e 100644
--- a/net/smc/smc_wr.c
+++ b/net/smc/smc_wr.c
@@ -244,7 +244,7 @@ int smc_wr_tx_send(struct smc_link *link, struct smc_wr_tx_pend_priv *priv)
 	int rc;
 
 	ib_req_notify_cq(link->smcibdev->roce_cq_send,
-			 IB_CQ_SOLICITED_MASK | IB_CQ_REPORT_MISSED_EVENTS);
+			 IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS);
 	pend = container_of(priv, struct smc_wr_tx_pend, priv);
 	rc = ib_post_send(link->roce_qp, &link->wr_tx_ibs[pend->idx],
 			  &failed_wr);
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 07/10] net/smc: terminate link group if out-of-sync is received
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

An out-of-sync condition can just be detected by the client.
If the server receives a CLC DECLINE message indicating an out-of-sync
condition for the link groups, the server must clean up the out-of-sync
link group.
There is no need for an extra third parameter in smc_clc_send_decline().

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/af_smc.c  |  6 ++----
 net/smc/smc_clc.c | 10 +++++-----
 net/smc/smc_clc.h |  3 +--
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 2e8d2dabac0c..745f145d4c4d 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -513,7 +513,7 @@ static int smc_connect_rdma(struct smc_sock *smc)
 	/* RDMA setup failed, switch back to TCP */
 	smc->use_fallback = true;
 	if (reason_code && (reason_code != SMC_CLC_DECL_REPLY)) {
-		rc = smc_clc_send_decline(smc, reason_code, 0);
+		rc = smc_clc_send_decline(smc, reason_code);
 		if (rc < sizeof(struct smc_clc_msg_decline))
 			goto out_err;
 	}
@@ -808,8 +808,6 @@ static void smc_listen_work(struct work_struct *work)
 		rc = local_contact;
 		if (rc == -ENOMEM)
 			reason_code = SMC_CLC_DECL_MEM;/* insufficient memory*/
-		else if (rc == -ENOLINK)
-			reason_code = SMC_CLC_DECL_SYNCERR; /* synchr. error */
 		goto decline_rdma;
 	}
 	link = &new_smc->conn.lgr->lnk[SMC_SINGLE_LINK];
@@ -903,7 +901,7 @@ static void smc_listen_work(struct work_struct *work)
 	smc_conn_free(&new_smc->conn);
 	new_smc->use_fallback = true;
 	if (reason_code && (reason_code != SMC_CLC_DECL_REPLY)) {
-		rc = smc_clc_send_decline(new_smc, reason_code, 0);
+		rc = smc_clc_send_decline(new_smc, reason_code);
 		if (rc < sizeof(struct smc_clc_msg_decline))
 			goto out_err;
 	}
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
index 3934913ab835..b7dd2743fb5c 100644
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@ -95,9 +95,10 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
 	}
 	if (clcm->type == SMC_CLC_DECLINE) {
 		reason_code = SMC_CLC_DECL_REPLY;
-		if (ntohl(((struct smc_clc_msg_decline *)buf)->peer_diagnosis)
-			== SMC_CLC_DECL_SYNCERR)
+		if (((struct smc_clc_msg_decline *)buf)->hdr.flag) {
 			smc->conn.lgr->sync_err = true;
+			smc_lgr_terminate(smc->conn.lgr);
+		}
 	}
 
 out:
@@ -105,8 +106,7 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
 }
 
 /* send CLC DECLINE message across internal TCP socket */
-int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info,
-			 u8 out_of_sync)
+int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info)
 {
 	struct smc_clc_msg_decline dclc;
 	struct msghdr msg;
@@ -118,7 +118,7 @@ int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info,
 	dclc.hdr.type = SMC_CLC_DECLINE;
 	dclc.hdr.length = htons(sizeof(struct smc_clc_msg_decline));
 	dclc.hdr.version = SMC_CLC_V1;
-	dclc.hdr.flag = out_of_sync ? 1 : 0;
+	dclc.hdr.flag = (peer_diag_info == SMC_CLC_DECL_SYNCERR) ? 1 : 0;
 	memcpy(dclc.id_for_peer, local_systemid, sizeof(local_systemid));
 	dclc.peer_diagnosis = htonl(peer_diag_info);
 	memcpy(dclc.trl.eyecatcher, SMC_EYECATCHER, sizeof(SMC_EYECATCHER));
diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
index 13db8ce177c9..1c55414041d4 100644
--- a/net/smc/smc_clc.h
+++ b/net/smc/smc_clc.h
@@ -106,8 +106,7 @@ struct smc_ib_device;
 
 int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen,
 		     u8 expected_type);
-int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info,
-			 u8 out_of_sync);
+int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info);
 int smc_clc_send_proposal(struct smc_sock *smc, struct smc_ib_device *smcibdev,
 			  u8 ibport);
 int smc_clc_send_confirm(struct smc_sock *smc);
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 06/10] net/smc: longer delay for client link group removal
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

Client link group creation always follows the server linkgroup creation.
If peer creates a new server link group, client has to create a new
client link group. If peer reuses a server link group for a new
connection, client has to reuse its client link group as well. This
patch introduces a longer delay for client link group removal to make
sure this link group still exists, once the peer decides to reuse a
server link group. This avoids out-of-sync conditions for link groups.
If already scheduled, modify the delay.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc_core.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 1a16d51e2330..20b66e79c5d6 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -25,8 +25,9 @@
 #include "smc_cdc.h"
 #include "smc_close.h"
 
-#define SMC_LGR_NUM_INCR	256
-#define SMC_LGR_FREE_DELAY	(600 * HZ)
+#define SMC_LGR_NUM_INCR		256
+#define SMC_LGR_FREE_DELAY_SERV		(600 * HZ)
+#define SMC_LGR_FREE_DELAY_CLNT		(SMC_LGR_FREE_DELAY_SERV + 10)
 
 static u32 smc_lgr_num;			/* unique link group number */
 
@@ -107,8 +108,15 @@ static void smc_lgr_unregister_conn(struct smc_connection *conn)
 		__smc_lgr_unregister_conn(conn);
 	}
 	write_unlock_bh(&lgr->conns_lock);
-	if (reduced && !lgr->conns_num)
-		schedule_delayed_work(&lgr->free_work, SMC_LGR_FREE_DELAY);
+	if (!reduced || lgr->conns_num)
+		return;
+	/* client link group creation always follows the server link group
+	 * creation. For client use a somewhat higher removal delay time,
+	 * otherwise there is a risk of out-of-sync link groups.
+	 */
+	mod_delayed_work(system_wq, &lgr->free_work,
+			 lgr->role == SMC_CLNT ? SMC_LGR_FREE_DELAY_CLNT :
+						 SMC_LGR_FREE_DELAY_SERV);
 }
 
 static void smc_lgr_free_work(struct work_struct *work)
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 04/10] net/smc: adjust net_device refcount
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

smc_pnet_fill_entry() uses dev_get_by_name() adding a refcount to ndev.
The following smc_pnet_enter() has to reduce the refcount if the entry
to be added exists already in the pnet table.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc_pnet.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c
index 78f7af28ae4f..31f8453c25c5 100644
--- a/net/smc/smc_pnet.c
+++ b/net/smc/smc_pnet.c
@@ -181,8 +181,10 @@ static int smc_pnet_enter(struct smc_pnetentry *new_pnetelem)
 			     sizeof(new_pnetelem->ndev->name)) ||
 		    smc_pnet_same_ibname(pnetelem,
 					 new_pnetelem->smcibdev->ibdev->name,
-					 new_pnetelem->ib_port))
+					 new_pnetelem->ib_port)) {
+			dev_put(pnetelem->ndev);
 			goto found;
+		}
 	}
 	list_add_tail(&new_pnetelem->list, &smc_pnettable.pnetlist);
 	rc = 0;
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 02/10] net/smc: add receive timeout check
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

From: Hans Wippel <hwippel@linux.vnet.ibm.com>

The SMC receive function currently lacks a timeout check under the
condition that no data were received and no data are available. This
patch adds such a check.

Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc_rx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
index b17a333e9bb0..3e631ae4b6b6 100644
--- a/net/smc/smc_rx.c
+++ b/net/smc/smc_rx.c
@@ -148,6 +148,8 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, size_t len,
 				read_done = sock_intr_errno(timeo);
 				break;
 			}
+			if (!timeo)
+				return -EAGAIN;
 		}
 
 		if (!atomic_read(&conn->bytes_to_rcv)) {
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 01/10] net/smc: add missing dev_put
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-rdma, linux-s390, jwi, schwidefsky, heiko.carstens,
	raspl, ubraun
In-Reply-To: <20170920115813.63745-1-ubraun@linux.vnet.ibm.com>

From: Hans Wippel <hwippel@linux.vnet.ibm.com>

In the infiniband part, SMC currently uses get_netdev which calls
dev_hold on the returned net device. However, the SMC code never calls
dev_put on that net device resulting in a wrong reference count.

This patch adds a dev_put after the usage of the net device to fix the
issue.

Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc_ib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c
index 547e0e113b17..0b5852299158 100644
--- a/net/smc/smc_ib.c
+++ b/net/smc/smc_ib.c
@@ -380,6 +380,7 @@ static int smc_ib_fill_gid_and_mac(struct smc_ib_device *smcibdev, u8 ibport)
 	ndev = smcibdev->ibdev->get_netdev(smcibdev->ibdev, ibport);
 	if (ndev) {
 		memcpy(&smcibdev->mac, ndev->dev_addr, ETH_ALEN);
+		dev_put(ndev);
 	} else if (!rc) {
 		memcpy(&smcibdev->mac[ibport - 1][0],
 		       &smcibdev->gid[ibport - 1].raw[8], 3);
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 03/10] net/smc: take RCU read lock for routing cache lookup
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-s390-u79uwXL29TY76Z2rM5mHXA,
	jwi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8,
	schwidefsky-tA70FqPdS9bQT0dZR+AlfA,
	heiko.carstens-tA70FqPdS9bQT0dZR+AlfA,
	raspl-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8,
	ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
In-Reply-To: <20170920115813.63745-1-ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

smc_netinfo_by_tcpsk() looks up the routing cache. Such a lookup requires
protection by an RCU read lock.

Signed-off-by: Ursula Braun <ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
 net/smc/af_smc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 8c6d24b2995d..2e8d2dabac0c 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -282,6 +282,7 @@ int smc_netinfo_by_tcpsk(struct socket *clcsock,
 			 __be32 *subnet, u8 *prefix_len)
 {
 	struct dst_entry *dst = sk_dst_get(clcsock->sk);
+	struct in_device *in_dev;
 	struct sockaddr_in addr;
 	int rc = -ENOENT;
 	int len;
@@ -298,14 +299,17 @@ int smc_netinfo_by_tcpsk(struct socket *clcsock,
 	/* get address to which the internal TCP socket is bound */
 	kernel_getsockname(clcsock, (struct sockaddr *)&addr, &len);
 	/* analyze IPv4 specific data of net_device belonging to TCP socket */
-	for_ifa(dst->dev->ip_ptr) {
-		if (ifa->ifa_address != addr.sin_addr.s_addr)
+	rcu_read_lock();
+	in_dev = __in_dev_get_rcu(dst->dev);
+	for_ifa(in_dev) {
+		if (!inet_ifa_match(addr.sin_addr.s_addr, ifa))
 			continue;
 		*prefix_len = inet_mask_len(ifa->ifa_mask);
 		*subnet = ifa->ifa_address & ifa->ifa_mask;
 		rc = 0;
 		break;
-	} endfor_ifa(dst->dev->ip_ptr);
+	} endfor_ifa(in_dev);
+	rcu_read_unlock();
 
 out_rel:
 	dst_release(dst);
-- 
2.13.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH net-next 00/10] net/smc: updates 2017-09-20
From: Ursula Braun @ 2017-09-20 11:58 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-s390-u79uwXL29TY76Z2rM5mHXA,
	jwi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8,
	schwidefsky-tA70FqPdS9bQT0dZR+AlfA,
	heiko.carstens-tA70FqPdS9bQT0dZR+AlfA,
	raspl-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8,
	ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8

Hi Dave,

here is a collection of small smc-patches built for net-next improving
the smc code in different areas.

Thanks,
Ursula

Hans Wippel (2):
  net/smc: add missing dev_put
  net/smc: add receive timeout check

Ursula Braun (8):
  net/smc: take RCU read lock for routing cache lookup
  net/smc: adjust net_device refcount
  net/smc: adapt send request completion notification
  net/smc: longer delay for client link group removal
  net/smc: terminate link group if out-of-sync is received
  net/smc: introduce a delay
  net/smc: parameter cleanup in smc_cdc_get_free_slot()
  net/smc: no close wait in case of process shut down

 net/smc/af_smc.c    | 16 +++++++++-------
 net/smc/smc.h       |  2 +-
 net/smc/smc_cdc.c   |  7 ++++---
 net/smc/smc_cdc.h   |  3 ++-
 net/smc/smc_clc.c   | 10 +++++-----
 net/smc/smc_clc.h   |  3 +--
 net/smc/smc_close.c | 27 +++++++++++++++------------
 net/smc/smc_core.c  | 16 ++++++++++++----
 net/smc/smc_ib.c    |  1 +
 net/smc/smc_pnet.c  |  4 +++-
 net/smc/smc_rx.c    |  2 ++
 net/smc/smc_tx.c    | 18 ++++++++++--------
 net/smc/smc_wr.c    |  2 +-
 13 files changed, 66 insertions(+), 45 deletions(-)

-- 
2.13.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: Latest net-next from GIT panic
From: Paweł Staszewski @ 2017-09-20 11:02 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Linux Kernel Network Developers
In-Reply-To: <7fee43ee-75b5-c2f5-cf8d-684ceefcd2d1@itcare.pl>

Ok resumed and soo far:

Panic:

# bad: [9cc9a5cb176ccb4f2cda5ac34da5a659926f125f] datapath: Avoid using 
stack larger than 1024.
git bisect bad 9cc9a5cb176ccb4f2cda5ac34da5a659926f125f

No panic:

# good: [073cf9e20c333ab29744717a23f9e43ec7512a20] Merge branch 
'udp-reduce-cache-pressure'
git bisect good 073cf9e20c333ab29744717a23f9e43ec7512a20


W dniu 2017-09-20 o 12:22, Paweł Staszewski pisze:
> Soo far bisected and marked:
>
> git bisect start
> # bad: [07dd6cc1fff160143e82cf5df78c1db0b6e03355] Linux 4.13.2
> git bisect bad 07dd6cc1fff160143e82cf5df78c1db0b6e03355
> # good: [5d7d2e03e0f01a992e3521b180c3d3e67905f269] Linux 4.12.13
> git bisect good 5d7d2e03e0f01a992e3521b180c3d3e67905f269
> # good: [6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c] Linux 4.12
> git bisect good 6f7da290413ba713f0cdd9ff1a2a9bb129ef4f6c
> # bad: [ac7b75966c9c86426b55fe1c50ae148aa4571075] Merge tag 
> 'pinctrl-v4.13-1' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
> git bisect bad ac7b75966c9c86426b55fe1c50ae148aa4571075
> # good: [e24dd9ee5399747b71c1d982a484fc7601795f31] Merge branch 'next' 
> of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
> git bisect good e24dd9ee5399747b71c1d982a484fc7601795f31
> # good: [e24dd9ee5399747b71c1d982a484fc7601795f31] Merge branch 'next' 
> of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
> git bisect good e24dd9ee5399747b71c1d982a484fc7601795f31
> # good: [e24dd9ee5399747b71c1d982a484fc7601795f31] Merge branch 'next' 
> of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
> git bisect good e24dd9ee5399747b71c1d982a484fc7601795f31
>
>
>
> W dniu 2017-09-20 o 12:21, Paweł Staszewski pisze:
>> Ok kernel crashed with different panic that i didnt catch when i was 
>> doing bisect and now my bisection is broken :)
>>
>> git bisect good
>> Bisecting: 1787 revisions left to test after this (roughly 11 steps)
>> error: Your local changes to the following files would be overwritten 
>> by checkout:
>>         Documentation/00-INDEX
>>         Documentation/ABI/stable/sysfs-class-udc
>>         Documentation/ABI/testing/configfs-usb-gadget-uac1
>>         Documentation/ABI/testing/ima_policy
>>         Documentation/ABI/testing/sysfs-bus-iio
>>         Documentation/ABI/testing/sysfs-bus-iio-meas-spec
>>         Documentation/ABI/testing/sysfs-bus-iio-timer-stm32
>>         Documentation/ABI/testing/sysfs-class-net
>>         Documentation/ABI/testing/sysfs-class-power-twl4030
>>         Documentation/ABI/testing/sysfs-class-typec
>>         Documentation/DMA-API.txt
>>         Documentation/IRQ-domain.txt
>>         Documentation/Makefile
>>         Documentation/PCI/MSI-HOWTO.txt
>>         Documentation/RCU/00-INDEX
>>         Documentation/RCU/Design/Requirements/Requirements.html
>>         Documentation/RCU/checklist.txt
>>         Documentation/admin-guide/README.rst
>>         Documentation/admin-guide/devices.txt
>>         Documentation/admin-guide/index.rst
>>         Documentation/admin-guide/kernel-parameters.txt
>>         Documentation/admin-guide/pm/cpufreq.rst
>>         Documentation/admin-guide/pm/intel_pstate.rst
>>         Documentation/admin-guide/ras.rst
>>         Documentation/arm/Atmel/README
>>         Documentation/block/biodoc.txt
>>         Documentation/conf.py
>>         Documentation/core-api/assoc_array.rst
>>         Documentation/core-api/atomic_ops.rst
>>         Documentation/core-api/index.rst
>>         Documentation/crypto/asymmetric-keys.txt
>>         Documentation/dev-tools/index.rst
>>         Documentation/dev-tools/sparse.rst
>>         Documentation/devicetree/bindings/arm/amlogic.txt
>>         Documentation/devicetree/bindings/arm/atmel-at91.txt
>>         Documentation/devicetree/bindings/arm/ccn.txt
>>         Documentation/devicetree/bindings/arm/cpus.txt
>>         Documentation/devicetree/bindings/arm/gemini.txt
>> Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
>> Documentation/devicetree/bindings/arm/keystone/keystone.txt
>>         Documentation/devicetree/bindings/arm/mediatek.txt
>>         Documentation/devicetree/bindings/arm/rockchip.txt
>>         Documentation/devicetree/bindings/arm/shmobile.txt
>>         Documentation/devicetree/bindings/arm/tegra.txt
>>         Documentation/devicetree/bindings/ata/ahci-fsl-qoriq.txt
>>         Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt
>> Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt
>>         Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt
>>         Documentation/devicetree/bindings/gpio/gpio_atmel.txt
>> Documentation/devicetree/bindings/iio/adc/amlogic,meson-saradc.txt
>> Documentation/devicetree/bindings/iio/adc/renesas,gyroadc.txt
>> Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
>>         Documentation/devicetree/bindings/iio/imu/st_lsm6dsx.txt
>> Documentation/devicetree/bindings/interrupt-controller/allwinner,sunxi-nmi.txt 
>>
>> Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2400-vic.txt 
>>
>> Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt 
>>
>>         Documentation/devicetree/bindings/leds/common.txt
>>         Documentation/devicetree/bindings/mfd/hi6421.txt
>>         Documentation/devicetree/bindings/mfd/tps65910.txt
>>         Documentation/devicetree/bindings/mmc/fsl-esdhc.txt
>>         Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
>> Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.txt
>>         Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
>>         Documentation/devicetree/bindings/mtd/atmel-nand.txt
>>         Documentation/devicetree/bindings/net/dsa/b53.txt
>>         Documentation/devicetree/bindings/net/ethernet.txt
>>         Documentation/devicetree/bindings/net/macb.txt
>> Documentation/devicetree/bindings/net/marvell-orion-mdio.txt
>>         Documentation/devicetree/bindings/net/ti,wilink-st.txt
>> Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt
>> Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
>>         Documentation/devicetree/bindings/opp/opp.txt
>> Documentation/devicetree/bindings/phy/bcm-ns-usb3-phy.txt
>>         Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
>> Documentation/devicetree/bindings/phy/meson8b-usb2-phy.txt
>> Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
>> Documentation/devicetree/bindings/power/rockchip-io-domain.txt
>> Documentation/devicetree/bindings/power/supply/bq27xxx.txt
>>         Documentation/devicetree/bindings/property-units.txt
>> Documentation/devicetree/bindings/regulator/regulator.txt
>>         Documentation/devicetree/bindings/serial/8
>> error: The following untracked working tree files would be 
>> overwritten by checkout:
>>         Documentation/ABI/testing/sysfs-class-net-phydev
>>         Documentation/DocBook/.gitignore
>>         Documentation/DocBook/Makefile
>>         Documentation/DocBook/filesystems.tmpl
>>         Documentation/DocBook/kernel-hacking.tmpl
>>         Documentation/DocBook/kernel-locking.tmpl
>>         Documentation/DocBook/kgdb.tmpl
>>         Documentation/DocBook/libata.tmpl
>>         Documentation/DocBook/librs.tmpl
>>         Documentation/DocBook/lsm.tmpl
>>         Documentation/DocBook/mtdnand.tmpl
>>         Documentation/DocBook/networking.tmpl
>>         Documentation/DocBook/rapidio.tmpl
>>         Documentation/DocBook/s390-drivers.tmpl
>>         Documentation/DocBook/scsi.tmpl
>>         Documentation/DocBook/sh.tmpl
>>         Documentation/DocBook/stylesheet.xsl
>>         Documentation/DocBook/w1.tmpl
>>         Documentation/DocBook/z8530book.tmpl
>>         Documentation/Makefile.sphinx
>>         Documentation/RCU/trace.txt
>>         Documentation/devicetree/bindings/i2c/i2c-mt6577.txt
>> Documentation/devicetree/bindings/misc/allwinner,syscon.txt
>>         Documentation/devicetree/bindings/net/cortina.txt
>>         Documentation/devicetree/bindings/net/dsa/ksz.txt
>>         Documentation/devicetree/bindings/net/dwmac-sun8i.txt
>>         Documentation/devicetree/bindings/net/qca,qca7000.txt
>> Documentation/devicetree/bindings/power/max8903-charger.txt
>> Documentation/devicetree/bindings/power_supply/maxim,max14656.txt
>>         Documentation/devicetree/bindings/ptp/brcm,ptp-dte.txt
>> Documentation/devicetree/bindings/timer/moxa,moxart-timer.txt
>>         Documentation/doc-guide/docbook.rst
>>         Documentation/networking/tls.txt
>>         Documentation/prctl/no_new_privs.txt
>>         Documentation/prctl/seccomp_filter.txt
>>         Documentation/security/00-INDEX
>>         Documentation/security/IMA-templates.txt
>>         Documentation/security/LSM.txt
>>         Documentation/security/LoadPin.txt
>>         Documentation/security/SELinux.txt
>>         Documentation/security/Smack.txt
>>         Documentation/security/Yama.txt
>>         Documentation/security/apparmor.txt
>>         Documentation/security/conf.py
>>         Documentation/security/credentials.txt
>>         Documentation/security/keys-ecryptfs.txt
>>         Documentation/security/keys-request-key.txt
>>         Documentation/security/keys-trusted-encrypted.txt
>>         Documentation/security/keys.txt
>>         Documentation/security/self-protection.txt
>>         Documentation/security/tomoyo.txt
>>         Documentation/sphinx/convert_template.sed
>>         Documentation/sphinx/post_convert.sed
>>         Documentation/sphinx/tmplcvt
>>         Documentation/usb/typec.rst
>>         Documentation/usb/usb3-debug-port.rst
>>         arch/arm/boot/dts/rk1108-evb.dts
>>         arch/arm/boot/dts/rk1108.dtsi
>>         arch/arm/boot/dts/tegra20-whistler.dts
>>         arch/arm/mach-omap2/opp.c
>>         arch/arm/mach-omap2/pmu.c
>>         arch/ia64/include/asm/siginfo.h
>>         arch/m32r/include/uapi/asm/siginfo.h
>>         arch/microblaze/include/asm/bitops.h
>>         arch/microblaze/include/asm/bug.h
>>         arch/microblaze/include/asm/bugs.h
>>         arch/microblaze/include/asm/div64.h
>>         arch/microblaze/include/asm/emergency-restart.h
>>         arch/microblaze/include/asm/fb.h
>>         arch/microblaze/include/asm/hardirq.h
>>         arch/microblaze/include/asm/irq_regs.h
>>         arch/microblaze/include/asm/kdebug.h
>>         arch/microblaze/include/asm/kmap_types.h
>>         arch/microblaze/include/asm/linkage.h
>>         arch/microblaze/include/asm/local.h
>>         arch/microblaze/include/asm/local64.h
>>         arch/microblaze/include/asm/parport.h
>>         arch/microblaze/include/asm/percpu.h
>>         arch/microblaze/include/asm/serial.h
>>         arch/microblaze/include/asm/shmparam.h
>>         arch/microblaze/include/asm/topology.h
>>         arch/microblaze/include/asm/ucontext.h
>>         arch/microblaze/include/asm/vga.h
>>         arch/microblaze/include/asm/xor.h
>>         arch/microblaze/include/uapi/asm/bitsperlong.h
>>         arch/microblaze/include/uapi/asm/errno.h
>>         arch/microblaze/include/uapi/asm/fcntl.h
>>         arch/microblaze/include/uapi/asm/ioctl.h
>>         arch/microblaze/include/uapi/asm/ioctls.h
>>         arch/microblaze/include/uapi/asm/ipcbuf.h
>>         arch/microblaze/include/uapi/asm/kvm_para.h
>>         arch/microblaze/include/uapi/asm/mman.h
>>         arch/microblaze/include/uapi/asm/msgbuf.h
>>         arch/microblaze/include/uapi/asm/param.h
>>         arch/microblaze/include/uapi/asm/poll.h
>>         arch/microblaze/include/uapi/asm/resource.h
>>         arch/microblaze/include/uapi/asm/sembuf.h
>>         arch/microblaze/include/uapi/asm/shmbuf.h
>>         arch/microblaze/include/uapi/asm/siginfo.h
>>         arch/microblaze/include/uapi/asm/signal.h
>>         arch/microblaze/includ
>> Aborting
>>
>>
>>
>> W dniu 2017-09-20 o 11:45, Paweł Staszewski pisze:
>>> Ok looks like ending bisection
>>>
>>>
>>> Latest bisected kernel when there is no kernel panic 4.12.0+ (from 
>>> next)  - but only this warning:
>>>
>>> [  309.030019] NETDEV WATCHDOG: enp4s0f0 (ixgbe): transmit queue 0 
>>> timed out
>>> [  309.030034] ------------[ cut here ]------------
>>> [  309.030040] WARNING: CPU: 35 PID: 0 at dev_watchdog+0xcf/0x139
>>> [  309.030041] Modules linked in: bonding ipmi_si x86_pkg_temp_thermal
>>> [  309.030045] CPU: 35 PID: 0 Comm: swapper/35 Not tainted 4.12.0+ #5
>>> [  309.030046] task: ffff88086d98a000 task.stack: ffffc90003378000
>>> [  309.030048] RIP: 0010:dev_watchdog+0xcf/0x139
>>> [  309.030049] RSP: 0018:ffff88087fbc3ea8 EFLAGS: 00010246
>>> [  309.030050] RAX: 000000000000003d RBX: ffff88046b680000 RCX: 
>>> 0000000000000000
>>> [  309.030050] RDX: ffff88087fbd2f01 RSI: 0000000000000000 RDI: 
>>> ffff88087fbcda08
>>> [  309.030051] RBP: ffff88087fbc3eb8 R08: 0000000000000000 R09: 
>>> ffff88087ff80a04
>>> [  309.030051] R10: 0000000000000000 R11: ffff88086d98a001 R12: 
>>> 0000000000000000
>>> [  309.030052] R13: ffff88087fbc3ef8 R14: ffff88086d98a000 R15: 
>>> ffffffff81c06008
>>> [  309.030053] FS:  0000000000000000(0000) GS:ffff88087fbc0000(0000) 
>>> knlGS:0000000000000000
>>> [  309.030054] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>> [  309.030054] CR2: 00007fba600f6098 CR3: 000000086b955000 CR4: 
>>> 00000000001406e0
>>> [  309.030055] Call Trace:
>>> [  309.030057]  <IRQ>
>>> [  309.030059]  ? netif_tx_lock+0x79/0x79
>>> [  309.030062]  call_timer_fn.isra.24+0x17/0x77
>>> [  309.030063]  run_timer_softirq+0x118/0x161
>>> [  309.030065]  ? netif_tx_lock+0x79/0x79
>>> [  309.030066]  ? ktime_get+0x2b/0x42
>>> [  309.030070]  ? lapic_next_deadline+0x21/0x27
>>> [  309.030073]  ? clockevents_program_event+0xa8/0xc5
>>> [  309.030076]  __do_softirq+0xa8/0x19d
>>> [  309.030078]  irq_exit+0x5d/0x6b
>>> [  309.030079]  smp_apic_timer_interrupt+0x2a/0x36
>>> [  309.030082]  apic_timer_interrupt+0x89/0x90
>>> [  309.030085] RIP: 0010:mwait_idle+0x4e/0x6a
>>> [  309.030086] RSP: 0018:ffffc9000337be98 EFLAGS: 00000246 ORIG_RAX: 
>>> ffffffffffffff10
>>> [  309.030087] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 
>>> 0000000000000000
>>> [  309.030087] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 
>>> ffff88086d98a000
>>> [  309.030088] RBP: ffffc9000337be98 R08: ffff88046f8279a0 R09: 
>>> ffff88046f827040
>>> [  309.030089] R10: ffff88086d98a000 R11: ffff88086d98a000 R12: 
>>> 0000000000000000
>>> [  309.030089] R13: ffff88086d98a000 R14: ffff88086d98a000 R15: 
>>> ffff88086d98a000
>>> [  309.030090]  </IRQ>
>>> [  309.030094]  arch_cpu_idle+0xa/0xc
>>> [  309.030095]  default_idle_call+0x19/0x1b
>>> [  309.030102]  do_idle+0xbc/0x196
>>> [  309.030104]  cpu_startup_entry+0x1d/0x20
>>> [  309.030105]  start_secondary+0xd8/0xdc
>>> [  309.030108]  secondary_startup_64+0x9f/0x9f
>>> [  309.030109] Code: cc 75 bd eb 35 48 89 df c6 05 c3 dc 74 00 01 e8 
>>> 3a 62 fe ff 44 89 e1 48 89 de 48 89 c2 48 c7 c7 0f 65 a4 81 31 c0 e8 
>>> 3d 4c b5 ff <0f> ff 48 8b 83 e0 01 00 00 48 89 df ff 50 78 48 8b 05 
>>> a0 bc 6a
>>> [  309.030128] ---[ end trace 9102cb25703ae2d9 ]---
>>>
>>>
>>> I just marked it as good - cause this problem above is differend - 
>>> and im going to:
>>>
>>> git bisect good
>>> Bisecting: 1787 revisions left to test after this (roughly 11 steps)
>>>
>>>
>>>
>>>
>>> W dniu 2017-09-20 o 10:44, Paweł Staszewski pisze:
>>>> Trying to make video from ipmi :)
>>>>
>>>> with that results:
>>>>
>>>> https://bugzilla.kernel.org/attachment.cgi?id=258521
>>>>
>>>> catched two more lines where it starts - panic from 4.13.2.
>>>>
>>>>
>>>> Now will try tro do some bisection
>>>>
>>>>
>>>>
>>>> W dniu 2017-09-20 o 09:58, Paweł Staszewski pisze:
>>>>> Hi
>>>>>
>>>>>
>>>>> Will try bisecting tonight
>>>>>
>>>>>
>>>>>
>>>>> W dniu 2017-09-20 o 05:24, Eric Dumazet pisze:
>>>>>> On Wed, 2017-09-20 at 02:06 +0200, Paweł Staszewski wrote:
>>>>>>> Just checked kernel 4.13.2 and same problem
>>>>>>>
>>>>>>> Just after start all 6 bgp sessions - and kernel starts to learn 
>>>>>>> routes
>>>>>>> it panic.
>>>>>>>
>>>>>>> https://bugzilla.kernel.org/attachment.cgi?id=258509
>>>>>>>
>>>>>>
>>>>>> Unfortunately we have not enough information from these traces.
>>>>>>
>>>>>> Can you get a full stack trace ?
>>>>>>
>>>>>> Alternatively, can you bisect ?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

^ permalink raw reply

* [PATCH net 9/9] net: hns3: Fix for pri to tc mapping in TM
From: Yunsheng Lin @ 2017-09-20 10:52 UTC (permalink / raw)
  To: davem
  Cc: huangdaode, xuwei5, liguozhu, Yisen.Zhuang, gabriele.paoloni,
	john.garry, linuxarm, yisen.zhuang, salil.mehta, lipeng321,
	netdev, linux-kernel
In-Reply-To: <1505904778-53217-1-git-send-email-linyunsheng@huawei.com>

Current mapping between pri and tc is one to one,
so user can't map multi priorities to the same tc.
This patch changes the mapping to many to one.

Fixes: 848440544b41f ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h             |  3 ++-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h |  2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c   | 16 +++++++++-------
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index ad685f5..1a01cad 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -376,12 +376,12 @@ struct hnae3_ae_algo {
 struct hnae3_tc_info {
 	u16	tqp_offset;	/* TQP offset from base TQP */
 	u16	tqp_count;	/* Total TQPs */
-	u8	up;		/* user priority */
 	u8	tc;		/* TC index */
 	bool	enable;		/* If this TC is enable or not */
 };
 
 #define HNAE3_MAX_TC		8
+#define HNAE3_MAX_USER_PRIO	8
 struct hnae3_knic_private_info {
 	struct net_device *netdev; /* Set by KNIC client when init instance */
 	u16 rss_size;		   /* Allocated RSS queues */
@@ -389,6 +389,7 @@ struct hnae3_knic_private_info {
 	u16 num_desc;
 
 	u8 num_tc;		   /* Total number of enabled TCs */
+	u8 prio_tc[HNAE3_MAX_USER_PRIO];  /* TC indexed by prio */
 	struct hnae3_tc_info tc_info[HNAE3_MAX_TC]; /* Idx of array is HW TC */
 
 	u16 num_tqps;		  /* total number of TQPs in this handle */
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index 7f8dd12..9fcfd93 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -176,7 +176,6 @@ struct hclge_pg_info {
 struct hclge_tc_info {
 	u8 tc_id;
 	u8 tc_sch_mode;		/* 0: sp; 1: dwrr */
-	u8 up;
 	u8 pgid;
 	u32 bw_limit;
 };
@@ -197,6 +196,7 @@ struct hclge_tm_info {
 	u8 num_tc;
 	u8 num_pg;      /* It must be 1 if vNET-Base schd */
 	u8 pg_dwrr[HCLGE_PG_NUM];
+	u8 prio_tc[HNAE3_MAX_USER_PRIO];
 	struct hclge_pg_info pg_info[HCLGE_PG_NUM];
 	struct hclge_tc_info tc_info[HNAE3_MAX_TC];
 	enum hclge_fc_mode fc_mode;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
index b7ba7aa..73a75d7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
@@ -128,9 +128,7 @@ static int hclge_fill_pri_array(struct hclge_dev *hdev, u8 *pri, u8 pri_id)
 {
 	u8 tc;
 
-	for (tc = 0; tc < hdev->tm_info.num_tc; tc++)
-		if (hdev->tm_info.tc_info[tc].up == pri_id)
-			break;
+	tc = hdev->tm_info.prio_tc[pri_id];
 
 	if (tc >= hdev->tm_info.num_tc)
 		return -EINVAL;
@@ -158,7 +156,7 @@ static int hclge_up_to_tc_map(struct hclge_dev *hdev)
 
 	hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_PRI_TO_TC_MAPPING, false);
 
-	for (pri_id = 0; pri_id < hdev->tm_info.num_tc; pri_id++) {
+	for (pri_id = 0; pri_id < HNAE3_MAX_USER_PRIO; pri_id++) {
 		ret = hclge_fill_pri_array(hdev, pri, pri_id);
 		if (ret)
 			return ret;
@@ -405,16 +403,17 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport)
 			kinfo->tc_info[i].tqp_offset = i * kinfo->rss_size;
 			kinfo->tc_info[i].tqp_count = kinfo->rss_size;
 			kinfo->tc_info[i].tc = i;
-			kinfo->tc_info[i].up = hdev->tm_info.tc_info[i].up;
 		} else {
 			/* Set to default queue if TC is disable */
 			kinfo->tc_info[i].enable = false;
 			kinfo->tc_info[i].tqp_offset = 0;
 			kinfo->tc_info[i].tqp_count = 1;
 			kinfo->tc_info[i].tc = 0;
-			kinfo->tc_info[i].up = 0;
 		}
 	}
+
+	memcpy(kinfo->prio_tc, hdev->tm_info.prio_tc,
+	       FIELD_SIZEOF(struct hnae3_knic_private_info, prio_tc));
 }
 
 static void hclge_tm_vport_info_update(struct hclge_dev *hdev)
@@ -436,12 +435,15 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev)
 	for (i = 0; i < hdev->tm_info.num_tc; i++) {
 		hdev->tm_info.tc_info[i].tc_id = i;
 		hdev->tm_info.tc_info[i].tc_sch_mode = HCLGE_SCH_MODE_DWRR;
-		hdev->tm_info.tc_info[i].up = i;
 		hdev->tm_info.tc_info[i].pgid = 0;
 		hdev->tm_info.tc_info[i].bw_limit =
 			hdev->tm_info.pg_info[0].bw_limit;
 	}
 
+	for (i = 0; i < HNAE3_MAX_USER_PRIO; i++)
+		hdev->tm_info.prio_tc[i] =
+			(i >= hdev->tm_info.num_tc) ? 0 : i;
+
 	hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;
 }
 
-- 
1.9.1

^ permalink raw reply related

* [PATCH net 8/9] net: hns3: Fix for setting rss_size incorrectly
From: Yunsheng Lin @ 2017-09-20 10:52 UTC (permalink / raw)
  To: davem
  Cc: huangdaode, xuwei5, liguozhu, Yisen.Zhuang, gabriele.paoloni,
	john.garry, linuxarm, yisen.zhuang, salil.mehta, lipeng321,
	netdev, linux-kernel
In-Reply-To: <1505904778-53217-1-git-send-email-linyunsheng@huawei.com>

rss_size is 1, 2, 4, 8, 16, 32, 64, 128, but acutal tc queue
size can be any u16 less than 128. If tc queue size is 5, we
set the rss_size to 8, indirection table will be used to limit
the size of actual queue size.
It may cause dropping of receiving packet in hardware if
rss_size is not set correctly.
For now, each TC has the same rss size.

Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c    | 76 ++++++++++------------
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h    |  1 +
 .../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c  |  1 +
 3 files changed, 38 insertions(+), 40 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 1e15ce1..d27618b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2606,6 +2606,7 @@ static int hclge_rss_init_hw(struct hclge_dev *hdev)
 	u16 tc_valid[HCLGE_MAX_TC_NUM];
 	u16 tc_size[HCLGE_MAX_TC_NUM];
 	u32 *rss_indir = NULL;
+	u16 rss_size = 0, roundup_size;
 	const u8 *key;
 	int i, ret, j;
 
@@ -2620,7 +2621,13 @@ static int hclge_rss_init_hw(struct hclge_dev *hdev)
 	for (j = 0; j < hdev->num_vmdq_vport + 1; j++) {
 		for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) {
 			vport[j].rss_indirection_tbl[i] =
-				i % hdev->rss_size_max;
+				i % vport[j].alloc_rss_size;
+
+			/* vport 0 is for PF */
+			if (j != 0)
+				continue;
+
+			rss_size = vport[j].alloc_rss_size;
 			rss_indir[i] = vport[j].rss_indirection_tbl[i];
 		}
 	}
@@ -2637,42 +2644,31 @@ static int hclge_rss_init_hw(struct hclge_dev *hdev)
 	if (ret)
 		goto err;
 
+	/* Each TC have the same queue size, and tc_size set to hardware is
+	 * the log2 of roundup power of two of rss_size, the acutal queue
+	 * size is limited by indirection table.
+	 */
+	if (rss_size > HCLGE_RSS_TC_SIZE_7 || rss_size == 0) {
+		dev_err(&hdev->pdev->dev,
+			"Configure rss tc size failed, invalid TC_SIZE = %d\n",
+			rss_size);
+		return -EINVAL;
+	}
+
+	roundup_size = roundup_pow_of_two(rss_size);
+	roundup_size = ilog2(roundup_size);
+
 	for (i = 0; i < HCLGE_MAX_TC_NUM; i++) {
-		if (hdev->hw_tc_map & BIT(i))
-			tc_valid[i] = 1;
-		else
-			tc_valid[i] = 0;
+		tc_valid[i] = 0;
 
-		switch (hdev->rss_size_max) {
-		case HCLGE_RSS_TC_SIZE_0:
-			tc_size[i] = 0;
-			break;
-		case HCLGE_RSS_TC_SIZE_1:
-			tc_size[i] = 1;
-			break;
-		case HCLGE_RSS_TC_SIZE_2:
-			tc_size[i] = 2;
-			break;
-		case HCLGE_RSS_TC_SIZE_3:
-			tc_size[i] = 3;
-			break;
-		case HCLGE_RSS_TC_SIZE_4:
-			tc_size[i] = 4;
-			break;
-		case HCLGE_RSS_TC_SIZE_5:
-			tc_size[i] = 5;
-			break;
-		case HCLGE_RSS_TC_SIZE_6:
-			tc_size[i] = 6;
-			break;
-		case HCLGE_RSS_TC_SIZE_7:
-			tc_size[i] = 7;
-			break;
-		default:
-			break;
-		}
-		tc_offset[i] = hdev->rss_size_max * i;
+		if (!(hdev->hw_tc_map & BIT(i)))
+			continue;
+
+		tc_valid[i] = 1;
+		tc_size[i] = roundup_size;
+		tc_offset[i] = rss_size * i;
 	}
+
 	ret = hclge_set_rss_tc_mode(hdev, tc_valid, tc_size, tc_offset);
 
 err:
@@ -4166,12 +4162,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 		return ret;
 	}
 
-	ret = hclge_rss_init_hw(hdev);
-	if (ret) {
-		dev_err(&pdev->dev, "Rss init fail, ret =%d\n", ret);
-		return  ret;
-	}
-
 	ret = hclge_init_vlan_config(hdev);
 	if (ret) {
 		dev_err(&pdev->dev, "VLAN init fail, ret =%d\n", ret);
@@ -4184,6 +4174,12 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 		return ret;
 	}
 
+	ret = hclge_rss_init_hw(hdev);
+	if (ret) {
+		dev_err(&pdev->dev, "Rss init fail, ret =%d\n", ret);
+		return ret;
+	}
+
 	setup_timer(&hdev->service_timer, hclge_service_timer,
 		    (unsigned long)hdev);
 	INIT_WORK(&hdev->service_task, hclge_service_task);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index edb10ad..7f8dd12 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -477,6 +477,7 @@ struct hclge_vport {
 	u8  rss_hash_key[HCLGE_RSS_KEY_SIZE]; /* User configured hash keys */
 	/* User configured lookup table entries */
 	u8  rss_indirection_tbl[HCLGE_RSS_IND_TBL_SIZE];
+	u16 alloc_rss_size;
 
 	u16 qs_offset;
 	u16 bw_limit;		/* VSI BW Limit (0 = disabled) */
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
index fe659f7..b7ba7aa 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
@@ -397,6 +397,7 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport)
 			kinfo->num_tqps / kinfo->num_tc);
 	vport->qs_offset = hdev->tm_info.num_tc * vport->vport_id;
 	vport->dwrr = 100;  /* 100 percent as init */
+	vport->alloc_rss_size = kinfo->rss_size;
 
 	for (i = 0; i < kinfo->num_tc; i++) {
 		if (hdev->hw_tc_map & BIT(i)) {
-- 
1.9.1

^ permalink raw reply related

* [PATCH net 7/9] net: hns3: Fix typo error for feild in hclge_tm
From: Yunsheng Lin @ 2017-09-20 10:52 UTC (permalink / raw)
  To: davem
  Cc: huangdaode, xuwei5, liguozhu, Yisen.Zhuang, gabriele.paoloni,
	john.garry, linuxarm, yisen.zhuang, salil.mehta, lipeng321,
	netdev, linux-kernel
In-Reply-To: <1505904778-53217-1-git-send-email-linyunsheng@huawei.com>

This patch fixes a typo error for feild, which should be field.

Fixes: 848440544b41f ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 .../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c    | 20 ++++++++++----------
 .../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h    |  4 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
index c91dbf1..fe659f7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
@@ -280,11 +280,11 @@ static int hclge_tm_pg_shapping_cfg(struct hclge_dev *hdev,
 
 	shap_cfg_cmd->pg_id = pg_id;
 
-	hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, IR_B, ir_b);
-	hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, IR_U, ir_u);
-	hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, IR_S, ir_s);
-	hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, BS_B, bs_b);
-	hclge_tm_set_feild(shap_cfg_cmd->pg_shapping_para, BS_S, bs_s);
+	hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_B, ir_b);
+	hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_U, ir_u);
+	hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, IR_S, ir_s);
+	hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, BS_B, bs_b);
+	hclge_tm_set_field(shap_cfg_cmd->pg_shapping_para, BS_S, bs_s);
 
 	return hclge_cmd_send(&hdev->hw, &desc, 1);
 }
@@ -307,11 +307,11 @@ static int hclge_tm_pri_shapping_cfg(struct hclge_dev *hdev,
 
 	shap_cfg_cmd->pri_id = pri_id;
 
-	hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, IR_B, ir_b);
-	hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, IR_U, ir_u);
-	hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, IR_S, ir_s);
-	hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, BS_B, bs_b);
-	hclge_tm_set_feild(shap_cfg_cmd->pri_shapping_para, BS_S, bs_s);
+	hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_B, ir_b);
+	hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_U, ir_u);
+	hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, IR_S, ir_s);
+	hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, BS_B, bs_b);
+	hclge_tm_set_field(shap_cfg_cmd->pri_shapping_para, BS_S, bs_s);
 
 	return hclge_cmd_send(&hdev->hw, &desc, 1);
 }
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
index 7e67337..85158b0 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
@@ -94,10 +94,10 @@ struct hclge_bp_to_qs_map_cmd {
 	u32 rsvd1;
 };
 
-#define hclge_tm_set_feild(dest, string, val) \
+#define hclge_tm_set_field(dest, string, val) \
 			hnae_set_field((dest), (HCLGE_TM_SHAP_##string##_MSK), \
 				       (HCLGE_TM_SHAP_##string##_LSH), val)
-#define hclge_tm_get_feild(src, string) \
+#define hclge_tm_get_field(src, string) \
 			hnae_get_field((src), (HCLGE_TM_SHAP_##string##_MSK), \
 				       (HCLGE_TM_SHAP_##string##_LSH))
 
-- 
1.9.1

^ permalink raw reply related


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