Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH iproute2] ip link: Do not call ll_name_to_index when creating a new link
From: David Ahern @ 2018-05-18  0:17 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20180517153604.0d905a36@xeon-e3>

On 5/17/18 4:36 PM, Stephen Hemminger wrote:
> On Thu, 17 May 2018 16:22:37 -0600
> dsahern@kernel.org wrote:
> 
>> From: David Ahern <dsahern@gmail.com>
>>
>> Using iproute2 to create a bridge and add 4094 vlans to it can take from
>> 2 to 3 *minutes*. The reason is the extraneous call to ll_name_to_index.
>> ll_name_to_index results in an ioctl(SIOCGIFINDEX) call which in turn
>> invokes dev_load. If the index does not exist, which it won't when
>> creating a new link, dev_load calls modprobe twice -- once for
>> netdev-NAME and again for NAME. This is unnecessary overhead for each
>> link create.
>>
>> When ip link is invoked for a new device, there is no reason to
>> call ll_name_to_index for the new device. With this patch, creating
>> a bridge and adding 4094 vlans takes less than 3 *seconds*.
>>
>> Signed-off-by: David Ahern <dsahern@gmail.com>
> 
> Yes this looks like a real problem.
> Isn't the cache supposed to reduce this?
> 
> Don't like to make lots of special case flags.
> 

The device does not exist, so it won't be in any cache. ll_name_to_index
already checks it though before calling if_nametoindex.

^ permalink raw reply

* [PATCH net v2] net: dsa: Do not register devlink for unused ports
From: Florian Fainelli @ 2018-05-17 23:55 UTC (permalink / raw)
  To: netdev
  Cc: jiri, Florian Fainelli, Andrew Lunn, Vivien Didelot,
	David S. Miller, open list

Even if commit 1d27732f411d ("net: dsa: setup and teardown ports") indicated
that registering a devlink instance for unused ports is not a problem, and this
is true, this can be confusing nonetheless, so let's not do it.

Fixes: 1d27732f411d ("net: dsa: setup and teardown ports")
Reported-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/dsa2.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index adf50fbc4c13..47725250b4ca 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -258,11 +258,13 @@ static void dsa_tree_teardown_default_cpu(struct dsa_switch_tree *dst)
 static int dsa_port_setup(struct dsa_port *dp)
 {
 	struct dsa_switch *ds = dp->ds;
-	int err;
+	int err = 0;
 
 	memset(&dp->devlink_port, 0, sizeof(dp->devlink_port));
 
-	err = devlink_port_register(ds->devlink, &dp->devlink_port, dp->index);
+	if (dp->type != DSA_PORT_TYPE_UNUSED)
+		err = devlink_port_register(ds->devlink, &dp->devlink_port,
+					    dp->index);
 	if (err)
 		return err;
 
@@ -293,7 +295,8 @@ static int dsa_port_setup(struct dsa_port *dp)
 
 static void dsa_port_teardown(struct dsa_port *dp)
 {
-	devlink_port_unregister(&dp->devlink_port);
+	if (dp->type != DSA_PORT_TYPE_UNUSED)
+		devlink_port_unregister(&dp->devlink_port);
 
 	switch (dp->type) {
 	case DSA_PORT_TYPE_UNUSED:
-- 
2.14.1

^ permalink raw reply related

* [net-next:master 1230/1233] arch/mips/include/asm/io.h:422:1: note: in expansion of macro '__BUILD_MEMORY_SINGLE'
From: kbuild test robot @ 2018-05-17 23:54 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: kbuild-all, netdev

[-- Attachment #1: Type: text/plain, Size: 16176 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   538e2de104cfb4ef1acb35af42427bff42adbe4d
commit: 2652113ff043ca2ce1cb3be529b5ca9270c421d4 [1230/1233] net: ethernet: ti: Allow most drivers with COMPILE_TEST
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 2652113ff043ca2ce1cb3be529b5ca9270c421d4
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

   drivers/net//ethernet/ti/davinci_cpdma.c: In function 'cpdma_chan_submit':
   drivers/net//ethernet/ti/davinci_cpdma.c:1083:17: warning: passing argument 1 of 'writel' makes integer from pointer without a cast [-Wint-conversion]
     writel_relaxed(token, &desc->sw_token);
                    ^~~~~
   In file included from arch/mips/include/asm/page.h:194:0,
                    from include/linux/mmzone.h:21,
                    from include/linux/gfp.h:6,
                    from include/linux/idr.h:16,
                    from include/linux/kernfs.h:14,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:16,
                    from drivers/net//ethernet/ti/davinci_cpdma.c:17:
   arch/mips/include/asm/io.h:315:25: note: expected 'u32 {aka unsigned int}' but argument is of type 'void *'
    static inline void pfx##write##bwlq(type val,    \
                            ^
>> arch/mips/include/asm/io.h:422:1: note: in expansion of macro '__BUILD_MEMORY_SINGLE'
    __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
    ^~~~~~~~~~~~~~~~~~~~~
>> arch/mips/include/asm/io.h:427:1: note: in expansion of macro '__BUILD_MEMORY_PFX'
    __BUILD_MEMORY_PFX(, bwlq, type)     \
    ^~~~~~~~~~~~~~~~~~
>> arch/mips/include/asm/io.h:432:1: note: in expansion of macro 'BUILDIO_MEM'
    BUILDIO_MEM(l, u32)
    ^~~~~~~~~~~
--
   drivers/net/ethernet/ti/davinci_cpdma.c: In function 'cpdma_chan_submit':
   drivers/net/ethernet/ti/davinci_cpdma.c:1083:17: warning: passing argument 1 of 'writel' makes integer from pointer without a cast [-Wint-conversion]
     writel_relaxed(token, &desc->sw_token);
                    ^~~~~
   In file included from arch/mips/include/asm/page.h:194:0,
                    from include/linux/mmzone.h:21,
                    from include/linux/gfp.h:6,
                    from include/linux/idr.h:16,
                    from include/linux/kernfs.h:14,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:16,
                    from drivers/net/ethernet/ti/davinci_cpdma.c:17:
   arch/mips/include/asm/io.h:315:25: note: expected 'u32 {aka unsigned int}' but argument is of type 'void *'
    static inline void pfx##write##bwlq(type val,    \
                            ^
>> arch/mips/include/asm/io.h:422:1: note: in expansion of macro '__BUILD_MEMORY_SINGLE'
    __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
    ^~~~~~~~~~~~~~~~~~~~~
>> arch/mips/include/asm/io.h:427:1: note: in expansion of macro '__BUILD_MEMORY_PFX'
    __BUILD_MEMORY_PFX(, bwlq, type)     \
    ^~~~~~~~~~~~~~~~~~
>> arch/mips/include/asm/io.h:432:1: note: in expansion of macro 'BUILDIO_MEM'
    BUILDIO_MEM(l, u32)
    ^~~~~~~~~~~

vim +/__BUILD_MEMORY_SINGLE +422 arch/mips/include/asm/io.h

8faca49a6 arch/mips/include/asm/io.h David Daney       2008-12-11  312  
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  313  #define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq)			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  314  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16 @315  static inline void pfx##write##bwlq(type val,				\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  316  				    volatile void __iomem *mem)		\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  317  {									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  318  	volatile type *__mem;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  319  	type __val;							\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  320  									\
1e820da3c arch/mips/include/asm/io.h Huacai Chen       2016-03-03  321  	war_io_reorder_wmb();					\
8faca49a6 arch/mips/include/asm/io.h David Daney       2008-12-11  322  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  323  	__mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem));	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  324  									\
a8433137e include/asm-mips/io.h      Atsushi Nemoto    2006-02-17  325  	__val = pfx##ioswab##bwlq(__mem, val);				\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  326  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  327  	if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  328  		*__mem = __val;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  329  	else if (cpu_has_64bits) {					\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  330  		unsigned long __flags;					\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  331  		type __tmp;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  332  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  333  		if (irq)						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  334  			local_irq_save(__flags);			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  335  		__asm__ __volatile__(					\
a809d4606 arch/mips/include/asm/io.h Ralf Baechle      2014-03-30  336  			".set	arch=r4000"	"\t\t# __writeq""\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  337  			"dsll32 %L0, %L0, 0"			"\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  338  			"dsrl32 %L0, %L0, 0"			"\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  339  			"dsll32 %M0, %M0, 0"			"\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  340  			"or	%L0, %L0, %M0"			"\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  341  			"sd	%L0, %2"			"\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  342  			".set	mips0"				"\n"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  343  			: "=r" (__tmp)					\
b77bb37a2 arch/mips/include/asm/io.h Ralf Baechle      2011-06-30  344  			: "0" (__val), "m" (*__mem));			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  345  		if (irq)						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  346  			local_irq_restore(__flags);			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  347  	} else								\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  348  		BUG();							\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  349  }									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  350  									\
b887d3f2c include/asm-mips/io.h      Atsushi Nemoto    2006-02-09  351  static inline type pfx##read##bwlq(const volatile void __iomem *mem)	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  352  {									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  353  	volatile type *__mem;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  354  	type __val;							\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  355  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  356  	__mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem));	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  357  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  358  	if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  359  		__val = *__mem;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  360  	else if (cpu_has_64bits) {					\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  361  		unsigned long __flags;					\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  362  									\
049b13c35 include/asm-mips/io.h      Thiemo Seufer     2005-02-21  363  		if (irq)						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  364  			local_irq_save(__flags);			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  365  		__asm__ __volatile__(					\
a809d4606 arch/mips/include/asm/io.h Ralf Baechle      2014-03-30  366  			".set	arch=r4000"	"\t\t# __readq" "\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  367  			"ld	%L0, %1"			"\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  368  			"dsra32 %M0, %L0, 0"			"\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  369  			"sll	%L0, %L0, 0"			"\n\t"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  370  			".set	mips0"				"\n"	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  371  			: "=r" (__val)					\
b77bb37a2 arch/mips/include/asm/io.h Ralf Baechle      2011-06-30  372  			: "m" (*__mem));				\
049b13c35 include/asm-mips/io.h      Thiemo Seufer     2005-02-21  373  		if (irq)						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  374  			local_irq_restore(__flags);			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  375  	} else {							\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  376  		__val = 0;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  377  		BUG();							\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  378  	}								\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  379  									\
a1cc7034e arch/mips/include/asm/io.h Sinan Kaya        2018-04-12  380  	/* prevent prefetching of coherent DMA data prematurely */	\
a1cc7034e arch/mips/include/asm/io.h Sinan Kaya        2018-04-12  381  	rmb();								\
a8433137e include/asm-mips/io.h      Atsushi Nemoto    2006-02-17  382  	return pfx##ioswab##bwlq(__mem, __val);				\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  383  }
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  384  
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  385  #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow)			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  386  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  387  static inline void pfx##out##bwlq##p(type val, unsigned long port)	\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  388  {									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  389  	volatile type *__addr;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  390  	type __val;							\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  391  									\
1e820da3c arch/mips/include/asm/io.h Huacai Chen       2016-03-03  392  	war_io_reorder_wmb();					\
8faca49a6 arch/mips/include/asm/io.h David Daney       2008-12-11  393  									\
a8433137e include/asm-mips/io.h      Atsushi Nemoto    2006-02-17  394  	__addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  395  									\
a8433137e include/asm-mips/io.h      Atsushi Nemoto    2006-02-17  396  	__val = pfx##ioswab##bwlq(__addr, val);				\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  397  									\
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  398  	/* Really, we want this to be atomic */				\
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  399  	BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));		\
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  400  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  401  	*__addr = __val;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  402  	slow;								\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  403  }									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  404  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  405  static inline type pfx##in##bwlq##p(unsigned long port)			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  406  {									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  407  	volatile type *__addr;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  408  	type __val;							\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  409  									\
a8433137e include/asm-mips/io.h      Atsushi Nemoto    2006-02-17  410  	__addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  411  									\
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  412  	BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));		\
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  413  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  414  	__val = *__addr;						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  415  	slow;								\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  416  									\
a8433137e include/asm-mips/io.h      Atsushi Nemoto    2006-02-17  417  	return pfx##ioswab##bwlq(__addr, __val);			\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  418  }
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  419  
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  420  #define __BUILD_MEMORY_PFX(bus, bwlq, type)				\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  421  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16 @422  __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  423  
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  424  #define BUILDIO_MEM(bwlq, type)						\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  425  									\
^1da177e4 include/asm-mips/io.h      Linus Torvalds    2005-04-16  426  __BUILD_MEMORY_PFX(__raw_, bwlq, type)					\
4912ba72d include/asm-mips/io.h      Maciej W. Rozycki 2005-02-22 @427  __BUILD_MEMORY_PFX(, bwlq, type)					\
290f10ae4 include/asm-mips/io.h      Al Viro           2005-12-07  428  __BUILD_MEMORY_PFX(__mem_, bwlq, type)					\
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  429  
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  430  BUILDIO_MEM(b, u8)
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  431  BUILDIO_MEM(w, u16)
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23 @432  BUILDIO_MEM(l, u32)
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  433  BUILDIO_MEM(q, u64)
9d58f302c include/asm-mips/io.h      Ralf Baechle      2005-09-23  434  

:::::: The code at line 422 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55353 bytes --]

^ permalink raw reply

* Re: [PATCH bpf-next 2/7] bpf: introduce bpf subcommand BPF_PERF_EVENT_QUERY
From: kbuild test robot @ 2018-05-17 23:52 UTC (permalink / raw)
  To: Yonghong Song; +Cc: kbuild-all, peterz, ast, daniel, netdev, kernel-team
In-Reply-To: <20180515234521.856763-3-yhs@fb.com>

[-- Attachment #1: Type: text/plain, Size: 1989 bytes --]

Hi Yonghong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Yonghong-Song/bpf-implement-BPF_PERF_EVENT_QUERY-for-perf-event-query/20180518-060508
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: i386-randconfig-x000-201819 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   kernel/trace/trace_kprobe.c: In function 'bpf_get_kprobe_info':
>> kernel/trace/trace_kprobe.c:1315:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      *probe_addr = (u64)tk->rp.kp.addr;
                    ^

vim +1315 kernel/trace/trace_kprobe.c

  1290	
  1291	int bpf_get_kprobe_info(struct perf_event *event, u32 *prog_info,
  1292				const char **symbol, u64 *probe_offset,
  1293				u64 *probe_addr, bool perf_type_tracepoint)
  1294	{
  1295		const char *pevent = trace_event_name(event->tp_event);
  1296		const char *group = event->tp_event->class->system;
  1297		struct trace_kprobe *tk;
  1298	
  1299		if (perf_type_tracepoint)
  1300			tk = find_trace_kprobe(pevent, group);
  1301		else
  1302			tk = event->tp_event->data;
  1303		if (!tk)
  1304			return -EINVAL;
  1305	
  1306		*prog_info = trace_kprobe_is_return(tk) ? BPF_PERF_INFO_KRETPROBE
  1307							: BPF_PERF_INFO_KPROBE;
  1308		if (tk->symbol) {
  1309			*symbol = tk->symbol;
  1310			*probe_offset = tk->rp.kp.offset;
  1311			*probe_addr = 0;
  1312		} else {
  1313			*symbol = NULL;
  1314			*probe_offset = 0;
> 1315			*probe_addr = (u64)tk->rp.kp.addr;
  1316		}
  1317		return 0;
  1318	}
  1319	#endif	/* CONFIG_PERF_EVENTS */
  1320	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32670 bytes --]

^ permalink raw reply

* Greetings
From: Miss.Zeliha Omer Faruk @ 2018-05-17 23:39 UTC (permalink / raw)





Hello

Greetings to you please i have a business proposal for you contact me
for more detailes asap thanks.

Best Regards,
Miss.Zeliha ömer faruk
Esentepe Mahallesi Büyükdere
Caddesi Kristal Kule Binasi
No:215
Sisli - Istanbul, Turkey

^ permalink raw reply

* [PATCH iproute2] tc: allow 0% for percent options
From: Stephen Hemminger @ 2018-05-17 23:29 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger

Allowing 0% is sometimes useful for example in netem loss and drop
or perhaps dropping all traffic in a HTB bin.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199745
Reported-by: stuartmarsden@gmail.com
Fixes: 927e3cfb52b5 ("tc: B.W limits can now be specified in %.")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils.c b/lib/utils.c
index 7b2c6dd19268..02ce67721915 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -105,7 +105,7 @@ int parse_percent(double *val, const char *str)
 	*val = strtod(str, &p) / 100.;
 	if (*val == HUGE_VALF || *val == HUGE_VALL)
 		return 1;
-	if (*val == 0.0 || (*p && strcmp(p, "%")))
+	if (*p && strcmp(p, "%"))
 		return -1;
 
 	return 0;
-- 
2.17.0

^ permalink raw reply related

* Regression bisected to: softirq: Let ksoftirqd do its job
From: Ben Greear @ 2018-05-17 23:24 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev

One of my out-of-tree patches is a network impairment tool that acts a lot like
an Ethernet bridge with latency, jitter, etc.

We noticed recently that we were seeing igb adapter errors when testing with our emulator
at high speeds.  For whatever reason, it is only easily reproduced when we add jitter
to our emulator.  This would cause a bit more CPU usage and lock contention in our software,
and would increase the skb pkts allocated at any given time.

I bisected the problem to the commit below:

Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 31 10:42:29 2016 -0700

     softirq: Let ksoftirqd do its job

     A while back, Paolo and Hannes sent an RFC patch adding threaded-able
     napi poll loop support : (https://patchwork.ozlabs.org/patch/620657/)
....

If I replace my emulator with a bridge, then I do not see the problem.  But, I also do not
(or very rarely?) see the problem when configuring the emulator with zero latency and jitter,
which is how the bridge would act.

Any idea what sort of (bad?) behaviour would be able to cause this tx q timeout?

If you have any interest, I will be happy to email you my out-of-tree patches and
instructions to reproduce the problem.


The kernel splat looks like this, and repeats often:


May 17 16:03:09 localhost.localdomain kernel: audit: type=1131 audit(1526598189.492:159): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed 
comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
May 17 16:03:39 localhost.localdomain kernel: ------------[ cut here ]------------
May 17 16:03:39 localhost.localdomain kernel: WARNING: CPU: 5 PID: 0 at /home/greearb/git/linux-bisect/net/sched/sch_generic.c:316 dev_watchdog+0x234/0x240
May 17 16:03:39 localhost.localdomain kernel: NETDEV WATCHDOG: eth5 (igb): transmit queue 0 timed out
May 17 16:03:39 localhost.localdomain kernel: Modules linked in: nf_conntrack_netlink nf_conntrack nfnetlink nf_defrag_ipv4 fuse macvlan wanlink(O) pktgen 
cfg80211 sunrpc coretemp intel_rapl x86_pkg_temp_thermal intel_powerclamp kvm_intel kvm irqbypass ipmi_ssif iTCO_wdt iTCO_vendor_support joydev i2c_i801 lpc_ich 
i2c_smbus ioatdma shpchp wmi ipmi_si ipmi_msghandler tpm_tis tpm_tis_core tpm acpi_power_meter acpi_pad sch_fq_codel ast drm_kms_helper ttm drm igb hwmon ptp 
pps_core dca i2c_algo_bit i2c_core fjes ipv6 crc_ccitt [last unloaded: nf_conntrack]
May 17 16:03:39 localhost.localdomain kernel: CPU: 5 PID: 0 Comm: swapper/5 Tainted: G           O    4.8.0-rc7+ #132
May 17 16:03:39 localhost.localdomain kernel: Hardware name: Iron_Systems,Inc CS-CAD-2U-A02/X10SRL-F, BIOS 2.0b 05/02/2017
May 17 16:03:39 localhost.localdomain kernel:  0000000000000000 ffff88087fd43d78 ffffffff81417eb1 ffff88087fd43dc8
May 17 16:03:39 localhost.localdomain kernel:  0000000000000000 ffff88087fd43db8 ffffffff81103556 0000013c7fd43da8
May 17 16:03:39 localhost.localdomain kernel:  0000000000000000 ffff880854221940 0000000000000005 ffff880854bb8000
May 17 16:03:39 localhost.localdomain kernel: Call Trace:
May 17 16:03:39 localhost.localdomain kernel:  <IRQ>  [<ffffffff81417eb1>] dump_stack+0x63/0x82
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff81103556>] __warn+0xc6/0xe0
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff811035ba>] warn_slowpath_fmt+0x4a/0x50
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff817b3844>] dev_watchdog+0x234/0x240
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff817b3610>] ? qdisc_rcu_free+0x40/0x40
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff8116ea50>] call_timer_fn+0x30/0x150
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff817b3610>] ? qdisc_rcu_free+0x40/0x40
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff8116f35a>] run_timer_softirq+0x1ea/0x450
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff81176d97>] ? ktime_get+0x37/0xa0
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff8104fd21>] ? lapic_next_deadline+0x21/0x30
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff8117cffd>] ? clockevents_program_event+0x7d/0x120
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff81108b7a>] __do_softirq+0xca/0x2d0
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff81108ee3>] irq_exit+0xb3/0xc0
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff8105099d>] smp_apic_timer_interrupt+0x3d/0x50
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff81867882>] apic_timer_interrupt+0x82/0x90
May 17 16:03:39 localhost.localdomain kernel:  <EOI>  [<ffffffff816f9c06>] ? cpuidle_enter_state+0x126/0x300
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff816f9e02>] cpuidle_enter+0x12/0x20
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff81144ba5>] call_cpuidle+0x25/0x40
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff81144f6a>] cpu_startup_entry+0x2ba/0x380
May 17 16:03:39 localhost.localdomain kernel:  [<ffffffff8104e8d9>] start_secondary+0x149/0x170
May 17 16:03:39 localhost.localdomain kernel: ---[ end trace f62c6dd947785e8f ]---


Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply

* Re: [PATCH v3 net-next 3/6] tcp: add SACK compression
From: Toke Høiland-Jørgensen @ 2018-05-17 23:24 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller
  Cc: netdev, Neal Cardwell, Yuchung Cheng, Soheil Hassas Yeganeh,
	Eric Dumazet, Eric Dumazet
In-Reply-To: <20180517214729.186094-4-edumazet@google.com>

Eric Dumazet <edumazet@google.com> writes:

> When TCP receives an out-of-order packet, it immediately sends
> a SACK packet, generating network load but also forcing the
> receiver to send 1-MSS pathological packets, increasing its
> RTX queue length/depth, and thus processing time.
>
> Wifi networks suffer from this aggressive behavior, but generally
> speaking, all these SACK packets add fuel to the fire when networks
> are under congestion.
>
> This patch adds a high resolution timer and tp->compressed_ack counter.
>
> Instead of sending a SACK, we program this timer with a small delay,
> based on RTT and capped to 1 ms :
>
> 	delay = min ( 5 % of RTT, 1 ms)
>
> If subsequent SACKs need to be sent while the timer has not yet
> expired, we simply increment tp->compressed_ack.
>
> When timer expires, a SACK is sent with the latest information.
> Whenever an ACK is sent (if data is sent, or if in-order
> data is received) timer is canceled.
>
> Note that tcp_sack_new_ofo_skb() is able to force a SACK to be sent
> if the sack blocks need to be shuffled, even if the timer has not
> expired.
>
> A new SNMP counter is added in the following patch.
>
> Two other patches add sysctls to allow changing the 1,000,000 and 44
> values that this commit hard-coded.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>

^ permalink raw reply

* [PATCH] ath10k: transmit queued frames after waking queues
From: Niklas Cassel @ 2018-05-17 23:15 UTC (permalink / raw)
  To: Kalle Valo, David S. Miller
  Cc: Niklas Cassel, ath10k, linux-wireless, netdev, linux-kernel

The following problem was observed when running iperf:

[  3]  0.0- 1.0 sec  2.00 MBytes  16.8 Mbits/sec
[  3]  1.0- 2.0 sec  3.12 MBytes  26.2 Mbits/sec
[  3]  2.0- 3.0 sec  3.25 MBytes  27.3 Mbits/sec
[  3]  3.0- 4.0 sec   655 KBytes  5.36 Mbits/sec
[  3]  4.0- 5.0 sec  0.00 Bytes  0.00 bits/sec
[  3]  5.0- 6.0 sec  0.00 Bytes  0.00 bits/sec
[  3]  6.0- 7.0 sec  0.00 Bytes  0.00 bits/sec
[  3]  7.0- 8.0 sec  0.00 Bytes  0.00 bits/sec
[  3]  8.0- 9.0 sec  0.00 Bytes  0.00 bits/sec
[  3]  9.0-10.0 sec  0.00 Bytes  0.00 bits/sec
[  3]  0.0-10.3 sec  9.01 MBytes  7.32 Mbits/sec

There are frames in the ieee80211_txq and there are frames that have
been removed from from this queue, but haven't yet been sent on the wire
(num_pending_tx).

When num_pending_tx reaches max_num_pending_tx, we will stop the queues
by calling ieee80211_stop_queues().

As frames that have previously been sent for transmission
(num_pending_tx) are completed, we will decrease num_pending_tx and wake
the queues by calling ieee80211_wake_queue(). ieee80211_wake_queue()
does not call wake_tx_queue, so we might still have frames in the
queue at this point.

While the queues were stopped, the socket buffer might have filled up,
and in order for user space to write more, we need to free the frames
in the queue, since they are accounted to the socket. In order to free
them, we first need to transmit them.

In order to avoid trying to flush the queue every time we free a frame,
only do this when there are 3 or less frames pending, and while we
actually have frames in the queue. This logic was copied from
mt76_txq_schedule (mt76), one of few other drivers that are actually
using wake_tx_queue.

Suggested-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
---
 drivers/net/wireless/ath/ath10k/txrx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index cda164f6e9f6..1d3b2d2c3fee 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -95,6 +95,9 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
 		wake_up(&htt->empty_tx_wq);
 	spin_unlock_bh(&htt->tx_lock);
 
+	if (htt->num_pending_tx <= 3 && !list_empty(&ar->txqs))
+		ath10k_mac_tx_push_pending(ar);
+
 	dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
 
 	ath10k_report_offchan_tx(htt->ar, msdu);
-- 
2.17.0

^ permalink raw reply related

* Re: [PATCH bpf] bpf: fix truncated jump targets on heavy expansions
From: Alexei Starovoitov @ 2018-05-17 23:09 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: netdev
In-Reply-To: <20180516234411.18122-1-daniel@iogearbox.net>

On Thu, May 17, 2018 at 01:44:11AM +0200, Daniel Borkmann wrote:
> Recently during testing, I ran into the following panic:
> 
> Therefore it becomes necessary to detect and reject any such occasions
> in a generic way for native eBPF and cBPF to eBPF migrations. For
> the latter we can simply check bounds in the bpf_convert_filter()'s
> BPF_EMIT_JMP helper macro and bail out once we surpass limits. The
> bpf_patch_insn_single() for native eBPF (and cBPF to eBPF in case
> of subsequent hardening) is a bit more complex in that we need to
> detect such truncations before hitting the bpf_prog_realloc(). Thus
> the latter is split into an extra pass to probe problematic offsets
> on the original program in order to fail early. With that in place
> and carefully tested I no longer hit the panic and the rewrites are
> rejected properly. The above example panic I've seen on bpf-next,
> though the issue itself is generic in that a guard against this issue
> in bpf seems more appropriate in this case.
> 
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

Nice catch! Applied.

^ permalink raw reply

* Re: [PATCH ghak81 V3 3/3] audit: collect audit task parameters
From: Paul Moore @ 2018-05-17 23:04 UTC (permalink / raw)
  To: Richard Guy Briggs
  Cc: Linux-Audit Mailing List, LKML,
	Linux NetDev Upstream Mailing List, Netfilter Devel List,
	Linux Security Module list, Integrity Measurement Architecture,
	SElinux list, Eric Paris, Steve Grubb, Ingo Molnar, David Howells
In-Reply-To: <fbed63483b5206009ee43ae889b30d43051f386c.1526430313.git.rgb@redhat.com>

On Wed, May 16, 2018 at 7:55 AM, Richard Guy Briggs <rgb@redhat.com> wrote:
> The audit-related parameters in struct task_struct should ideally be
> collected together and accessed through a standard audit API.
>
> Collect the existing loginuid, sessionid and audit_context together in a
> new struct audit_task_info called "audit" in struct task_struct.
>
> Use kmem_cache to manage this pool of memory.
> Un-inline audit_free() to be able to always recover that memory.
>
> See: https://github.com/linux-audit/audit-kernel/issues/81
>
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> ---
>  include/linux/audit.h | 34 ++++++++++++++++++++++++----------
>  include/linux/sched.h |  5 +----
>  init/init_task.c      |  3 +--
>  init/main.c           |  2 ++
>  kernel/auditsc.c      | 51 ++++++++++++++++++++++++++++++++++++++++++---------
>  kernel/fork.c         |  2 +-
>  6 files changed, 71 insertions(+), 26 deletions(-)

As discussed on-list and offline, I'm going to hold off on this change
until the audit container ID work is father along.  That is the main
driver for this change, and until that is closer to ready I just can't
justify the extra overhead.

> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index 69c7847..4f824c4 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -216,8 +216,15 @@ static inline void audit_log_task_info(struct audit_buffer *ab,
>
>  /* These are defined in auditsc.c */
>                                 /* Public API */
> +struct audit_task_info {
> +       kuid_t                  loginuid;
> +       unsigned int            sessionid;
> +       struct audit_context    *ctx;
> +};
> +extern struct audit_task_info init_struct_audit;
> +extern void __init audit_task_init(void);
>  extern int  audit_alloc(struct task_struct *task);
> -extern void __audit_free(struct task_struct *task);
> +extern void audit_free(struct task_struct *task);
>  extern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1,
>                                   unsigned long a2, unsigned long a3);
>  extern void __audit_syscall_exit(int ret_success, long ret_value);
> @@ -239,12 +246,15 @@ extern void audit_seccomp_actions_logged(const char *names,
>
>  static inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
>  {
> -       task->audit_context = ctx;
> +       task->audit->ctx = ctx;
>  }
>
>  static inline struct audit_context *audit_context(void)
>  {
> -       return current->audit_context;
> +       if (current->audit)
> +               return current->audit->ctx;
> +       else
> +               return NULL;
>  }
>
>  static inline bool audit_dummy_context(void)
> @@ -252,11 +262,7 @@ static inline bool audit_dummy_context(void)
>         void *p = audit_context();
>         return !p || *(int *)p;
>  }
> -static inline void audit_free(struct task_struct *task)
> -{
> -       if (unlikely(task->audit_context))
> -               __audit_free(task);
> -}
> +
>  static inline void audit_syscall_entry(int major, unsigned long a0,
>                                        unsigned long a1, unsigned long a2,
>                                        unsigned long a3)
> @@ -328,12 +334,18 @@ extern int auditsc_get_stamp(struct audit_context *ctx,
>
>  static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
>  {
> -       return tsk->loginuid;
> +       if (tsk->audit)
> +               return tsk->audit->loginuid;
> +       else
> +               return INVALID_UID;
>  }
>
>  static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
>  {
> -       return tsk->sessionid;
> +       if (tsk->audit)
> +               return tsk->audit->sessionid;
> +       else
> +               return AUDIT_SID_UNSET;
>  }
>
>  extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
> @@ -458,6 +470,8 @@ static inline void audit_fanotify(unsigned int response)
>  extern int audit_n_rules;
>  extern int audit_signals;
>  #else /* CONFIG_AUDITSYSCALL */
> +static inline void __init audit_task_init(void)
> +{ }
>  static inline int audit_alloc(struct task_struct *task)
>  {
>         return 0;
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index b3d697f..6a5db0e 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -29,7 +29,6 @@
>  #include <linux/task_io_accounting.h>
>
>  /* task_struct member predeclarations (sorted alphabetically): */
> -struct audit_context;
>  struct backing_dev_info;
>  struct bio_list;
>  struct blk_plug;
> @@ -832,10 +831,8 @@ struct task_struct {
>
>         struct callback_head            *task_works;
>
> -       struct audit_context            *audit_context;
>  #ifdef CONFIG_AUDITSYSCALL
> -       kuid_t                          loginuid;
> -       unsigned int                    sessionid;
> +       struct audit_task_info          *audit;
>  #endif
>         struct seccomp                  seccomp;
>
> diff --git a/init/init_task.c b/init/init_task.c
> index 74f60ba..4058840 100644
> --- a/init/init_task.c
> +++ b/init/init_task.c
> @@ -119,8 +119,7 @@ struct task_struct init_task
>         .thread_group   = LIST_HEAD_INIT(init_task.thread_group),
>         .thread_node    = LIST_HEAD_INIT(init_signals.thread_head),
>  #ifdef CONFIG_AUDITSYSCALL
> -       .loginuid       = INVALID_UID,
> -       .sessionid      = AUDIT_SID_UNSET,
> +       .audit          = &init_struct_audit,
>  #endif
>  #ifdef CONFIG_PERF_EVENTS
>         .perf_event_mutex = __MUTEX_INITIALIZER(init_task.perf_event_mutex),
> diff --git a/init/main.c b/init/main.c
> index b795aa3..7ca3dfb 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -91,6 +91,7 @@
>  #include <linux/cache.h>
>  #include <linux/rodata_test.h>
>  #include <linux/jump_label.h>
> +#include <linux/audit.h>
>
>  #include <asm/io.h>
>  #include <asm/bugs.h>
> @@ -720,6 +721,7 @@ asmlinkage __visible void __init start_kernel(void)
>         nsfs_init();
>         cpuset_init();
>         cgroup_init();
> +       audit_task_init();
>         taskstats_init_early();
>         delayacct_init();
>
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index ef3e189..4b1138a 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -841,7 +841,7 @@ static inline struct audit_context *audit_take_context(struct task_struct *tsk,
>                                                       int return_valid,
>                                                       long return_code)
>  {
> -       struct audit_context *context = tsk->audit_context;
> +       struct audit_context *context = tsk->audit->ctx;
>
>         if (!context)
>                 return NULL;
> @@ -926,6 +926,15 @@ static inline struct audit_context *audit_alloc_context(enum audit_state state)
>         return context;
>  }
>
> +static struct kmem_cache *audit_task_cache;
> +
> +void __init audit_task_init(void)
> +{
> +       audit_task_cache = kmem_cache_create("audit_task",
> +                                            sizeof(struct audit_task_info),
> +                                            0, SLAB_PANIC, NULL);
> +}
> +
>  /**
>   * audit_alloc - allocate an audit context block for a task
>   * @tsk: task
> @@ -940,17 +949,28 @@ int audit_alloc(struct task_struct *tsk)
>         struct audit_context *context;
>         enum audit_state     state;
>         char *key = NULL;
> +       struct audit_task_info *info;
> +
> +       info = kmem_cache_zalloc(audit_task_cache, GFP_KERNEL);
> +       if (!info)
> +               return -ENOMEM;
> +       info->loginuid = audit_get_loginuid(current);
> +       info->sessionid = audit_get_sessionid(current);
> +       tsk->audit = info;
>
>         if (likely(!audit_ever_enabled))
>                 return 0; /* Return if not auditing. */
>
>         state = audit_filter_task(tsk, &key);
>         if (state == AUDIT_DISABLED) {
> +               audit_set_context(tsk, NULL);
>                 clear_tsk_thread_flag(tsk, TIF_SYSCALL_AUDIT);
>                 return 0;
>         }
>
>         if (!(context = audit_alloc_context(state))) {
> +               tsk->audit = NULL;
> +               kmem_cache_free(audit_task_cache, info);
>                 kfree(key);
>                 audit_log_lost("out of memory in audit_alloc");
>                 return -ENOMEM;
> @@ -962,6 +982,12 @@ int audit_alloc(struct task_struct *tsk)
>         return 0;
>  }
>
> +struct audit_task_info init_struct_audit = {
> +       .loginuid = INVALID_UID,
> +       .sessionid = AUDIT_SID_UNSET,
> +       .ctx = NULL,
> +};
> +
>  static inline void audit_free_context(struct audit_context *context)
>  {
>         audit_free_names(context);
> @@ -1469,26 +1495,33 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
>  }
>
>  /**
> - * __audit_free - free a per-task audit context
> + * audit_free - free a per-task audit context
>   * @tsk: task whose audit context block to free
>   *
>   * Called from copy_process and do_exit
>   */
> -void __audit_free(struct task_struct *tsk)
> +void audit_free(struct task_struct *tsk)
>  {
>         struct audit_context *context;
> +       struct audit_task_info *info;
>
>         context = audit_take_context(tsk, 0, 0);
> -       if (!context)
> -               return;
> -
>         /* Check for system calls that do not go through the exit
>          * function (e.g., exit_group), then free context block.
>          * We use GFP_ATOMIC here because we might be doing this
>          * in the context of the idle thread */
>         /* that can happen only if we are called from do_exit() */
> -       if (context->in_syscall && context->current_state == AUDIT_RECORD_CONTEXT)
> +       if (context && context->in_syscall &&
> +           context->current_state == AUDIT_RECORD_CONTEXT)
>                 audit_log_exit(context, tsk);
> +       /* Freeing the audit_task_info struct must be performed after
> +        * audit_log_exit() due to need for loginuid and sessionid.
> +        */
> +       info = tsk->audit;
> +       tsk->audit = NULL;
> +       kmem_cache_free(audit_task_cache, info);
> +       if (!context)
> +               return;
>         if (!list_empty(&context->killed_trees))
>                 audit_kill_trees(&context->killed_trees);
>
> @@ -2071,8 +2104,8 @@ int audit_set_loginuid(kuid_t loginuid)
>                         sessionid = (unsigned int)atomic_inc_return(&session_id);
>         }
>
> -       task->sessionid = sessionid;
> -       task->loginuid = loginuid;
> +       task->audit->sessionid = sessionid;
> +       task->audit->loginuid = loginuid;
>  out:
>         audit_log_set_loginuid(oldloginuid, loginuid, oldsessionid, sessionid, rc);
>         return rc;
> diff --git a/kernel/fork.c b/kernel/fork.c
> index cd18448..92ab849 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1713,7 +1713,7 @@ static __latent_entropy struct task_struct *copy_process(
>         p->start_time = ktime_get_ns();
>         p->real_start_time = ktime_get_boot_ns();
>         p->io_context = NULL;
> -       audit_set_context(p, NULL);
> +       p->audit = NULL;
>         cgroup_fork(p);
>  #ifdef CONFIG_NUMA
>         p->mempolicy = mpol_dup(p->mempolicy);
> --
> 1.8.3.1

-- 
paul moore
www.paul-moore.com

^ permalink raw reply

* Re: [PATCH ghak81 V3 2/3] audit: normalize loginuid read access
From: Paul Moore @ 2018-05-17 23:02 UTC (permalink / raw)
  To: Richard Guy Briggs
  Cc: Linux-Audit Mailing List, LKML,
	Linux NetDev Upstream Mailing List, Netfilter Devel List,
	Linux Security Module list, Integrity Measurement Architecture,
	SElinux list, Eric Paris, Steve Grubb, Ingo Molnar, David Howells
In-Reply-To: <a50926963f4527a5273e0688275d1e9361e8d02e.1526430313.git.rgb@redhat.com>

On Wed, May 16, 2018 at 7:55 AM, Richard Guy Briggs <rgb@redhat.com> wrote:
> Recognizing that the loginuid is an internal audit value, use an access
> function to retrieve the audit loginuid value for the task rather than
> reaching directly into the task struct to get it.
>
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> ---
>  kernel/auditsc.c | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)

Also merged into audit/next.

> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index f3d3dc6..ef3e189 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -374,7 +374,7 @@ static int audit_field_compare(struct task_struct *tsk,
>         case AUDIT_COMPARE_EGID_TO_OBJ_GID:
>                 return audit_compare_gid(cred->egid, name, f, ctx);
>         case AUDIT_COMPARE_AUID_TO_OBJ_UID:
> -               return audit_compare_uid(tsk->loginuid, name, f, ctx);
> +               return audit_compare_uid(audit_get_loginuid(tsk), name, f, ctx);
>         case AUDIT_COMPARE_SUID_TO_OBJ_UID:
>                 return audit_compare_uid(cred->suid, name, f, ctx);
>         case AUDIT_COMPARE_SGID_TO_OBJ_GID:
> @@ -385,7 +385,8 @@ static int audit_field_compare(struct task_struct *tsk,
>                 return audit_compare_gid(cred->fsgid, name, f, ctx);
>         /* uid comparisons */
>         case AUDIT_COMPARE_UID_TO_AUID:
> -               return audit_uid_comparator(cred->uid, f->op, tsk->loginuid);
> +               return audit_uid_comparator(cred->uid, f->op,
> +                                           audit_get_loginuid(tsk));
>         case AUDIT_COMPARE_UID_TO_EUID:
>                 return audit_uid_comparator(cred->uid, f->op, cred->euid);
>         case AUDIT_COMPARE_UID_TO_SUID:
> @@ -394,11 +395,14 @@ static int audit_field_compare(struct task_struct *tsk,
>                 return audit_uid_comparator(cred->uid, f->op, cred->fsuid);
>         /* auid comparisons */
>         case AUDIT_COMPARE_AUID_TO_EUID:
> -               return audit_uid_comparator(tsk->loginuid, f->op, cred->euid);
> +               return audit_uid_comparator(audit_get_loginuid(tsk), f->op,
> +                                           cred->euid);
>         case AUDIT_COMPARE_AUID_TO_SUID:
> -               return audit_uid_comparator(tsk->loginuid, f->op, cred->suid);
> +               return audit_uid_comparator(audit_get_loginuid(tsk), f->op,
> +                                           cred->suid);
>         case AUDIT_COMPARE_AUID_TO_FSUID:
> -               return audit_uid_comparator(tsk->loginuid, f->op, cred->fsuid);
> +               return audit_uid_comparator(audit_get_loginuid(tsk), f->op,
> +                                           cred->fsuid);
>         /* euid comparisons */
>         case AUDIT_COMPARE_EUID_TO_SUID:
>                 return audit_uid_comparator(cred->euid, f->op, cred->suid);
> @@ -611,7 +615,8 @@ static int audit_filter_rules(struct task_struct *tsk,
>                                 result = match_tree_refs(ctx, rule->tree);
>                         break;
>                 case AUDIT_LOGINUID:
> -                       result = audit_uid_comparator(tsk->loginuid, f->op, f->uid);
> +                       result = audit_uid_comparator(audit_get_loginuid(tsk),
> +                                                     f->op, f->uid);
>                         break;
>                 case AUDIT_LOGINUID_SET:
>                         result = audit_comparator(audit_loginuid_set(tsk), f->op, f->val);
> @@ -2278,14 +2283,15 @@ int audit_signal_info(int sig, struct task_struct *t)
>  {
>         struct audit_aux_data_pids *axp;
>         struct audit_context *ctx = audit_context();
> -       kuid_t uid = current_uid(), t_uid = task_uid(t);
> +       kuid_t uid = current_uid(), auid, t_uid = task_uid(t);
>
>         if (auditd_test_task(t) &&
>             (sig == SIGTERM || sig == SIGHUP ||
>              sig == SIGUSR1 || sig == SIGUSR2)) {
>                 audit_sig_pid = task_tgid_nr(current);
> -               if (uid_valid(current->loginuid))
> -                       audit_sig_uid = current->loginuid;
> +               auid = audit_get_loginuid(current);
> +               if (uid_valid(auid))
> +                       audit_sig_uid = auid;
>                 else
>                         audit_sig_uid = uid;
>                 security_task_getsecid(current, &audit_sig_sid);
> --
> 1.8.3.1
>



-- 
paul moore
www.paul-moore.com

^ permalink raw reply

* Re: [PATCH ghak81 V3 1/3] audit: use new audit_context access funciton for seccomp_actions_logged
From: Paul Moore @ 2018-05-17 23:00 UTC (permalink / raw)
  To: Richard Guy Briggs
  Cc: Linux-Audit Mailing List, LKML,
	Linux NetDev Upstream Mailing List, Netfilter Devel List,
	Linux Security Module list, Integrity Measurement Architecture,
	SElinux list, Eric Paris, Steve Grubb, Ingo Molnar, David Howells
In-Reply-To: <12a849e41468d761e0782c733e58db47d83b0d16.1526430313.git.rgb@redhat.com>

On Wed, May 16, 2018 at 7:55 AM, Richard Guy Briggs <rgb@redhat.com> wrote:
> On the rebase of the following commit on the new seccomp actions_logged
> function, one audit_context access was missed.
>
> commit cdfb6b341f0f2409aba24b84f3b4b2bba50be5c5
> ("audit: use inline function to get audit context")
>
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> ---
>  kernel/auditsc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Merged into audit/next, thanks for the follow-up.

> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index cbab0da..f3d3dc6 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -2497,7 +2497,7 @@ void audit_seccomp_actions_logged(const char *names, const char *old_names,
>         if (!audit_enabled)
>                 return;
>
> -       ab = audit_log_start(current->audit_context, GFP_KERNEL,
> +       ab = audit_log_start(audit_context(), GFP_KERNEL,
>                              AUDIT_CONFIG_CHANGE);
>         if (unlikely(!ab))
>                 return;
> --
> 1.8.3.1

-- 
paul moore
www.paul-moore.com

^ permalink raw reply

* Re: [patch net-next RFC 04/12] dsa: set devlink port attrs for dsa ports
From: Florian Fainelli @ 2018-05-17 22:45 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Jiri Pirko, netdev, davem, idosch, jakub.kicinski, mlxsw,
	vivien.didelot, michael.chan, ganeshgr, saeedm, simon.horman,
	pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
	alexander.h.duyck, ogerlitz, dsahern, vijaya.guvva,
	satananda.burla, raghu.vatsavayi, felix.manlunas, gospo,
	sathya.perla, vasundhara-v.volam, tariqt, eranbe,
	jeffrey.t.kirsher
In-Reply-To: <20180517224017.GA3943@lunn.ch>

On 05/17/2018 03:40 PM, Andrew Lunn wrote:
> On Thu, May 17, 2018 at 03:06:36PM -0700, Florian Fainelli wrote:
>> On 05/17/2018 02:08 PM, Andrew Lunn wrote:
>>> On Thu, May 17, 2018 at 10:48:55PM +0200, Jiri Pirko wrote:
>>>> Thu, May 17, 2018 at 09:14:32PM CEST, f.fainelli@gmail.com wrote:
>>>>> On 05/17/2018 10:39 AM, Jiri Pirko wrote:
>>>>>>>> That is compiled inside "fixed_phy", isn't it?
>>>>>>>
>>>>>>> It matches what CONFIG_FIXED_PHY is, so if it's built-in it also becomes
>>>>>>> built-in, if is modular, it is also modular, this was fixed with
>>>>>>> 40013ff20b1beed31184935fc0aea6a859d4d4ef ("net: dsa: Fix functional
>>>>>>> dsa-loop dependency on FIXED_PHY")
>>>>>>
>>>>>> Now I have it compiled as module, and after modprobe dsa_loop I see:
>>>>>> [ 1168.129202] libphy: Fixed MDIO Bus: probed
>>>>>> [ 1168.222716] dsa-loop fixed-0:1f: DSA mockup driver: 0x1f
>>>>>>
>>>>>> This messages I did not see when I had fixed_phy compiled as buildin.
>>>>>>
>>>>>> But I still see no netdevs :/
>>>>>
>>>>> The platform data assumes there is a network device named "eth0" as the
>>>>
>>>> Oups, I missed, I created dummy device and modprobed again. Now I see:
>>>>
>>>> $ sudo devlink port
>>>> mdio_bus/fixed-0:1f/0: type eth netdev lan1
>>>> mdio_bus/fixed-0:1f/1: type eth netdev lan2
>>>> mdio_bus/fixed-0:1f/2: type eth netdev lan3
>>>> mdio_bus/fixed-0:1f/3: type eth netdev lan4
>>>> mdio_bus/fixed-0:1f/4: type notset
>>>> mdio_bus/fixed-0:1f/5: type notset
>>>> mdio_bus/fixed-0:1f/6: type notset
>>>> mdio_bus/fixed-0:1f/7: type notset
>>>> mdio_bus/fixed-0:1f/8: type notset
>>>> mdio_bus/fixed-0:1f/9: type notset
>>>> mdio_bus/fixed-0:1f/10: type notset
>>>> mdio_bus/fixed-0:1f/11: type notset
>>>>
>>>> I wonder why there are ports 4-11
>>>
>>> Hi Jiri
>>>
>>>         ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
>>>
>>> It is allocating a switch with 12 ports. However only 4 of them have
>>> names. So the core only creates slave devices for those 4.
>>>
>>> This is a useful test. Real hardware often has unused ports. A WiFi AP
>>> with a 7 port switch which only uses 6 ports is often seen.
>>
>> The following patch should fix this:
>>
>>
>> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
>> index adf50fbc4c13..a06c29ec91f0 100644
>> --- a/net/dsa/dsa2.c
>> +++ b/net/dsa/dsa2.c
>> @@ -262,13 +262,14 @@ static int dsa_port_setup(struct dsa_port *dp)
>>
>>         memset(&dp->devlink_port, 0, sizeof(dp->devlink_port));
>>
>> +       if (dp->type == DSA_PORT_TYPE_UNUSED)
>> +               return 0;
>> +
>>         err = devlink_port_register(ds->devlink, &dp->devlink_port,
>> dp->index);
> 
> Hi Florian, Jiri
> 
> Maybe it is better to add a devlink port type unused?

The port does not exist on the switch, so it should not even be
registered IMHO.
-- 
Florian

^ permalink raw reply

* Re: [net-next PATCH v2 3/4] net-sysfs: Add interface for Rx queue map per Tx queue
From: Nambiar, Amritha @ 2018-05-17 22:43 UTC (permalink / raw)
  To: Florian Fainelli, netdev, davem
  Cc: alexander.h.duyck, sridhar.samudrala, edumazet, hannes, tom
In-Reply-To: <6f246cbf-f7e2-2931-4d42-68322dcd7c98@gmail.com>

On 5/17/2018 12:05 PM, Florian Fainelli wrote:
> On 05/15/2018 06:26 PM, Amritha Nambiar wrote:
>> Extend transmit queue sysfs attribute to configure Rx queue map
>> per Tx queue. By default no receive queues are configured for the
>> Tx queue.
>>
>> - /sys/class/net/eth0/queues/tx-*/xps_rxqs
> 
> Please include an update to Documentation/ABI/testing/sysfs-class-net
> with your new attribute.
> 
Will do in the next version.
Thanks.

^ permalink raw reply

* Re: [patch net-next RFC 04/12] dsa: set devlink port attrs for dsa ports
From: Andrew Lunn @ 2018-05-17 22:40 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Jiri Pirko, netdev, davem, idosch, jakub.kicinski, mlxsw,
	vivien.didelot, michael.chan, ganeshgr, saeedm, simon.horman,
	pieter.jansenvanvuuren, john.hurley, dirk.vandermerwe,
	alexander.h.duyck, ogerlitz, dsahern, vijaya.guvva,
	satananda.burla, raghu.vatsavayi, felix.manlunas, gospo,
	sathya.perla, vasundhara-v.volam, tariqt, eranbe,
	jeffrey.t.kirsher
In-Reply-To: <862a5fb4-7a3c-9c3f-bd50-f25bbcb2ca59@gmail.com>

On Thu, May 17, 2018 at 03:06:36PM -0700, Florian Fainelli wrote:
> On 05/17/2018 02:08 PM, Andrew Lunn wrote:
> > On Thu, May 17, 2018 at 10:48:55PM +0200, Jiri Pirko wrote:
> >> Thu, May 17, 2018 at 09:14:32PM CEST, f.fainelli@gmail.com wrote:
> >>> On 05/17/2018 10:39 AM, Jiri Pirko wrote:
> >>>>>> That is compiled inside "fixed_phy", isn't it?
> >>>>>
> >>>>> It matches what CONFIG_FIXED_PHY is, so if it's built-in it also becomes
> >>>>> built-in, if is modular, it is also modular, this was fixed with
> >>>>> 40013ff20b1beed31184935fc0aea6a859d4d4ef ("net: dsa: Fix functional
> >>>>> dsa-loop dependency on FIXED_PHY")
> >>>>
> >>>> Now I have it compiled as module, and after modprobe dsa_loop I see:
> >>>> [ 1168.129202] libphy: Fixed MDIO Bus: probed
> >>>> [ 1168.222716] dsa-loop fixed-0:1f: DSA mockup driver: 0x1f
> >>>>
> >>>> This messages I did not see when I had fixed_phy compiled as buildin.
> >>>>
> >>>> But I still see no netdevs :/
> >>>
> >>> The platform data assumes there is a network device named "eth0" as the
> >>
> >> Oups, I missed, I created dummy device and modprobed again. Now I see:
> >>
> >> $ sudo devlink port
> >> mdio_bus/fixed-0:1f/0: type eth netdev lan1
> >> mdio_bus/fixed-0:1f/1: type eth netdev lan2
> >> mdio_bus/fixed-0:1f/2: type eth netdev lan3
> >> mdio_bus/fixed-0:1f/3: type eth netdev lan4
> >> mdio_bus/fixed-0:1f/4: type notset
> >> mdio_bus/fixed-0:1f/5: type notset
> >> mdio_bus/fixed-0:1f/6: type notset
> >> mdio_bus/fixed-0:1f/7: type notset
> >> mdio_bus/fixed-0:1f/8: type notset
> >> mdio_bus/fixed-0:1f/9: type notset
> >> mdio_bus/fixed-0:1f/10: type notset
> >> mdio_bus/fixed-0:1f/11: type notset
> >>
> >> I wonder why there are ports 4-11
> > 
> > Hi Jiri
> > 
> >         ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
> > 
> > It is allocating a switch with 12 ports. However only 4 of them have
> > names. So the core only creates slave devices for those 4.
> > 
> > This is a useful test. Real hardware often has unused ports. A WiFi AP
> > with a 7 port switch which only uses 6 ports is often seen.
> 
> The following patch should fix this:
> 
> 
> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> index adf50fbc4c13..a06c29ec91f0 100644
> --- a/net/dsa/dsa2.c
> +++ b/net/dsa/dsa2.c
> @@ -262,13 +262,14 @@ static int dsa_port_setup(struct dsa_port *dp)
> 
>         memset(&dp->devlink_port, 0, sizeof(dp->devlink_port));
> 
> +       if (dp->type == DSA_PORT_TYPE_UNUSED)
> +               return 0;
> +
>         err = devlink_port_register(ds->devlink, &dp->devlink_port,
> dp->index);

Hi Florian, Jiri

Maybe it is better to add a devlink port type unused?

      Andrew

^ permalink raw reply

* Re: [PATCH iproute2] ip link: Do not call ll_name_to_index when creating a new link
From: Stephen Hemminger @ 2018-05-17 22:36 UTC (permalink / raw)
  To: dsahern; +Cc: netdev, David Ahern
In-Reply-To: <20180517222237.72388-1-dsahern@kernel.org>

On Thu, 17 May 2018 16:22:37 -0600
dsahern@kernel.org wrote:

> From: David Ahern <dsahern@gmail.com>
> 
> Using iproute2 to create a bridge and add 4094 vlans to it can take from
> 2 to 3 *minutes*. The reason is the extraneous call to ll_name_to_index.
> ll_name_to_index results in an ioctl(SIOCGIFINDEX) call which in turn
> invokes dev_load. If the index does not exist, which it won't when
> creating a new link, dev_load calls modprobe twice -- once for
> netdev-NAME and again for NAME. This is unnecessary overhead for each
> link create.
> 
> When ip link is invoked for a new device, there is no reason to
> call ll_name_to_index for the new device. With this patch, creating
> a bridge and adding 4094 vlans takes less than 3 *seconds*.
> 
> Signed-off-by: David Ahern <dsahern@gmail.com>

Yes this looks like a real problem.
Isn't the cache supposed to reduce this?

Don't like to make lots of special case flags.

^ permalink raw reply

* Re: [bpf PATCH v2 1/2] bpf: sockmap update rollback on error can incorrectly dec prog refcnt
From: Daniel Borkmann @ 2018-05-17 22:30 UTC (permalink / raw)
  To: John Fastabend, ast; +Cc: netdev
In-Reply-To: <20180517210635.13283.94472.stgit@john-Precision-Tower-5810>

On 05/17/2018 11:06 PM, John Fastabend wrote:
> If the user were to only attach one of the parse or verdict programs
> then it is possible a subsequent sockmap update could incorrectly
> decrement the refcnt on the program. This happens because in the
> rollback logic, after an error, we have to decrement the program
> reference count when its been incremented. However, we only increment
> the program reference count if the user has both a verdict and a
> parse program. The reason for this is because, at least at the
> moment, both are required for any one to be meaningful. The problem
> fixed here is in the rollback path we decrement the program refcnt
> even if only one existing. But we never incremented the refcnt in
> the first place creating an imbalance.
> 
> This patch fixes the error path to handle this case.
> 
> Fixes: 2f857d04601a ("bpf: sockmap, remove STRPARSER map_flags and add multi-map support")
> Reported-by: Daniel Borkmann <daniel@iogearbox.net>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> Acked-by: Martin KaFai Lau <kafai@fb.com>

Applied to bpf tree, thanks!

^ permalink raw reply

* Re: [PATCH net] net: dsa: Do not register devlink for unused ports
From: Florian Fainelli @ 2018-05-17 22:29 UTC (permalink / raw)
  To: netdev; +Cc: jiri, Andrew Lunn, Vivien Didelot, David S. Miller, open list
In-Reply-To: <20180517221626.13045-1-f.fainelli@gmail.com>

On 05/17/2018 03:16 PM, Florian Fainelli wrote:
> Even if commit 1d27732f411d ("net: dsa: setup and teardown ports") indicated
> that registering a devlink instance for unused ports is not a problem, and this
> is true, this can be confusing nonetheless, so let's not do it.
> 
> Fixes: 1d27732f411d ("net: dsa: setup and teardown ports")
> Reported-by: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  net/dsa/dsa2.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> index adf50fbc4c13..cc45a8ca45fb 100644
> --- a/net/dsa/dsa2.c
> +++ b/net/dsa/dsa2.c
> @@ -262,13 +262,14 @@ static int dsa_port_setup(struct dsa_port *dp)
>  
>  	memset(&dp->devlink_port, 0, sizeof(dp->devlink_port));
>  
> +	if (dp->type == DSA_PORT_TYPE_UNUSED)
> +		return 0;
> +
>  	err = devlink_port_register(ds->devlink, &dp->devlink_port, dp->index);
>  	if (err)
>  		return err;
>  
>  	switch (dp->type) {
> -	case DSA_PORT_TYPE_UNUSED:
> -		break;
>  	case DSA_PORT_TYPE_CPU:
>  	case DSA_PORT_TYPE_DSA:
>  		err = dsa_port_link_register_of(dp);
> @@ -293,11 +294,12 @@ static int dsa_port_setup(struct dsa_port *dp)
>  
>  static void dsa_port_teardown(struct dsa_port *dp)
>  {
> +	if (dp->type == DSA_PORT_TYPE_UNUSED)
> +		return;
> +
>  	devlink_port_unregister(&dp->devlink_port);
>  
>  	switch (dp->type) {
> -	case DSA_PORT_TYPE_UNUSED:
> -		break;

Actually those should be kept in there in order not to generate a
warning about DSA_PORT_TYPE_UNUSED not being handled by the switch()
case statement, I will resubmit that shortly, or we could even move the
registration until after, either way is likely fine.
-- 
Florian

^ permalink raw reply

* Re: [PATCH] ath10k: transmit queued frames after waking queues
From: Adrian Chadd @ 2018-05-17 22:26 UTC (permalink / raw)
  To: niklas.cassel
  Cc: Kalle Valo, David Miller, ath10k, linux-wireless, netdev,
	Linux Kernel Mailing List
In-Reply-To: <20180517231512.13085-1-niklas.cassel@linaro.org>

On Thu, 17 May 2018 at 16:16, Niklas Cassel <niklas.cassel@linaro.org>
wrote:

> diff --git a/drivers/net/wireless/ath/ath10k/txrx.c
b/drivers/net/wireless/ath/ath10k/txrx.c
> index cda164f6e9f6..1d3b2d2c3fee 100644
> --- a/drivers/net/wireless/ath/ath10k/txrx.c
> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
> @@ -95,6 +95,9 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
>                  wake_up(&htt->empty_tx_wq);
>          spin_unlock_bh(&htt->tx_lock);

> +       if (htt->num_pending_tx <= 3 && !list_empty(&ar->txqs))
> +               ath10k_mac_tx_push_pending(ar);
> +

Just sanity checking - what's protecting htt->num_pending_tx? or is it
serialised some other way?

>          dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);

>          ath10k_report_offchan_tx(htt->ar, msdu);
> --
> 2.17.0

^ permalink raw reply

* Re: [PATCH bpf-next 3/3] bpf: Add mtu checking to FIB forwarding helper
From: Daniel Borkmann @ 2018-05-17 22:22 UTC (permalink / raw)
  To: David Ahern, netdev, borkmann, ast; +Cc: davem
In-Reply-To: <20180517160930.25076-4-dsahern@gmail.com>

On 05/17/2018 06:09 PM, David Ahern wrote:
> Add check that egress MTU can handle packet to be forwarded. If
> the MTU is less than the packet lenght, return 0 meaning the
> packet is expected to continue up the stack for help - eg.,
> fragmenting the packet or sending an ICMP.
> 
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
>  net/core/filter.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 6d0d1560bd70..c47c47a75d4b 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4098,6 +4098,7 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
>  	struct fib_nh *nh;
>  	struct flowi4 fl4;
>  	int err;
> +	u32 mtu;
>  
>  	dev = dev_get_by_index_rcu(net, params->ifindex);
>  	if (unlikely(!dev))
> @@ -4149,6 +4150,10 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
>  	if (res.fi->fib_nhs > 1)
>  		fib_select_path(net, &res, &fl4, NULL);
>  
> +	mtu = ip_mtu_from_fib_result(&res, params->ipv4_dst);
> +	if (params->tot_len > mtu)
> +		return 0;
> +
>  	nh = &res.fi->fib_nh[res.nh_sel];
>  
>  	/* do not handle lwt encaps right now */
> @@ -4188,6 +4193,7 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
>  	struct flowi6 fl6;
>  	int strict = 0;
>  	int oif;
> +	u32 mtu;
>  
>  	/* link local addresses are never forwarded */
>  	if (rt6_need_strict(dst) || rt6_need_strict(src))
> @@ -4250,6 +4256,10 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
>  						       fl6.flowi6_oif, NULL,
>  						       strict);
>  
> +	mtu = ip6_mtu_from_fib6(f6i, dst, src);
> +	if (params->tot_len > mtu)
> +		return 0;
> +
>  	if (f6i->fib6_nh.nh_lwtstate)
>  		return 0;

Could you elaborate how this interacts in tc BPF use case where you have e.g.
GSO packets and tot_len from aggregated packets would definitely be larger
than MTU (e.g. see is_skb_forwardable() as one example on such checks)? Should
this be an opt-in via a new flag for the helper?

Thanks,
Daniel

^ permalink raw reply

* [PATCH iproute2] ip link: Do not call ll_name_to_index when creating a new link
From: dsahern @ 2018-05-17 22:22 UTC (permalink / raw)
  To: netdev, stephen; +Cc: David Ahern

From: David Ahern <dsahern@gmail.com>

Using iproute2 to create a bridge and add 4094 vlans to it can take from
2 to 3 *minutes*. The reason is the extraneous call to ll_name_to_index.
ll_name_to_index results in an ioctl(SIOCGIFINDEX) call which in turn
invokes dev_load. If the index does not exist, which it won't when
creating a new link, dev_load calls modprobe twice -- once for
netdev-NAME and again for NAME. This is unnecessary overhead for each
link create.

When ip link is invoked for a new device, there is no reason to
call ll_name_to_index for the new device. With this patch, creating
a bridge and adding 4094 vlans takes less than 3 *seconds*.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 ip/ip_common.h    |  3 ++-
 ip/iplink.c       | 22 +++++++++++++---------
 ip/iplink_vxcan.c |  3 ++-
 ip/link_veth.c    |  3 ++-
 4 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/ip/ip_common.h b/ip/ip_common.h
index 1b89795caa58..67f413474631 100644
--- a/ip/ip_common.h
+++ b/ip/ip_common.h
@@ -132,7 +132,8 @@ struct link_util {
 
 struct link_util *get_link_kind(const char *kind);
 
-int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type);
+int iplink_parse(int argc, char **argv, struct iplink_req *req,
+		 char **type, bool is_add_cmd);
 
 /* iplink_bridge.c */
 void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
diff --git a/ip/iplink.c b/ip/iplink.c
index e6bb4493120e..c8bf49ed3d24 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -571,7 +571,8 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
 	return 0;
 }
 
-int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
+int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type,
+		 bool is_add_cmd)
 {
 	char *name = NULL;
 	char *dev = NULL;
@@ -610,7 +611,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
 			name = *argv;
 			if (!dev) {
 				dev = name;
-				dev_index = ll_name_to_index(dev);
+				if (!is_add_cmd)
+					dev_index = ll_name_to_index(dev);
 			}
 		} else if (strcmp(*argv, "index") == 0) {
 			NEXT_ARG();
@@ -919,7 +921,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
 			if (check_ifname(*argv))
 				invarg("\"dev\" not a valid ifname", *argv);
 			dev = *argv;
-			dev_index = ll_name_to_index(dev);
+			if (!is_add_cmd)
+				dev_index = ll_name_to_index(dev);
 		}
 		argc--; argv++;
 	}
@@ -1011,7 +1014,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
 	return ret;
 }
 
-static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
+static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv,
+			 bool is_add_cmd)
 {
 	char *type = NULL;
 	struct iplink_req req = {
@@ -1022,7 +1026,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
 	};
 	int ret;
 
-	ret = iplink_parse(argc, argv, &req, &type);
+	ret = iplink_parse(argc, argv, &req, &type, is_add_cmd);
 	if (ret < 0)
 		return ret;
 
@@ -1630,18 +1634,18 @@ int do_iplink(int argc, char **argv)
 		if (matches(*argv, "add") == 0)
 			return iplink_modify(RTM_NEWLINK,
 					     NLM_F_CREATE|NLM_F_EXCL,
-					     argc-1, argv+1);
+					     argc-1, argv+1, true);
 		if (matches(*argv, "set") == 0 ||
 		    matches(*argv, "change") == 0)
 			return iplink_modify(RTM_NEWLINK, 0,
-					     argc-1, argv+1);
+					     argc-1, argv+1, false);
 		if (matches(*argv, "replace") == 0)
 			return iplink_modify(RTM_NEWLINK,
 					     NLM_F_CREATE|NLM_F_REPLACE,
-					     argc-1, argv+1);
+					     argc-1, argv+1, false);
 		if (matches(*argv, "delete") == 0)
 			return iplink_modify(RTM_DELLINK, 0,
-					     argc-1, argv+1);
+					     argc-1, argv+1, false);
 	} else {
 #if IPLINK_IOCTL_COMPAT
 		if (matches(*argv, "set") == 0)
diff --git a/ip/iplink_vxcan.c b/ip/iplink_vxcan.c
index 8b08c9a70c65..e30a784d9851 100644
--- a/ip/iplink_vxcan.c
+++ b/ip/iplink_vxcan.c
@@ -56,7 +56,8 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv,
 
 	n->nlmsg_len += sizeof(struct ifinfomsg);
 
-	err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)n, &type);
+	err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)n, &type,
+			   false);
 	if (err < 0)
 		return err;
 
diff --git a/ip/link_veth.c b/ip/link_veth.c
index 33e8f2b102e7..68823931c0ec 100644
--- a/ip/link_veth.c
+++ b/ip/link_veth.c
@@ -54,7 +54,8 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
 
 	n->nlmsg_len += sizeof(struct ifinfomsg);
 
-	err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)n, &type);
+	err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)n, &type,
+			   false);
 	if (err < 0)
 		return err;
 
-- 
2.11.0

^ permalink raw reply related

* [PATCH net] net: dsa: Do not register devlink for unused ports
From: Florian Fainelli @ 2018-05-17 22:16 UTC (permalink / raw)
  To: netdev
  Cc: jiri, Florian Fainelli, Andrew Lunn, Vivien Didelot,
	David S. Miller, open list

Even if commit 1d27732f411d ("net: dsa: setup and teardown ports") indicated
that registering a devlink instance for unused ports is not a problem, and this
is true, this can be confusing nonetheless, so let's not do it.

Fixes: 1d27732f411d ("net: dsa: setup and teardown ports")
Reported-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/dsa2.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index adf50fbc4c13..cc45a8ca45fb 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -262,13 +262,14 @@ static int dsa_port_setup(struct dsa_port *dp)
 
 	memset(&dp->devlink_port, 0, sizeof(dp->devlink_port));
 
+	if (dp->type == DSA_PORT_TYPE_UNUSED)
+		return 0;
+
 	err = devlink_port_register(ds->devlink, &dp->devlink_port, dp->index);
 	if (err)
 		return err;
 
 	switch (dp->type) {
-	case DSA_PORT_TYPE_UNUSED:
-		break;
 	case DSA_PORT_TYPE_CPU:
 	case DSA_PORT_TYPE_DSA:
 		err = dsa_port_link_register_of(dp);
@@ -293,11 +294,12 @@ static int dsa_port_setup(struct dsa_port *dp)
 
 static void dsa_port_teardown(struct dsa_port *dp)
 {
+	if (dp->type == DSA_PORT_TYPE_UNUSED)
+		return;
+
 	devlink_port_unregister(&dp->devlink_port);
 
 	switch (dp->type) {
-	case DSA_PORT_TYPE_UNUSED:
-		break;
 	case DSA_PORT_TYPE_CPU:
 	case DSA_PORT_TYPE_DSA:
 		dsa_port_link_unregister_of(dp);
-- 
2.14.1

^ permalink raw reply related

* Proposal
From: Miss Zeliha Omer Faruk @ 2018-05-17 22:15 UTC (permalink / raw)





Hello

Greetings to you please i have a business proposal for you contact me
for more detailes asap thanks.

Best Regards,
Miss.Zeliha ömer faruk
Esentepe Mahallesi Büyükdere
Caddesi Kristal Kule Binasi
No:215
Sisli - Istanbul, Turkey

^ permalink raw reply

* Re: [PATCH v3 net-next 3/6] tcp: add SACK compression
From: Yuchung Cheng @ 2018-05-17 22:14 UTC (permalink / raw)
  To: Neal Cardwell
  Cc: Eric Dumazet, David Miller, Netdev,
	Toke Høiland-Jørgensen, Soheil Hassas Yeganeh,
	Eric Dumazet
In-Reply-To: <CADVnQykUpdC+2e94_x9v9iX6RC7ro=bkvH5Q7-p0pbtBhHyU=A@mail.gmail.com>

On Thu, May 17, 2018 at 2:57 PM, Neal Cardwell <ncardwell@google.com> wrote:
> On Thu, May 17, 2018 at 5:47 PM Eric Dumazet <edumazet@google.com> wrote:
>
>> When TCP receives an out-of-order packet, it immediately sends
>> a SACK packet, generating network load but also forcing the
>> receiver to send 1-MSS pathological packets, increasing its
>> RTX queue length/depth, and thus processing time.
>
>> Wifi networks suffer from this aggressive behavior, but generally
>> speaking, all these SACK packets add fuel to the fire when networks
>> are under congestion.
>
>> This patch adds a high resolution timer and tp->compressed_ack counter.
>
>> Instead of sending a SACK, we program this timer with a small delay,
>> based on RTT and capped to 1 ms :
>
>>          delay = min ( 5 % of RTT, 1 ms)
>
>> If subsequent SACKs need to be sent while the timer has not yet
>> expired, we simply increment tp->compressed_ack.
>
>> When timer expires, a SACK is sent with the latest information.
>> Whenever an ACK is sent (if data is sent, or if in-order
>> data is received) timer is canceled.
>
>> Note that tcp_sack_new_ofo_skb() is able to force a SACK to be sent
>> if the sack blocks need to be shuffled, even if the timer has not
>> expired.
>
>> A new SNMP counter is added in the following patch.
>
>> Two other patches add sysctls to allow changing the 1,000,000 and 44
>> values that this commit hard-coded.
>
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>> ---
>
> Very nice. I like the constants and the min(rcv_rtt, srtt).
>
> Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>

Great work. Hopefully this would save middle-boxes' from handling
TCP-ACK themselves.

>
> Thanks!
>
> neal

^ permalink raw reply


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