* [PATCH 05/16] sh: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Yoshinori Sato, Rich Felker,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
linux-sh, linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/sh/include/asm/cache.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
index 2408ac4873aa..07ddf31124a3 100644
--- a/arch/sh/include/asm/cache.h
+++ b/arch/sh/include/asm/cache.h
@@ -15,7 +15,7 @@
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(.data..read_mostly)
#ifndef __ASSEMBLY__
struct cache_info {
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 06/16] ia64: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Tony Luck, Fenghua Yu,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
linux-ia64, linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/ia64/include/asm/cache.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/ia64/include/asm/cache.h b/arch/ia64/include/asm/cache.h
index 4eb6f742d14f..7decf91ca11a 100644
--- a/arch/ia64/include/asm/cache.h
+++ b/arch/ia64/include/asm/cache.h
@@ -25,6 +25,6 @@
# define SMP_CACHE_BYTES (1 << 3)
#endif
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(.data..read_mostly)
#endif /* _ASM_IA64_CACHE_H */
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 07/16] arm: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Russell King,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Thomas Gleixner, Allison Randal, Kate Stewart, Enrico Weigelt,
Mauro Carvalho Chehab, Greg Kroah-Hartman, linux-arm-kernel,
linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/arm/include/asm/cache.h | 2 +-
arch/arm/include/asm/mach/arch.h | 4 ++--
arch/arm/include/asm/setup.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/cache.h b/arch/arm/include/asm/cache.h
index 1d65ed3a2755..cc06079600e0 100644
--- a/arch/arm/include/asm/cache.h
+++ b/arch/arm/include/asm/cache.h
@@ -24,6 +24,6 @@
#define ARCH_SLAB_MINALIGN 8
#endif
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(.data..read_mostly)
#endif
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index e7df5a822cab..2986f6b4862d 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -81,7 +81,7 @@ extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
#define MACHINE_START(_type,_name) \
static const struct machine_desc __mach_desc_##_type \
__used \
- __attribute__((__section__(".arch.info.init"))) = { \
+ __section(.arch.info.init) = { \
.nr = MACH_TYPE_##_type, \
.name = _name,
@@ -91,7 +91,7 @@ static const struct machine_desc __mach_desc_##_type \
#define DT_MACHINE_START(_name, _namestr) \
static const struct machine_desc __mach_desc_##_name \
__used \
- __attribute__((__section__(".arch.info.init"))) = { \
+ __section(.arch.info.init) = { \
.nr = ~0, \
.name = _namestr,
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index 67d20712cb48..00190f1f0574 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -14,7 +14,7 @@
#include <uapi/asm/setup.h>
-#define __tag __used __attribute__((__section__(".taglist.init")))
+#define __tag __used __section(.taglist.init)
#define __tagtable(tag, fn) \
static const struct tagtable __tagtable_##fn __tag = { tag, fn }
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 08/16] mips: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Ralf Baechle, Paul Burton,
James Hogan, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, linux-mips, linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/mips/include/asm/cache.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h
index 8b14c2706aa5..af2d943580ee 100644
--- a/arch/mips/include/asm/cache.h
+++ b/arch/mips/include/asm/cache.h
@@ -14,6 +14,6 @@
#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(.data..read_mostly)
#endif /* _ASM_CACHE_H */
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 09/16] sparc: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, David S. Miller,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
sparclinux, linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/sparc/include/asm/cache.h | 2 +-
arch/sparc/kernel/btext.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sparc/include/asm/cache.h b/arch/sparc/include/asm/cache.h
index dcfd58118c11..9a9effdd01e2 100644
--- a/arch/sparc/include/asm/cache.h
+++ b/arch/sparc/include/asm/cache.h
@@ -21,6 +21,6 @@
#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(.data..read_mostly)
#endif /* !(_SPARC_CACHE_H) */
diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c
index 5869773f3dc4..b2eff8f8f27b 100644
--- a/arch/sparc/kernel/btext.c
+++ b/arch/sparc/kernel/btext.c
@@ -24,7 +24,7 @@ static void draw_byte_32(unsigned char *bits, unsigned int *base, int rb);
static void draw_byte_16(unsigned char *bits, unsigned int *base, int rb);
static void draw_byte_8(unsigned char *bits, unsigned int *base, int rb);
-#define __force_data __attribute__((__section__(".data")))
+#define __force_data __section(.data)
static int g_loc_X __force_data;
static int g_loc_Y __force_data;
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 10/16] powerpc: prefer __section and __printf from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Geoff Levand,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Allison Randal, Thomas Gleixner, Greg Kroah-Hartman,
Christophe Leroy, Rob Herring, linuxppc-dev, linux-kernel, netdev,
bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/powerpc/boot/main.c | 3 +--
arch/powerpc/boot/ps3.c | 6 ++----
arch/powerpc/include/asm/cache.h | 2 +-
arch/powerpc/kernel/btext.c | 2 +-
4 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 102cc546444d..3ccc84e06fc4 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -150,8 +150,7 @@ static struct addr_range prep_initrd(struct addr_range vmlinux, void *chosen,
* edit the command line passed to vmlinux (by setting /chosen/bootargs).
* The buffer is put in it's own section so that tools may locate it easier.
*/
-static char cmdline[BOOT_COMMAND_LINE_SIZE]
- __attribute__((__section__("__builtin_cmdline")));
+static char cmdline[BOOT_COMMAND_LINE_SIZE] __section(__builtin_cmdline);
static void prep_cmdline(void *chosen)
{
diff --git a/arch/powerpc/boot/ps3.c b/arch/powerpc/boot/ps3.c
index c52552a681c5..70b2ed82d2de 100644
--- a/arch/powerpc/boot/ps3.c
+++ b/arch/powerpc/boot/ps3.c
@@ -24,8 +24,7 @@ extern int lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3,
#ifdef DEBUG
#define DBG(fmt...) printf(fmt)
#else
-static inline int __attribute__ ((format (printf, 1, 2))) DBG(
- const char *fmt, ...) {return 0;}
+static inline int __printf(1, 2) DBG(const char *fmt, ...) { return 0; }
#endif
BSS_STACK(4096);
@@ -35,8 +34,7 @@ BSS_STACK(4096);
* The buffer is put in it's own section so that tools may locate it easier.
*/
-static char cmdline[BOOT_COMMAND_LINE_SIZE]
- __attribute__((__section__("__builtin_cmdline")));
+static char cmdline[BOOT_COMMAND_LINE_SIZE] __section(__builtin_cmdline);
static void prep_cmdline(void *chosen)
{
diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
index 45e3137ccd71..9114495855eb 100644
--- a/arch/powerpc/include/asm/cache.h
+++ b/arch/powerpc/include/asm/cache.h
@@ -91,7 +91,7 @@ static inline u32 l1_cache_bytes(void)
isync
#else
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(.data..read_mostly)
#ifdef CONFIG_PPC_BOOK3S_32
extern long _get_L2CR(void);
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 6dfceaa820e4..f57712a55815 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -26,7 +26,7 @@
static void scrollscreen(void);
#endif
-#define __force_data __attribute__((__section__(".data")))
+#define __force_data __section(.data)
static int g_loc_X __force_data;
static int g_loc_Y __force_data;
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH net-next v2 1/3] net: phy: add __set_linkmode_max_speed
From: Heiner Kallweit @ 2019-08-12 21:50 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
In-Reply-To: <dca82a0e-e936-b60a-3a1c-9fdb1714d1d3@gmail.com>
We will need the functionality of __set_linkmode_max_speed also for
linkmode bitmaps other than phydev->supported. Therefore split it.
v2:
- remove unused parameter from __set_linkmode_max_speed
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy-core.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 9ae3abb2d..95f1e85d0 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -207,14 +207,14 @@ size_t phy_speeds(unsigned int *speeds, size_t size,
return count;
}
-static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
+static int __set_linkmode_max_speed(u32 max_speed, unsigned long *addr)
{
const struct phy_setting *p;
int i;
for (i = 0, p = settings; i < ARRAY_SIZE(settings); i++, p++) {
if (p->speed > max_speed)
- linkmode_clear_bit(p->bit, phydev->supported);
+ linkmode_clear_bit(p->bit, addr);
else
break;
}
@@ -222,6 +222,11 @@ static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
return 0;
}
+static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
+{
+ return __set_linkmode_max_speed(max_speed, phydev->supported);
+}
+
int phy_set_max_speed(struct phy_device *phydev, u32 max_speed)
{
int err;
--
2.22.0
^ permalink raw reply related
* [PATCH net-next v2 2/3] net: phy: add phy_speed_down_core and phy_resolve_min_speed
From: Heiner Kallweit @ 2019-08-12 21:51 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
In-Reply-To: <dca82a0e-e936-b60a-3a1c-9fdb1714d1d3@gmail.com>
phy_speed_down_core provides most of the functionality for
phy_speed_down. It makes use of new helper phy_resolve_min_speed that is
based on the sorting of the settings[] array. In certain cases it may be
helpful to be able to exclude legacy half duplex modes, therefore
prepare phy_resolve_min_speed() for it.
v2:
- rename __phy_speed_down to phy_speed_down_core
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy-core.c | 28 ++++++++++++++++++++++++++++
include/linux/phy.h | 1 +
2 files changed, 29 insertions(+)
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 95f1e85d0..369903d9b 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -315,6 +315,34 @@ void phy_resolve_aneg_linkmode(struct phy_device *phydev)
}
EXPORT_SYMBOL_GPL(phy_resolve_aneg_linkmode);
+static int phy_resolve_min_speed(struct phy_device *phydev, bool fdx_only)
+{
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(common);
+ int i = ARRAY_SIZE(settings);
+
+ linkmode_and(common, phydev->lp_advertising, phydev->advertising);
+
+ while (--i >= 0) {
+ if (test_bit(settings[i].bit, common)) {
+ if (fdx_only && settings[i].duplex != DUPLEX_FULL)
+ continue;
+ return settings[i].speed;
+ }
+ }
+
+ return SPEED_UNKNOWN;
+}
+
+int phy_speed_down_core(struct phy_device *phydev)
+{
+ int min_common_speed = phy_resolve_min_speed(phydev, true);
+
+ if (min_common_speed == SPEED_UNKNOWN)
+ return -EINVAL;
+
+ return __set_linkmode_max_speed(min_common_speed, phydev->advertising);
+}
+
static void mmd_phy_indirect(struct mii_bus *bus, int phy_addr, int devad,
u16 regnum)
{
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 781f4810c..62fdc7ff2 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -665,6 +665,7 @@ size_t phy_speeds(unsigned int *speeds, size_t size,
unsigned long *mask);
void of_set_phy_supported(struct phy_device *phydev);
void of_set_phy_eee_broken(struct phy_device *phydev);
+int phy_speed_down_core(struct phy_device *phydev);
/**
* phy_is_started - Convenience function to check whether PHY is started
--
2.22.0
^ permalink raw reply related
* [PATCH net-next v2 3/3] net: phy: let phy_speed_down/up support speeds >1Gbps
From: Heiner Kallweit @ 2019-08-12 21:52 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
In-Reply-To: <dca82a0e-e936-b60a-3a1c-9fdb1714d1d3@gmail.com>
So far phy_speed_down/up can be used up to 1Gbps only. Remove this
restriction by using new helper __phy_speed_down. New member adv_old
in struct phy_device is used by phy_speed_up to restore the advertised
modes before calling phy_speed_down. Don't simply advertise what is
supported because a user may have intentionally removed modes from
advertisement.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/phy.c | 60 ++++++++++++-------------------------------
include/linux/phy.h | 2 ++
2 files changed, 18 insertions(+), 44 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index ef7aa738e..f3adea9ef 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -608,38 +608,21 @@ static int phy_poll_aneg_done(struct phy_device *phydev)
*/
int phy_speed_down(struct phy_device *phydev, bool sync)
{
- __ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old);
- __ETHTOOL_DECLARE_LINK_MODE_MASK(adv);
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(adv_tmp);
int ret;
if (phydev->autoneg != AUTONEG_ENABLE)
return 0;
- linkmode_copy(adv_old, phydev->advertising);
- linkmode_copy(adv, phydev->lp_advertising);
- linkmode_and(adv, adv, phydev->supported);
-
- if (linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, adv) ||
- linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, adv)) {
- linkmode_clear_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT,
- phydev->advertising);
- linkmode_clear_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
- phydev->advertising);
- linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
- phydev->advertising);
- linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
- phydev->advertising);
- } else if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT,
- adv) ||
- linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
- adv)) {
- linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
- phydev->advertising);
- linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
- phydev->advertising);
- }
+ linkmode_copy(adv_tmp, phydev->advertising);
+
+ ret = phy_speed_down_core(phydev);
+ if (ret)
+ return ret;
- if (linkmode_equal(phydev->advertising, adv_old))
+ linkmode_copy(phydev->adv_old, adv_tmp);
+
+ if (linkmode_equal(phydev->advertising, adv_tmp))
return 0;
ret = phy_config_aneg(phydev);
@@ -658,30 +641,19 @@ EXPORT_SYMBOL_GPL(phy_speed_down);
*/
int phy_speed_up(struct phy_device *phydev)
{
- __ETHTOOL_DECLARE_LINK_MODE_MASK(all_speeds) = { 0, };
- __ETHTOOL_DECLARE_LINK_MODE_MASK(not_speeds);
- __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
- __ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old);
- __ETHTOOL_DECLARE_LINK_MODE_MASK(speeds);
-
- linkmode_copy(adv_old, phydev->advertising);
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(adv_tmp);
if (phydev->autoneg != AUTONEG_ENABLE)
return 0;
- linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, all_speeds);
- linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, all_speeds);
- linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, all_speeds);
- linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, all_speeds);
- linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, all_speeds);
- linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, all_speeds);
+ if (linkmode_empty(phydev->adv_old))
+ return 0;
- linkmode_andnot(not_speeds, adv_old, all_speeds);
- linkmode_copy(supported, phydev->supported);
- linkmode_and(speeds, supported, all_speeds);
- linkmode_or(phydev->advertising, not_speeds, speeds);
+ linkmode_copy(adv_tmp, phydev->advertising);
+ linkmode_copy(phydev->advertising, phydev->adv_old);
+ linkmode_zero(phydev->adv_old);
- if (linkmode_equal(phydev->advertising, adv_old))
+ if (linkmode_equal(phydev->advertising, adv_tmp))
return 0;
return phy_config_aneg(phydev);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 62fdc7ff2..5ac7d2137 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -403,6 +403,8 @@ struct phy_device {
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
+ /* used with phy_speed_down */
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old);
/* Energy efficient ethernet modes which should be prohibited */
u32 eee_broken_modes;
--
2.22.0
^ permalink raw reply related
* [PATCH 11/16] x86: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Armijn Hemel,
Greg Kroah-Hartman, Allison Randal, Juergen Gross,
Frederic Weisbecker, Brijesh Singh, Enrico Weigelt, Kate Stewart,
Hannes Reinecke, Sean Christopherson, Rafael J. Wysocki, Pu Wen,
linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/x86/include/asm/cache.h | 2 +-
arch/x86/include/asm/intel-mid.h | 2 +-
arch/x86/include/asm/iommu_table.h | 5 ++---
arch/x86/include/asm/irqflags.h | 2 +-
arch/x86/include/asm/mem_encrypt.h | 2 +-
arch/x86/kernel/cpu/cpu.h | 3 +--
6 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/arch/x86/include/asm/cache.h b/arch/x86/include/asm/cache.h
index abe08690a887..bb9f4bf4ec02 100644
--- a/arch/x86/include/asm/cache.h
+++ b/arch/x86/include/asm/cache.h
@@ -8,7 +8,7 @@
#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(.data..read_mostly)
#define INTERNODE_CACHE_SHIFT CONFIG_X86_INTERNODE_CACHE_SHIFT
#define INTERNODE_CACHE_BYTES (1 << INTERNODE_CACHE_SHIFT)
diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h
index 8e5af119dc2d..f51f04aefe1b 100644
--- a/arch/x86/include/asm/intel-mid.h
+++ b/arch/x86/include/asm/intel-mid.h
@@ -43,7 +43,7 @@ struct devs_id {
#define sfi_device(i) \
static const struct devs_id *const __intel_mid_sfi_##i##_dev __used \
- __attribute__((__section__(".x86_intel_mid_dev.init"))) = &i
+ __section(.x86_intel_mid_dev.init) = &i
/**
* struct mid_sd_board_info - template for SD device creation
diff --git a/arch/x86/include/asm/iommu_table.h b/arch/x86/include/asm/iommu_table.h
index 1fb3fd1a83c2..7d190710eb92 100644
--- a/arch/x86/include/asm/iommu_table.h
+++ b/arch/x86/include/asm/iommu_table.h
@@ -50,9 +50,8 @@ struct iommu_table_entry {
#define __IOMMU_INIT(_detect, _depend, _early_init, _late_init, _finish)\
static const struct iommu_table_entry \
- __iommu_entry_##_detect __used \
- __attribute__ ((unused, __section__(".iommu_table"), \
- aligned((sizeof(void *))))) \
+ __iommu_entry_##_detect __used __section(.iommu_table) \
+ __aligned((sizeof(void *))) \
= {_detect, _depend, _early_init, _late_init, \
_finish ? IOMMU_FINISH_IF_DETECTED : 0}
/*
diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 8a0e56e1dcc9..68db90bca813 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -9,7 +9,7 @@
#include <asm/nospec-branch.h>
/* Provide __cpuidle; we can't safely include <linux/cpu.h> */
-#define __cpuidle __attribute__((__section__(".cpuidle.text")))
+#define __cpuidle __section(.cpuidle.text)
/*
* Interrupt control:
diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h
index 0c196c47d621..db2cd3709148 100644
--- a/arch/x86/include/asm/mem_encrypt.h
+++ b/arch/x86/include/asm/mem_encrypt.h
@@ -50,7 +50,7 @@ void __init mem_encrypt_free_decrypted_mem(void);
bool sme_active(void);
bool sev_active(void);
-#define __bss_decrypted __attribute__((__section__(".bss..decrypted")))
+#define __bss_decrypted __section(.bss..decrypted)
#else /* !CONFIG_AMD_MEM_ENCRYPT */
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h
index c0e2407abdd6..7ff9dc41a603 100644
--- a/arch/x86/kernel/cpu/cpu.h
+++ b/arch/x86/kernel/cpu/cpu.h
@@ -38,8 +38,7 @@ struct _tlb_table {
#define cpu_dev_register(cpu_devX) \
static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \
- __attribute__((__section__(".x86_cpu_dev.init"))) = \
- &cpu_devX;
+ __section(.x86_cpu_dev.init) = &cpu_devX;
extern const struct cpu_dev *const __x86_cpu_dev_start[],
*const __x86_cpu_dev_end[];
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 13/16] include/asm-generic: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Arnd Bergmann, Naveen N. Rao,
Anil S Keshavamurthy, David S. Miller, Masami Hiramatsu,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
linux-arch, linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
include/asm-generic/error-injection.h | 2 +-
include/asm-generic/kprobes.h | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/asm-generic/error-injection.h b/include/asm-generic/error-injection.h
index 95a159a4137f..a593a50b33e3 100644
--- a/include/asm-generic/error-injection.h
+++ b/include/asm-generic/error-injection.h
@@ -23,7 +23,7 @@ struct error_injection_entry {
*/
#define ALLOW_ERROR_INJECTION(fname, _etype) \
static struct error_injection_entry __used \
- __attribute__((__section__("_error_injection_whitelist"))) \
+ __section(_error_injection_whitelist) \
_eil_addr_##fname = { \
.addr = (unsigned long)fname, \
.etype = EI_ETYPE_##_etype, \
diff --git a/include/asm-generic/kprobes.h b/include/asm-generic/kprobes.h
index 4a982089c95c..20d69719270f 100644
--- a/include/asm-generic/kprobes.h
+++ b/include/asm-generic/kprobes.h
@@ -9,12 +9,11 @@
* by using this macro.
*/
# define __NOKPROBE_SYMBOL(fname) \
-static unsigned long __used \
- __attribute__((__section__("_kprobe_blacklist"))) \
+static unsigned long __used __section(_kprobe_blacklist) \
_kbl_addr_##fname = (unsigned long)fname;
# define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname)
/* Use this to forbid a kprobes attach on very low level functions */
-# define __kprobes __attribute__((__section__(".kprobes.text")))
+# define __kprobes __section(.kprobes.text)
# define nokprobe_inline __always_inline
#else
# define NOKPROBE_SYMBOL(fname)
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 12/16] arm64: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Catalin Marinas, Will Deacon,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Andrey Konovalov, Greg Kroah-Hartman, Enrico Weigelt,
Suzuki K Poulose, Thomas Gleixner, Masayoshi Mizuma,
Shaokun Zhang, Alexios Zavras, Allison Randal, linux-arm-kernel,
linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
GCC unescapes escaped string section names while Clang does not. Because
__section uses the `#` stringification operator for the section name, it
doesn't need to be escaped.
This antipattern was found with:
$ grep -e __section\(\" -e __section__\(\" -r
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/arm64/include/asm/cache.h | 2 +-
arch/arm64/kernel/smp_spin_table.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index 64eeaa41e7ca..43da6dd29592 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -78,7 +78,7 @@ static inline u32 cache_type_cwg(void)
return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;
}
-#define __read_mostly __attribute__((__section__(".data..read_mostly")))
+#define __read_mostly __section(.data..read_mostly)
static inline int cache_line_size_of_cpu(void)
{
diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index 76c2739ba8a4..c8a3fee00c11 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -19,7 +19,7 @@
#include <asm/smp_plat.h>
extern void secondary_holding_pen(void);
-volatile unsigned long __section(".mmuoff.data.read")
+volatile unsigned long __section(.mmuoff.data.read)
secondary_holding_pen_release = INVALID_HWID;
static phys_addr_t cpu_release_addr[NR_CPUS];
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 15/16] include/linux/compiler.h: remove unused KENTRY macro
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Luc Van Oostenryck,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
linux-sparse, linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
This macro is not used throughout the kernel. Delete it rather than
update the __section to be a fully spelled out
__attribute__((__section__())) to avoid
https://bugs.llvm.org/show_bug.cgi?id=42950.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
include/linux/compiler.h | 23 -----------------------
1 file changed, 23 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 5e88e7e33abe..f01c1e527f85 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -136,29 +136,6 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
} while (0)
#endif
-/*
- * KENTRY - kernel entry point
- * This can be used to annotate symbols (functions or data) that are used
- * without their linker symbol being referenced explicitly. For example,
- * interrupt vector handlers, or functions in the kernel image that are found
- * programatically.
- *
- * Not required for symbols exported with EXPORT_SYMBOL, or initcalls. Those
- * are handled in their own way (with KEEP() in linker scripts).
- *
- * KENTRY can be avoided if the symbols in question are marked as KEEP() in the
- * linker script. For example an architecture could KEEP() its entire
- * boot/exception vector code rather than annotate each function and data.
- */
-#ifndef KENTRY
-# define KENTRY(sym) \
- extern typeof(sym) sym; \
- static const unsigned long __kentry_##sym \
- __used \
- __section("___kentry" "+" #sym ) \
- = (unsigned long)&sym;
-#endif
-
#ifndef RELOC_HIDE
# define RELOC_HIDE(ptr, off) \
({ unsigned long __ptr; \
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 16/16] compiler_attributes.h: add note about __section
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, linux-kernel, netdev,
bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
The antipattern described can be found with:
$ grep -e __section\(\" -r -e __section__\(\"
Link: https://bugs.llvm.org/show_bug.cgi?id=42950
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
include/linux/compiler_attributes.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h
index 6b318efd8a74..f8c008d7f616 100644
--- a/include/linux/compiler_attributes.h
+++ b/include/linux/compiler_attributes.h
@@ -225,6 +225,16 @@
#define __pure __attribute__((__pure__))
/*
+ * Note: Since this macro makes use of the "stringification operator" `#`, a
+ * quoted string literal should not be passed to it. eg.
+ * prefer:
+ * __section(.foo)
+ * to:
+ * __section(".foo")
+ * unless the section name is dynamically built up, in which case the
+ * verbose __attribute__((__section__(".foo" x))) should be preferred.
+ * See also: https://bugs.llvm.org/show_bug.cgi?id=42950
+ *
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-section-function-attribute
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-section-variable-attribute
* clang: https://clang.llvm.org/docs/AttributeReference.html#section-declspec-allocate
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* [PATCH 00/16] treewide: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
GCC unescapes escaped string section names while Clang does not. Because
__section uses the `#` stringification operator for the section name, it
doesn't need to be escaped.
This fixes an Oops observed in distro's that use systemd and not
net.core.bpf_jit_enable=1, when their kernels are compiled with Clang.
Instead, we should:
1. Prefer __section(.section_name_no_quotes).
2. Only use __attribute__((__section(".section"))) when creating the
section name via C preprocessor (see the definition of __define_initcall
in arch/um/include/shared/init.h).
This antipattern was found with:
$ grep -e __section\(\" -e __section__\(\" -r
See the discussions in:
https://bugs.llvm.org/show_bug.cgi?id=42950
https://marc.info/?l=linux-netdev&m=156412960619946&w=2
Nick Desaulniers (16):
s390/boot: fix section name escaping
arc: prefer __section from compiler_attributes.h
parisc: prefer __section from compiler_attributes.h
um: prefer __section from compiler_attributes.h
sh: prefer __section from compiler_attributes.h
ia64: prefer __section from compiler_attributes.h
arm: prefer __section from compiler_attributes.h
mips: prefer __section from compiler_attributes.h
sparc: prefer __section from compiler_attributes.h
powerpc: prefer __section and __printf from compiler_attributes.h
x86: prefer __section from compiler_attributes.h
arm64: prefer __section from compiler_attributes.h
include/asm-generic: prefer __section from compiler_attributes.h
include/linux: prefer __section from compiler_attributes.h
include/linux/compiler.h: remove unused KENTRY macro
compiler_attributes.h: add note about __section
arch/arc/include/asm/linkage.h | 8 +++----
arch/arc/include/asm/mach_desc.h | 3 +--
arch/arm/include/asm/cache.h | 2 +-
arch/arm/include/asm/mach/arch.h | 4 ++--
arch/arm/include/asm/setup.h | 2 +-
arch/arm64/include/asm/cache.h | 2 +-
arch/arm64/kernel/smp_spin_table.c | 2 +-
arch/ia64/include/asm/cache.h | 2 +-
arch/mips/include/asm/cache.h | 2 +-
arch/parisc/include/asm/cache.h | 2 +-
arch/parisc/include/asm/ldcw.h | 2 +-
arch/powerpc/boot/main.c | 3 +--
arch/powerpc/boot/ps3.c | 6 ++----
arch/powerpc/include/asm/cache.h | 2 +-
arch/powerpc/kernel/btext.c | 2 +-
arch/s390/boot/startup.c | 2 +-
arch/sh/include/asm/cache.h | 2 +-
arch/sparc/include/asm/cache.h | 2 +-
arch/sparc/kernel/btext.c | 2 +-
arch/um/kernel/um_arch.c | 6 +++---
arch/x86/include/asm/cache.h | 2 +-
arch/x86/include/asm/intel-mid.h | 2 +-
arch/x86/include/asm/iommu_table.h | 5 ++---
arch/x86/include/asm/irqflags.h | 2 +-
arch/x86/include/asm/mem_encrypt.h | 2 +-
arch/x86/kernel/cpu/cpu.h | 3 +--
include/asm-generic/error-injection.h | 2 +-
include/asm-generic/kprobes.h | 5 ++---
include/linux/cache.h | 6 +++---
include/linux/compiler.h | 31 ++++-----------------------
include/linux/compiler_attributes.h | 10 +++++++++
include/linux/cpu.h | 2 +-
include/linux/export.h | 2 +-
include/linux/init_task.h | 4 ++--
include/linux/interrupt.h | 5 ++---
include/linux/sched/debug.h | 2 +-
include/linux/srcutree.h | 2 +-
37 files changed, 62 insertions(+), 83 deletions(-)
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply
* [PATCH 14/16] include/linux: prefer __section from compiler_attributes.h
From: Nick Desaulniers @ 2019-08-12 21:50 UTC (permalink / raw)
To: akpm
Cc: sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, Nick Desaulniers, Luc Van Oostenryck,
Lai Jiangshan, Paul E. McKenney, Josh Triplett, Steven Rostedt,
Mathieu Desnoyers, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, Thomas Gleixner, Ingo Molnar,
Peter Zijlstra (Intel), Nicholas Piggin, Jiri Kosina, Will Deacon,
Ard Biesheuvel, Michael Ellerman, Masahiro Yamada,
Hans Liljestrand, Elena Reshetova, David Windsor, Marc Zyngier,
Ming Lei, Dou Liyang, Julien Thierry, Mauro Carvalho Chehab,
Jens Axboe, linux-kernel, linux-sparse, rcu, netdev, bpf
In-Reply-To: <20190812215052.71840-1-ndesaulniers@google.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/619
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
include/linux/cache.h | 6 +++---
include/linux/compiler.h | 8 ++++----
include/linux/cpu.h | 2 +-
include/linux/export.h | 2 +-
include/linux/init_task.h | 4 ++--
include/linux/interrupt.h | 5 ++---
include/linux/sched/debug.h | 2 +-
include/linux/srcutree.h | 2 +-
8 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 750621e41d1c..3f4df9eef1e1 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -28,7 +28,7 @@
* but may get written to during init, so can't live in .rodata (via "const").
*/
#ifndef __ro_after_init
-#define __ro_after_init __attribute__((__section__(".data..ro_after_init")))
+#define __ro_after_init __section(.data..ro_after_init)
#endif
#ifndef ____cacheline_aligned
@@ -45,8 +45,8 @@
#ifndef __cacheline_aligned
#define __cacheline_aligned \
- __attribute__((__aligned__(SMP_CACHE_BYTES), \
- __section__(".data..cacheline_aligned")))
+ __aligned(SMP_CACHE_BYTES) \
+ __section(.data..cacheline_aligned)
#endif /* __cacheline_aligned */
#ifndef __cacheline_aligned_in_smp
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index f0fd5636fddb..5e88e7e33abe 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -24,7 +24,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
long ______r; \
static struct ftrace_likely_data \
__aligned(4) \
- __section("_ftrace_annotated_branch") \
+ __section(_ftrace_annotated_branch) \
______f = { \
.data.func = __func__, \
.data.file = __FILE__, \
@@ -60,7 +60,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#define __trace_if_value(cond) ({ \
static struct ftrace_branch_data \
__aligned(4) \
- __section("_ftrace_branch") \
+ __section(_ftrace_branch) \
__if_trace = { \
.func = __func__, \
.file = __FILE__, \
@@ -118,7 +118,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
".popsection\n\t"
/* Annotate a C jump table to allow objtool to follow the code flow */
-#define __annotate_jump_table __section(".rodata..c_jump_table")
+#define __annotate_jump_table __section(.rodata..c_jump_table)
#else
#define annotate_reachable()
@@ -298,7 +298,7 @@ unsigned long read_word_at_a_time(const void *addr)
* visible to the compiler.
*/
#define __ADDRESSABLE(sym) \
- static void * __section(".discard.addressable") __used \
+ static void * __section(.discard.addressable) __used \
__PASTE(__addressable_##sym, __LINE__) = (void *)&sym;
/**
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index fcb1386bb0d4..186bbd79d6ce 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -166,7 +166,7 @@ void cpu_startup_entry(enum cpuhp_state state);
void cpu_idle_poll_ctrl(bool enable);
/* Attach to any functions which should be considered cpuidle. */
-#define __cpuidle __attribute__((__section__(".cpuidle.text")))
+#define __cpuidle __section(.cpuidle.text)
bool cpu_in_idle(unsigned long pc);
diff --git a/include/linux/export.h b/include/linux/export.h
index fd8711ed9ac4..808c1a0c2ef9 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -104,7 +104,7 @@ struct kernel_symbol {
* discarded in the final link stage.
*/
#define __ksym_marker(sym) \
- static int __ksym_marker_##sym[0] __section(".discard.ksym") __used
+ static int __ksym_marker_##sym[0] __section(.discard.ksym) __used
#define __EXPORT_SYMBOL(sym, sec) \
__ksym_marker(sym); \
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 6049baa5b8bc..50139505da34 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -51,12 +51,12 @@ extern struct cred init_cred;
/* Attach to the init_task data structure for proper alignment */
#ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK
-#define __init_task_data __attribute__((__section__(".data..init_task")))
+#define __init_task_data __section(.data..init_task)
#else
#define __init_task_data /**/
#endif
/* Attach to the thread_info data structure for proper alignment */
-#define __init_thread_info __attribute__((__section__(".data..init_thread_info")))
+#define __init_thread_info __section(.data..init_thread_info)
#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5b8328a99b2a..29debfe4dd0f 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -741,8 +741,7 @@ extern int arch_early_irq_init(void);
/*
* We want to know which function is an entrypoint of a hardirq or a softirq.
*/
-#define __irq_entry __attribute__((__section__(".irqentry.text")))
-#define __softirq_entry \
- __attribute__((__section__(".softirqentry.text")))
+#define __irq_entry __section(.irqentry.text)
+#define __softirq_entry __section(.softirqentry.text)
#endif
diff --git a/include/linux/sched/debug.h b/include/linux/sched/debug.h
index 95fb9e025247..e17b66221fdd 100644
--- a/include/linux/sched/debug.h
+++ b/include/linux/sched/debug.h
@@ -42,7 +42,7 @@ extern void proc_sched_set_task(struct task_struct *p);
#endif
/* Attach to any functions which should be ignored in wchan output. */
-#define __sched __attribute__((__section__(".sched.text")))
+#define __sched __section(.sched.text)
/* Linker adds these: start and end of __sched functions */
extern char __sched_text_start[], __sched_text_end[];
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
index 9cfcc8a756ae..9de652f4e1bd 100644
--- a/include/linux/srcutree.h
+++ b/include/linux/srcutree.h
@@ -124,7 +124,7 @@ struct srcu_struct {
# define __DEFINE_SRCU(name, is_static) \
is_static struct srcu_struct name; \
struct srcu_struct * const __srcu_struct_##name \
- __section("___srcu_struct_ptrs") = &name
+ __section(___srcu_struct_ptrs) = &name
#else
# define __DEFINE_SRCU(name, is_static) \
static DEFINE_PER_CPU(struct srcu_data, name##_srcu_data); \
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related
* Re: WARNING in aa_sock_msg_perm
From: David Howells @ 2019-08-12 22:00 UTC (permalink / raw)
To: Tetsuo Handa
Cc: dhowells, syzbot, linux-kernel, netdev, syzkaller-bugs, linux-afs
In-Reply-To: <7e84e076-7096-028f-b49d-29160aea0831@I-love.SAKURA.ne.jp>
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> wrote:
> This is not AppArmor's bug. LSM modules expect that "struct socket" is not
> NULL. For some reason, peer->local->socket became NULL. Thus, suspecting
> rxrpc's bug.
>
> > rxrpc_send_keepalive+0x1ff/0x940 net/rxrpc/output.c:656
I agree. There's a further refcounting bug in the local object handling, but
it's proving annoyingly difficult to reliably reproduce.
David
^ permalink raw reply
* Re: [PATCH 09/16] sparc: prefer __section from compiler_attributes.h
From: David Miller @ 2019-08-12 22:13 UTC (permalink / raw)
To: ndesaulniers
Cc: akpm, sedat.dilek, jpoimboe, yhs, miguel.ojeda.sandonis,
clang-built-linux, ast, daniel, kafai, songliubraving, sparclinux,
linux-kernel, netdev, bpf
In-Reply-To: <20190812215052.71840-9-ndesaulniers@google.com>
From: Nick Desaulniers <ndesaulniers@google.com>
Date: Mon, 12 Aug 2019 14:50:42 -0700
> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [net-next 01/15] ice: Implement ethtool ops for channels
From: Jakub Kicinski @ 2019-08-12 22:24 UTC (permalink / raw)
To: Nguyen, Anthony L
Cc: Kirsher, Jeffrey T, nhorman@redhat.com, davem@davemloft.net,
netdev@vger.kernel.org, Bowers, AndrewX, sassmann@redhat.com,
Tieman, Henry W
In-Reply-To: <8a72e5d0ee26743dc5a896a426a55e6e9660f4d2.camel@intel.com>
On Mon, 12 Aug 2019 15:07:09 +0000, Nguyen, Anthony L wrote:
> On Fri, 2019-08-09 at 14:15 -0700, Jakub Kicinski wrote:
> > On Fri, 9 Aug 2019 11:31:25 -0700, Jeff Kirsher wrote:
> > > From: Henry Tieman <henry.w.tieman@intel.com>
> > >
> > > Add code to query and set the number of queues on the primary
> > > VSI for a PF. This is accessed from the 'ethtool -l' and 'ethtool
> > > -L'
> > > commands, respectively.
> > >
> > > Signed-off-by: Henry Tieman <henry.w.tieman@intel.com>
> > > Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> > > Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> > > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> >
> > If you're using the same IRQ vector for RX and TX queue the channel
> > counts as combined. Looks like you are counting RX and TX separately
> > here. That's incorrect.
>
> Hi Jakub,
>
> The ice driver can support asymmetric queues. We report these
> seperately, as opposed to combined, so that the user can specify a
> different number of Rx and Tx queues.
If you have 20 IRQ vectors, 10 TX queues and 20 RX queues, the first 10
RX queues share a IRQ vector with TX queues the ethool API counts them
as 10 combined and 10 rx-only.
10 tx-only and 20 rx-only would require 30 IRQ vectors.
^ permalink raw reply
* Re: BUG: corrupted list in rxrpc_local_processor
From: syzbot @ 2019-08-12 22:32 UTC (permalink / raw)
To: arvid.brodin, davem, dhowells, dirk.vandermerwe, edumazet,
jakub.kicinski, jiri, john.hurley, linux-afs, linux-kernel,
netdev, oss-drivers, syzkaller-bugs
In-Reply-To: <000000000000492086058fad2979@google.com>
syzbot has bisected this bug to:
commit 427545b3046326cd7b4dbbd7869f08737df2ad2b
Author: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Tue Jul 9 02:53:12 2019 +0000
nfp: tls: count TSO segments separately for the TLS offload
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=11d04eee600000
start commit: 125b7e09 net: tc35815: Explicitly check NET_IP_ALIGN is no..
git tree: net
final crash: https://syzkaller.appspot.com/x/report.txt?x=13d04eee600000
console output: https://syzkaller.appspot.com/x/log.txt?x=15d04eee600000
kernel config: https://syzkaller.appspot.com/x/.config?x=a4c9e9f08e9e8960
dashboard link: https://syzkaller.appspot.com/bug?extid=193e29e9387ea5837f1d
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=159d4eba600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ba194a600000
Reported-by: syzbot+193e29e9387ea5837f1d@syzkaller.appspotmail.com
Fixes: 427545b30463 ("nfp: tls: count TSO segments separately for the TLS
offload")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply
* Re: KASAN: use-after-free Read in rxrpc_queue_local
From: David Howells @ 2019-08-12 22:38 UTC (permalink / raw)
To: syzbot; +Cc: dhowells, davem, linux-afs, linux-kernel, netdev, syzkaller-bugs
In-Reply-To: <0000000000007593f4058fea60d8@google.com>
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git 03a62469fffcbd535d85e42ef25ba098262e9d72
^ permalink raw reply
* Re: BUG: corrupted list in rxrpc_local_processor
From: Jakub Kicinski @ 2019-08-12 22:40 UTC (permalink / raw)
To: syzbot
Cc: arvid.brodin, davem, dhowells, dirk.vandermerwe, edumazet, jiri,
john.hurley, linux-afs, linux-kernel, netdev, oss-drivers,
syzkaller-bugs
In-Reply-To: <000000000000ac9048058ff3176e@google.com>
On Mon, 12 Aug 2019 15:32:00 -0700, syzbot wrote:
> syzbot has bisected this bug to:
>
> commit 427545b3046326cd7b4dbbd7869f08737df2ad2b
> Author: Jakub Kicinski <jakub.kicinski@netronome.com>
> Date: Tue Jul 9 02:53:12 2019 +0000
>
> nfp: tls: count TSO segments separately for the TLS offload
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=11d04eee600000
> start commit: 125b7e09 net: tc35815: Explicitly check NET_IP_ALIGN is no..
> git tree: net
> final crash: https://syzkaller.appspot.com/x/report.txt?x=13d04eee600000
> console output: https://syzkaller.appspot.com/x/log.txt?x=15d04eee600000
> kernel config: https://syzkaller.appspot.com/x/.config?x=a4c9e9f08e9e8960
> dashboard link: https://syzkaller.appspot.com/bug?extid=193e29e9387ea5837f1d
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=159d4eba600000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ba194a600000
>
> Reported-by: syzbot+193e29e9387ea5837f1d@syzkaller.appspotmail.com
> Fixes: 427545b30463 ("nfp: tls: count TSO segments separately for the TLS
> offload")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Is there a way perhaps to tell syzbot to discard clearly bogus
bisection results?
^ permalink raw reply
* Re: BUG: corrupted list in rxrpc_local_processor
From: David Howells @ 2019-08-12 22:41 UTC (permalink / raw)
To: syzbot; +Cc: dhowells, davem, linux-afs, linux-kernel, netdev, syzkaller-bugs
In-Reply-To: <000000000000492086058fad2979@google.com>
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git 03a62469fffcbd535d85e42ef25ba098262e9d72
^ permalink raw reply
* [PATCH net] ipv6: Fix return value of ipv6_mc_may_pull() for malformed packets
From: Stefano Brivio @ 2019-08-12 22:46 UTC (permalink / raw)
To: David Miller
Cc: Guillaume Nault, Hangbin Liu, Eric Dumazet, Linus Lüssing,
netdev
Commit ba5ea614622d ("bridge: simplify ip_mc_check_igmp() and
ipv6_mc_check_mld() calls") replaces direct calls to pskb_may_pull()
in br_ipv6_multicast_mld2_report() with calls to ipv6_mc_may_pull(),
that returns -EINVAL on buffers too short to be valid IPv6 packets,
while maintaining the previous handling of the return code.
This leads to the direct opposite of the intended effect: if the
packet is malformed, -EINVAL evaluates as true, and we'll happily
proceed with the processing.
Return 0 if the packet is too short, in the same way as this was
fixed for IPv4 by commit 083b78a9ed64 ("ip: fix ip_mc_may_pull()
return value").
I don't have a reproducer for this, unlike the one referred to by
the IPv4 commit, but this is clearly broken.
Fixes: ba5ea614622d ("bridge: simplify ip_mc_check_igmp() and ipv6_mc_check_mld() calls")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
include/net/addrconf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index becdad576859..3f62b347b04a 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -206,7 +206,7 @@ static inline int ipv6_mc_may_pull(struct sk_buff *skb,
unsigned int len)
{
if (skb_transport_offset(skb) + ipv6_transport_len(skb) < len)
- return -EINVAL;
+ return 0;
return pskb_may_pull(skb, len);
}
--
2.20.1
^ permalink raw reply related
* Re: [PATCH net] ipv4/route: do not check saddr dev if iif is LOOPBACK_IFINDEX
From: Stefano Brivio @ 2019-08-12 22:58 UTC (permalink / raw)
To: David Miller; +Cc: dsahern, liuhangbin, netdev, mleitner
In-Reply-To: <20190811.204918.777837587917672157.davem@davemloft.net>
On Sun, 11 Aug 2019 20:49:18 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: David Ahern <dsahern@gmail.com>
> Date: Thu, 1 Aug 2019 22:16:00 -0600
>
> > On 8/1/19 10:13 PM, Hangbin Liu wrote:
> >> On Thu, Aug 01, 2019 at 01:51:25PM -0600, David Ahern wrote:
> >>> On 8/1/19 2:29 AM, Hangbin Liu wrote:
> >>>> Jianlin reported a bug that for IPv4, ip route get from src_addr would fail
> >>>> if src_addr is not an address on local system.
> >>>>
> >>>> \# ip route get 1.1.1.1 from 2.2.2.2
> >>>> RTNETLINK answers: Invalid argument
> >>>
> >>> so this is a forwarding lookup in which case iif should be set. Based on
> >>
> >> with out setting iif in userspace, the kernel set iif to lo by default.
> >
> > right, it presumes locally generated traffic.
> >>
> >>> the above 'route get' inet_rtm_getroute is doing a lookup as if it is
> >>> locally generated traffic.
> >>
> >> yeah... but what about the IPv6 part. That cause a different behavior in
> >> userspace.
> >
> > just one of many, many annoying differences between v4 and v6. We could
> > try to catalog it.
>
> I think we just have to accept this difference because this change would
> change behavior for all route lookups, not just those done by ip route get.
How so, actually? I don't see how that would happen. On the forwarding
path, 'iif' is set (not to loopback interface), so that's not affected.
Is there any other route lookup possibility I'm missing?
--
Stefano
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox