* Re: [PATCH 0/7] libbpf: Fix cast away const qualifiers in btf.h
From: Jiri Olsa @ 2019-09-07 6:54 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann,
netdev@vger.kernel.org, bpf@vger.kernel.org, Yonghong Song,
Martin Lau
In-Reply-To: <62e760de-e746-c512-350a-c2188a2bb3ed@fb.com>
On Fri, Sep 06, 2019 at 09:09:17AM +0000, Andrii Nakryiko wrote:
> On 9/6/19 8:31 AM, Jiri Olsa wrote:
> > hi,
> > when including btf.h in bpftrace, I'm getting -Wcast-qual warnings like:
> >
> > bpf/btf.h: In function ‘btf_var_secinfo* btf_var_secinfos(const btf_type*)’:
> > bpf/btf.h:302:41: warning: cast from type ‘const btf_type*’ to type
> > ‘btf_var_secinfo*’ casts away qualifiers [-Wcast-qual]
> > 302 | return (struct btf_var_secinfo *)(t + 1);
> > | ^
> >
> > I changed the btf.h header to comply with -Wcast-qual checks
> > and used const cast away casting in libbpf objects, where it's
>
> Hey Jiri,
>
> We made all those helper funcs return non-const structs intentionally to
> improve their usability and avoid all those casts that you added back.
>
> Also, those helpers are now part of public API, so we can't just change
> them to const, as it can break existing users easily.
>
> If there is a need to run with -Wcast-qual, we should probably disable
> those checks where appropriate in libbpf code.
>
> So this will be a NACK from me, sorry.
ok, I'll disable disable it in bpftrace code then
thanks,
jirka
>
> > all related to deduplication code, so I believe loosing const
> > is fine there.
> >
> > thanks,
> > jirka
> >
> >
> > ---
> > Jiri Olsa (7):
> > libbpf: Use const cast for btf_int_* functions
> > libbpf: Return const btf_array from btf_array inline function
> > libbpf: Return const btf_enum from btf_enum inline function
> > libbpf: Return const btf_member from btf_members inline function
> > libbpf: Return const btf_param from btf_params inline function
> > libbpf: Return const btf_var from btf_var inline function
> > libbpf: Return const struct btf_var_secinfo from btf_var_secinfos inline function
> >
> > tools/lib/bpf/btf.c | 21 +++++++++++----------
> > tools/lib/bpf/btf.h | 30 +++++++++++++++---------------
> > tools/lib/bpf/libbpf.c | 2 +-
> > 3 files changed, 27 insertions(+), 26 deletions(-)
> >
>
^ permalink raw reply
* Re: pull-request: bpf 2019-09-06
From: David Miller @ 2019-09-07 7:53 UTC (permalink / raw)
To: ast; +Cc: daniel, netdev, bpf, kernel-team
In-Reply-To: <20190906222032.1007163-1-ast@kernel.org>
From: Alexei Starovoitov <ast@kernel.org>
Date: Fri, 6 Sep 2019 15:20:32 -0700
> The following pull-request contains BPF updates for your *net* tree.
>
> The main changes are:
>
> 1) verifier precision tracking fix, from Alexei.
>
> Please consider pulling these changes from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git
Pulled, thanks!
^ permalink raw reply
* pull-request: wireless-drivers-next 2019-09-07
From: Kalle Valo @ 2019-09-07 8:01 UTC (permalink / raw)
To: David Miller; +Cc: linux-wireless, netdev, linux-kernel
Hi Dave,
here's a pull request to net-next for v5.4, more info below. Please let
me know if there are any problems.
Kalle
The following changes since commit 67538eb5c00f08d7fe27f1bb703098b17302bdc0:
Merge branch 'mvpp2-per-cpu-buffers' (2019-09-02 12:07:46 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git tags/wireless-drivers-next-for-davem-2019-09-07
for you to fetch changes up to 67e974c3ae21c8ced474eae3ce9261a6f827e95c:
Merge tag 'iwlwifi-next-for-kalle-2019-09-06' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next (2019-09-07 10:21:07 +0300)
----------------------------------------------------------------
wireless-drivers-next patches for 5.4
Second set of patches for 5.4. Lots of changes for iwlwifi and mt76,
but also smaller changes to other drivers.
Major changes:
iwlwifi
* remove broken and unused runtime power management mode for PCIe
devices, removes IWLWIFI_PCIE_RTPM Kconfig option as well
* support new ACPI value for per-platform antenna gain
* support for single antenna diversity
* support for new WoWLAN FW API
brcmfmac
* add reset debugfs file for testing firmware restart
mt76
* DFS pattern detector for mt7615 (DFS channels not enabled yet)
* Channel Switch Announcement (CSA) support for mt7615
* new device support for mt76x0
* support for more ciphers in mt7615
* smart carrier sense on mt7615
* survey support on mt7615
* multiple interfaces on mt76x02u
rtw88
* enable MSI interrupt
----------------------------------------------------------------
Alex Malamud (2):
iwlwifi: LTR updates
iwlwifi: Set w-pointer upon resume according to SN
Andy Shevchenko (3):
hostap: use %*ph to print small buffer
brcmfmac: use %*ph to print small buffer
zd1211rw: use %*ph to print small buffer
Ayala Beker (2):
iwlwifi: scan: add support for new scan request command version
iwlwifi: scan: don't pass large argument by value
Beker Ayala (1):
iwlwifi: mvm: fix scan config command size
Christoph Hellwig (1):
iwlwifi: stop passing bogus gfp flags arguments to dma_alloc_coherent
Colin Ian King (4):
rtw88: remove redundant assignment to pointer debugfs_topdir
brcmfmac: remove redundant assignment to pointer hash
ipw2x00: fix spelling mistake "initializationg" -> "initialization"
bcma: fix incorrect update of BCMA_CORE_PCI_MDIO_DATA
Dan Carpenter (1):
rtw88: Fix an error message
Emmanuel Grumbach (20):
iwlwifi: mvm: remove redundant condition in iwl_mvm_set_hw_rfkill_state
iwlwifi: mvm: start to remove the code for d0i3
iwlwifi: remove all the d0i3 references
iwlwifi: mvm: remove the tx defer for d0i3
iwlwifi: mvm: remove the d0i3 entry/exit flow
iwlwifi: mvm: iwl_mvm_wowlan_config_key_params is for wowlan only
iwlwifi: mvm: remove d0i3_ap_sta_id
iwlwifi: mvm: remove iwl_mvm_update_d0i3_power_mode
iwlwifi: mvm: remove last leftovers of d0i3
iwlwifi: remove CMD_HIGH_PRIO
iwlwifi: trans: remove suspending flag
iwlwifi: remove the code under IWLWIFI_PCIE_RTPM
iwlwifi: remove runtime_pm_mode
iwlwifi: remove the opmode's d0i3 handlers
iwlwifi: pcie: remove the refs / unrefs from the transport
iwlwifi: pcie: remove some more d0i3 code from the transport
iwlwifi: remove the d0i3 related module parameters
iwlwifi: remove pm_runtime completely
iwlwifi: mvm: simplify the channel switch flow for newer firmware
iwlwifi: mvm: don't log un-decrypted frames
Felix Fietkau (16):
mt76: round up length on mt76_wr_copy
mt76: mt7615: clean up FWDL TXQ during/after firmware upload
mt76: mt7603: enable hardware rate up/down selection
mt76: mt7615: move mt7615_mcu_set_rates to mac.c
mt76: mt7615: reset rate index/counters on rate table update
mt76: mt7615: sync with mt7603 rate control changes
mt76: mt7615: fix using VHT STBC rates
mt76: mt7615: fix PS buffering of action frames
mt76: mt7615: fix invalid fallback rates
mt76: mt7603: fix invalid fallback rates
mt76: mt7615: add missing register initialization
mt76: mt7615: apply calibration-free data from OTP
mt76: dma: reset q->rx_head on rx reset
mt76: stop rx aggregation on station removal
mt76: do not send BAR frame on tx aggregation flush stop
mt76: remove offchannel check in tx scheduling
Gil Adam (1):
iwlwifi: support per-platform antenna gain
Guenter Roeck (1):
rtw88: drop unused rtw_coex_coex_dm_reset()
Gustavo A. R. Silva (1):
zd1211rw: zd_usb: Use struct_size() helper
Haim Dreyfuss (4):
iwlwifi: remove unused regdb_ptrs allocation
iwlwifi: add support for suspend-resume flow for new device generation
iwlwifi: add sta_id to WOWLAN_CONFIG_CMD
iwlwifi: mvm: add support for single antenna diversity
Hariprasad Kelam (1):
iwlwifi: fix warning iwl-trans.h is included more than once
Ilan Peer (1):
iwlwifi: mvm: Block 26-tone RU OFDMA transmissions
Ilia Lin (1):
iwlwifi: Send DQA enable command only if TVL is on
Jia-Ju Bai (1):
brcm80211: Avoid possible null-pointer dereferences in wlc_phy_radio_init_2056()
Jian-Hong Pan (1):
rtw88: pci: Move a mass of jobs in hw IRQ to soft IRQ
Johannes Berg (5):
iwlwifi: mvm: remove unnecessary forward declarations
iwlwifi: mvm: use FW thermal monitoring regardless of CONFIG_THERMAL
iwlwifi: api: fix FTM struct documentation
iwlwifi: mvm: drop BA sessions on too many old-SN frames
iwlwifi: mvm: handle BAR_FRAME_RELEASE (0xc2) notification
Kalle Valo (2):
Merge tag 'mt76-for-kvalo-2019-09-05' of https://github.com/nbd168/wireless
Merge tag 'iwlwifi-next-for-kalle-2019-09-06' of git://git.kernel.org/.../iwlwifi/iwlwifi-next
Larry Finger (14):
rtlwifi: rtl8192cu: Fix value set in descriptor
rtlwifi: rtl_pci: Fix memory leak when hardware init fails
rtlwifi: rtl8192ee: Remove unused GET_XXX and SET_XXX
rtlwifi: rtl8192ee: Replace local bit manipulation macros
rtlwifi: rtl8192ee: Convert macros that set descriptor
rtlwifi: rtl8192ee: Convert inline routines to little-endian words
rtlwifi: rtl8192ee: Remove some variable initializations
rtlwifi: rtl8192cu: Remove unused GET_XXX and SET_XXX
rtlwifi: rtl8192cu: Replace local bit manipulation macros
rtlwifi: rtl8192cu: Convert macros that set descriptor
rtlwifi: rtl8192cu: Convert inline routines to little-endian words
rtlwifi: rtl8821ae: Fix incorrect returned values
rtlwifi: rtl8188ee: Fix incorrect returned values
rtlwifi: rtl8192ce: Fix incorrect returned values
Lorenzo Bianconi (33):
mt76: mt7615: fix sparse warnings: warning: restricted __le16 degrades to integer
mt76: mt7615: introduce mt7615_regd_notifier
mt76: mt7615: add hw dfs pattern detector support
mt76: mt7615: do not perform txcalibration before cac is complited
mt76: mt7615: add csa support
mt76: mt7615: add radar pattern test knob to debugfs
mt76: mt7615: fall back to sw encryption for unsupported ciphers
mt76: mt7615: always release sem in mt7615_load_patch
mt76: mt7615: introduce mt7615_mcu_send_ram_firmware routine
mt76: mt76u: fix typo in mt76u_fill_rx_sg
mt76: mt76x0u: add support to TP-Link T2UHP
mt76: mt7615: move mt7615_mac_get_key_info in mac.c
mt76: mt7615: add mt7615_mac_wtbl_addr routine
mt76: mt7615: introduce mt7615_mac_wtbl_set_key routine
mt76: mt7615: remove wtbl_sec_key definition
mt76: mt7615: add set_key_cmd and mt76_wcid to mt7615_mac_wtbl_set_key signature
mt76: introduce mt76_mmio_read_copy routine
mt76: mt7615: fix MT7615_WATCHDOG_TIME definition
mt76: mt7603: fix watchdog rescheduling in mt7603_set_channel
mt76: mt7615: rework locking scheme for mt7615_set_channel
mt76: mt7615: add Smart Carrier Sense support
mt76: mt76x02: introduce mt76x02_pre_tbtt_enable and mt76x02_beacon_enable macros
mt76: mt76x02: do not copy beacon skb in mt76x02_mac_set_beacon_enable
mt76: mt76x02u: enable multi-vif support
mt76: mt76x02u: enable survey support
mt76: mt7603: move survey_time in mt76_dev
mt76: mt7615: enable survey support
mt76: move mt76_tx_tasklet in mt76 module
mt76: mt7603: remove unnecessary mcu queue initialization
mt76: mt7615: add BIP_CMAC_128 cipher support
mt76: add default implementation for mt76_sw_scan/mt76_sw_scan_complete
mt76: mt7615: introduce mt7615_txwi_to_txp utility routine
mt76: mt7615: add support to read temperature from mcu
Luca Coelho (12):
iwlwifi: bump FW API to 49 for 22000 series
iwlwifi: mvm: remove check for lq_sta in __iwl_mvm_rs_tx_status()
iwlwifi: bump FW API to 50 for 22000 series
iwlwifi: remove duplicate FW string definitions
iwlwifi: remove unnecessary IWL_DEVICE_AX200_COMMON definition
iwlwifi: separate elements from cfg that are needed by trans_alloc
iwlwifi: pcie: use the cfg we passed to iwl_trans_pcie_alloc()
iwlwifi: pcie: move some cfg mangling from trans_pcie_alloc to probe
iwlwifi: pcie: set iwl_trans->cfg later in the probe function
iwlwifi: pass the iwl_config_trans_params when needed
iwlwifi: add a pointer to the trans_cfg directly in trans
iwlwifi: always access the trans configuration via trans
Mordechay Goodstein (1):
iwlwifi: mvm: name magic numbers with enum
Oliver Neukum (1):
zd1211rw: remove false assertion from zd_mac_clear()
Rafał Miłecki (3):
brcmfmac: get chip's default RAM info during PCIe setup
brcmfmac: add stub version of brcmf_debugfs_get_devdir()
brcmfmac: add "reset" debugfs entry for testing reset
Ryder Lee (8):
mt76: mt7615: add 4 WMM sets support
mt76: mt7615: update cw_min/max related settings
mt76: Add paragraphs to describe the config symbols fully
mt76: mt7603: fix some checkpatch warnings
mt76: mt7615: fix some checkpatch warnings
mt76: mt76x02: fix some checkpatch warnings
mt76: switch to SPDX tag instead of verbose boilerplate text
mt76: fix some checkpatch warnings
Shahar S Matityahu (24):
iwlwifi: dbg: move monitor recording functionality from header file
iwlwifi: dbg: move debug recording stop from trans to op mode
iwlwifi: dbg: support debug recording suspend resume command
iwlwifi: add ldbg config cmd debug print
iwlwifi: dbg_ini: align dbg tlv functions names to a single format
iwlwifi: dbg: add debug periphery registers to 9000 device family
iwlwifi: dbg_ini: maintain buffer allocations from trans instead of TLVs buffer
iwlwifi: dbg_ini: use linked list to store debug TLVs
iwlwifi: dbg_ini: remove periphery phy and aux regions handling
iwlwifi: dbg_ini: use function to check if ini dbg mode is on
iwlwifi: dbg_ini: verify debug TLVs at allocation phase
iwlwifi: dbg_ini: remove debug flow TLV
iwlwifi: dbg: align wrt log prints to the same format
iwlwifi: dbg_ini: separate cfg and dump flows to different modules
iwlwifi: dbg_ini: use linked list for dump TLVs during dump creation
iwlwifi: dbg_ini: move tx fifo data into fw runtime
iwlwifi: dbg_ini: make a single ops struct for paging collect
iwlwifi: dbg_ini: use regions ops array instead of switch case in dump flow
iwlwifi: add iwl_tlv_array_len()
iwlwifi: dbg_ini: remove apply point, switch to time point API
iwlwifi: fw api: add DRAM buffer allocation command
iwlwifi: dbg_ini: fix dump structs doc
iwlwifi: dbg_ini: remove periodic trigger
iwlwifi: dbg: remove iwl_fw_cancel_dumps function
Shaul Triebitz (2):
iwlwifi: mvm: add the skb length to a print
iwlwifi: pass the iwl_trans instead of cfg to some functions
Stanislaw Gruszka (9):
rt2x00: do not set IEEE80211_TX_STAT_AMPDU_NO_BACK on tx status
mt76: usb: fix endian in mt76u_copy
mt76: usb: remove unneeded {put,get}_unaligned
mt76: mt76x02: use params->ssn value directly
mt76: mt7603: use params->ssn value directly
mt76: mt7615: use params->ssn value directly
mt76: make mt76_rx_convert static
mt76: mt76x0: remove redundant chandef copy
mt76: mt76x0: remove unneeded return value on set channel
Tova Mussai (2):
iwlwifi: allocate bigger nvm data in case of UHB
iwlwifi: mvm: look for the first supported channel when add/remove phy ctxt
Valdis Kletnieks (1):
rtlwifi: fix non-kerneldoc comment in usb.c
Wei Yongjun (2):
rtw88: fix seq_file memory leak
rtlwifi: Fix file release memory leak
Wenwen Wang (1):
airo: fix memory leaks
Xulin Sun (1):
brcmfmac: replace strncpy() by strscpy()
Yu-Yen Ting (1):
rtw88: pci: enable MSI interrupt
YueHaibing (3):
rtlwifi: remove unused variables 'RTL8712_SDIO_EFUSE_TABLE' and 'MAX_PGPKT_SIZE'
bcma: remove two unused variables
mt76: mt7603: use devm_platform_ioremap_resource() to simplify code
zhong jiang (1):
hostap: remove set but not used variable 'copied' in prism2_io_debug_proc_read
drivers/bcma/driver_mips.c | 16 -
drivers/bcma/driver_pci.c | 4 +-
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 22 +-
.../wireless/broadcom/brcm80211/brcmfmac/chip.c | 6 +-
.../wireless/broadcom/brcm80211/brcmfmac/chip.h | 1 +
.../wireless/broadcom/brcm80211/brcmfmac/core.c | 25 +
.../wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 +
.../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 1 -
.../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 +
.../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 2 +-
drivers/net/wireless/cisco/airo.c | 11 +-
drivers/net/wireless/intel/ipw2x00/ipw2200.c | 2 +-
drivers/net/wireless/intel/iwlwifi/Kconfig | 14 -
drivers/net/wireless/intel/iwlwifi/cfg/1000.c | 14 +-
drivers/net/wireless/intel/iwlwifi/cfg/2000.c | 26 +-
drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 46 +-
drivers/net/wireless/intel/iwlwifi/cfg/5000.c | 18 +-
drivers/net/wireless/intel/iwlwifi/cfg/6000.c | 44 +-
drivers/net/wireless/intel/iwlwifi/cfg/7000.c | 10 +-
drivers/net/wireless/intel/iwlwifi/cfg/8000.c | 10 +-
drivers/net/wireless/intel/iwlwifi/cfg/9000.c | 10 +-
drivers/net/wireless/intel/iwlwifi/dvm/devices.c | 3 +-
drivers/net/wireless/intel/iwlwifi/dvm/led.c | 5 +-
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 4 +-
drivers/net/wireless/intel/iwlwifi/dvm/main.c | 12 +-
drivers/net/wireless/intel/iwlwifi/dvm/power.c | 3 +-
drivers/net/wireless/intel/iwlwifi/dvm/tx.c | 5 +-
drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 12 +
.../net/wireless/intel/iwlwifi/fw/api/commands.h | 7 +
drivers/net/wireless/intel/iwlwifi/fw/api/d3.h | 6 +-
.../net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h | 102 +-
drivers/net/wireless/intel/iwlwifi/fw/api/debug.h | 83 +-
.../net/wireless/intel/iwlwifi/fw/api/location.h | 4 +-
drivers/net/wireless/intel/iwlwifi/fw/api/mac.h | 4 +
drivers/net/wireless/intel/iwlwifi/fw/api/phy.h | 7 +
drivers/net/wireless/intel/iwlwifi/fw/api/power.h | 12 +
drivers/net/wireless/intel/iwlwifi/fw/api/rs.h | 18 +-
drivers/net/wireless/intel/iwlwifi/fw/api/rx.h | 32 +
drivers/net/wireless/intel/iwlwifi/fw/api/scan.h | 55 +-
drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 1155 +++++++-------------
drivers/net/wireless/intel/iwlwifi/fw/dbg.h | 121 +-
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h | 38 +-
drivers/net/wireless/intel/iwlwifi/fw/file.h | 29 +-
drivers/net/wireless/intel/iwlwifi/fw/img.h | 9 -
drivers/net/wireless/intel/iwlwifi/fw/init.c | 2 -
drivers/net/wireless/intel/iwlwifi/fw/paging.c | 6 +-
drivers/net/wireless/intel/iwlwifi/fw/runtime.h | 23 +-
drivers/net/wireless/intel/iwlwifi/fw/smem.c | 2 +-
drivers/net/wireless/intel/iwlwifi/iwl-config.h | 51 +-
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 236 ++--
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.h | 36 +-
drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h | 1 -
drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 30 +-
.../net/wireless/intel/iwlwifi/iwl-eeprom-parse.c | 21 +-
.../net/wireless/intel/iwlwifi/iwl-eeprom-parse.h | 4 +-
.../net/wireless/intel/iwlwifi/iwl-eeprom-read.c | 14 +-
drivers/net/wireless/intel/iwlwifi/iwl-fh.h | 6 +-
drivers/net/wireless/intel/iwlwifi/iwl-io.c | 21 +-
drivers/net/wireless/intel/iwlwifi/iwl-io.h | 18 +-
drivers/net/wireless/intel/iwlwifi/iwl-modparams.h | 9 +-
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 60 +-
drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h | 27 +-
drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 5 +
drivers/net/wireless/intel/iwlwifi/iwl-trans.c | 16 -
drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 150 +--
drivers/net/wireless/intel/iwlwifi/mvm/constants.h | 1 +
drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 224 +---
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 154 +--
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 183 +++-
drivers/net/wireless/intel/iwlwifi/mvm/led.c | 6 +-
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 9 +-
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 424 ++-----
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 150 +--
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | 4 +-
drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 480 +-------
drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c | 11 +-
drivers/net/wireless/intel/iwlwifi/mvm/power.c | 82 +-
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c | 19 +-
drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 8 +-
drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 18 +-
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 115 +-
drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 98 +-
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 29 +-
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 9 -
.../net/wireless/intel/iwlwifi/mvm/time-event.c | 8 +-
drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 12 +-
drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 9 +-
drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 19 +-
.../wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c | 4 +-
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 326 ++----
drivers/net/wireless/intel/iwlwifi/pcie/internal.h | 38 +-
drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 77 +-
.../net/wireless/intel/iwlwifi/pcie/trans-gen2.c | 19 +-
drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 380 +++----
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 52 +-
drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 176 ++-
.../net/wireless/intersil/hostap/hostap_download.c | 6 +-
drivers/net/wireless/intersil/hostap/hostap_plx.c | 3 +-
drivers/net/wireless/intersil/hostap/hostap_proc.c | 3 +-
drivers/net/wireless/mediatek/mt76/agg-rx.c | 36 +-
drivers/net/wireless/mediatek/mt76/debugfs.c | 13 +-
drivers/net/wireless/mediatek/mt76/dma.c | 21 +-
drivers/net/wireless/mediatek/mt76/dma.h | 13 +-
drivers/net/wireless/mediatek/mt76/eeprom.c | 13 +-
drivers/net/wireless/mediatek/mt76/mac80211.c | 78 +-
drivers/net/wireless/mediatek/mt76/mcu.c | 13 +-
drivers/net/wireless/mediatek/mt76/mmio.c | 28 +-
drivers/net/wireless/mediatek/mt76/mt76.h | 43 +-
drivers/net/wireless/mediatek/mt76/mt7603/Kconfig | 6 +-
drivers/net/wireless/mediatek/mt76/mt7603/beacon.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt7603/core.c | 2 +-
.../net/wireless/mediatek/mt76/mt7603/debugfs.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt7603/dma.c | 17 +-
drivers/net/wireless/mediatek/mt76/mt7603/eeprom.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt7603/init.c | 6 +-
drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 14 +-
drivers/net/wireless/mediatek/mt76/mt7603/main.c | 41 +-
drivers/net/wireless/mediatek/mt76/mt7603/mcu.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h | 1 -
drivers/net/wireless/mediatek/mt76/mt7603/pci.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt7603/soc.c | 5 +-
drivers/net/wireless/mediatek/mt76/mt7615/Kconfig | 7 +-
drivers/net/wireless/mediatek/mt76/mt7615/Makefile | 3 +-
.../net/wireless/mediatek/mt76/mt7615/debugfs.c | 91 ++
drivers/net/wireless/mediatek/mt76/mt7615/dma.c | 12 +-
drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c | 38 +
drivers/net/wireless/mediatek/mt76/mt7615/init.c | 80 +-
drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 733 ++++++++++++-
drivers/net/wireless/mediatek/mt76/mt7615/mac.h | 28 +
drivers/net/wireless/mediatek/mt76/mt7615/main.c | 111 +-
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 474 ++++----
drivers/net/wireless/mediatek/mt76/mt7615/mcu.h | 54 +-
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h | 99 +-
drivers/net/wireless/mediatek/mt76/mt7615/pci.c | 1 +
drivers/net/wireless/mediatek/mt76/mt7615/regs.h | 75 ++
drivers/net/wireless/mediatek/mt76/mt76x0/Kconfig | 12 +-
drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 17 +-
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c | 15 +-
.../net/wireless/mediatek/mt76/mt76x0/pci_mcu.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 49 +-
drivers/net/wireless/mediatek/mt76/mt76x0/phy.h | 10 +-
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c | 28 +-
.../net/wireless/mediatek/mt76/mt76x0/usb_mcu.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02.h | 45 +-
.../net/wireless/mediatek/mt76/mt76x02_beacon.c | 83 +-
.../net/wireless/mediatek/mt76/mt76x02_debugfs.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_dfs.h | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_dma.h | 13 +-
.../net/wireless/mediatek/mt76/mt76x02_eeprom.c | 13 +-
.../net/wireless/mediatek/mt76/mt76x02_eeprom.h | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 29 +-
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 15 +-
drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c | 26 +-
drivers/net/wireless/mediatek/mt76/mt76x02_mcu.h | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c | 24 +-
drivers/net/wireless/mediatek/mt76/mt76x02_phy.c | 16 +-
drivers/net/wireless/mediatek/mt76/mt76x02_phy.h | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_regs.h | 41 +-
drivers/net/wireless/mediatek/mt76/mt76x02_trace.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_trace.h | 16 +-
drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_usb.h | 13 +-
.../net/wireless/mediatek/mt76/mt76x02_usb_core.c | 13 +-
.../net/wireless/mediatek/mt76/mt76x02_usb_mcu.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 75 +-
drivers/net/wireless/mediatek/mt76/mt76x2/Kconfig | 14 +-
drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c | 23 +-
drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.h | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x2/init.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x2/mac.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x2/mac.h | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x2/mcu.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x2/mcu.h | 16 +-
drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h | 13 +-
.../net/wireless/mediatek/mt76/mt76x2/mt76x2u.h | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c | 13 +-
.../net/wireless/mediatek/mt76/mt76x2/pci_init.c | 14 +-
.../net/wireless/mediatek/mt76/mt76x2/pci_main.c | 15 +-
.../net/wireless/mediatek/mt76/mt76x2/pci_mcu.c | 17 +-
.../net/wireless/mediatek/mt76/mt76x2/pci_phy.c | 13 +-
drivers/net/wireless/mediatek/mt76/mt76x2/phy.c | 18 +-
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c | 14 +-
.../net/wireless/mediatek/mt76/mt76x2/usb_init.c | 20 +-
.../net/wireless/mediatek/mt76/mt76x2/usb_mac.c | 13 +-
.../net/wireless/mediatek/mt76/mt76x2/usb_main.c | 24 +-
.../net/wireless/mediatek/mt76/mt76x2/usb_mcu.c | 13 +-
.../net/wireless/mediatek/mt76/mt76x2/usb_phy.c | 13 +-
drivers/net/wireless/mediatek/mt76/trace.c | 13 +-
drivers/net/wireless/mediatek/mt76/trace.h | 22 +-
drivers/net/wireless/mediatek/mt76/tx.c | 44 +-
drivers/net/wireless/mediatek/mt76/usb.c | 60 +-
drivers/net/wireless/mediatek/mt76/usb_trace.c | 13 +-
drivers/net/wireless/mediatek/mt76/usb_trace.h | 24 +-
drivers/net/wireless/mediatek/mt76/util.c | 13 +-
drivers/net/wireless/mediatek/mt76/util.h | 4 +-
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 3 -
drivers/net/wireless/realtek/rtlwifi/debug.c | 2 +-
drivers/net/wireless/realtek/rtlwifi/efuse.c | 17 -
drivers/net/wireless/realtek/rtlwifi/pci.c | 2 +
.../net/wireless/realtek/rtlwifi/rtl8188ee/trx.h | 14 +-
.../net/wireless/realtek/rtlwifi/rtl8192ce/trx.h | 6 +-
.../net/wireless/realtek/rtlwifi/rtl8192cu/mac.c | 8 +-
.../net/wireless/realtek/rtlwifi/rtl8192cu/trx.c | 272 ++---
.../net/wireless/realtek/rtlwifi/rtl8192cu/trx.h | 529 ++++-----
.../net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | 314 +++---
.../net/wireless/realtek/rtlwifi/rtl8192ee/trx.h | 861 +++++++--------
.../net/wireless/realtek/rtlwifi/rtl8821ae/trx.h | 10 +-
drivers/net/wireless/realtek/rtlwifi/usb.c | 16 +-
drivers/net/wireless/realtek/rtw88/coex.c | 7 +-
drivers/net/wireless/realtek/rtw88/debug.c | 4 +-
drivers/net/wireless/realtek/rtw88/pci.c | 70 +-
drivers/net/wireless/zydas/zd1211rw/zd_chip.c | 3 +-
drivers/net/wireless/zydas/zd1211rw/zd_mac.c | 1 -
drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 11 +-
216 files changed, 5206 insertions(+), 6244 deletions(-)
create mode 100644 drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
^ permalink raw reply
* Re: pull-request: wireless-drivers-next 2019-09-07
From: David Miller @ 2019-09-07 8:34 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <87blvwlelw.fsf@kamboji.qca.qualcomm.com>
From: Kalle Valo <kvalo@codeaurora.org>
Date: Sat, 07 Sep 2019 11:01:15 +0300
> here's a pull request to net-next for v5.4, more info below. Please let
> me know if there are any problems.
Pulled, thanks Kalle.
^ permalink raw reply
* Re: [RFC PATCH 3/3] Enable ptp_kvm for arm64
From: Marc Zyngier @ 2019-09-07 9:15 UTC (permalink / raw)
To: Jianyong Wu (Arm Technology China)
Cc: netdev@vger.kernel.org, pbonzini@redhat.com,
sean.j.christopherson@intel.com, richardcochran@gmail.com,
Mark Rutland, Will Deacon, Suzuki Poulose,
linux-kernel@vger.kernel.org, Steve Capper,
Kaly Xin (Arm Technology China), Justin He (Arm Technology China)
In-Reply-To: <HE1PR0801MB16768ED94EA50010EEF634EAF4BA0@HE1PR0801MB1676.eurprd08.prod.outlook.com>
On Fri, 06 Sep 2019 12:58:15 +0100,
"Jianyong Wu (Arm Technology China)" <Jianyong.Wu@arm.com> wrote:
>
> Hi Marc,
>
> Very sorry to have missed this comments.
>
> > -----Original Message-----
> > From: Marc Zyngier <maz@kernel.org>
> > Sent: Thursday, August 29, 2019 6:33 PM
> > To: Jianyong Wu (Arm Technology China) <Jianyong.Wu@arm.com>;
> > netdev@vger.kernel.org; pbonzini@redhat.com;
> > sean.j.christopherson@intel.com; richardcochran@gmail.com; Mark Rutland
> > <Mark.Rutland@arm.com>; Will Deacon <Will.Deacon@arm.com>; Suzuki
> > Poulose <Suzuki.Poulose@arm.com>
> > Cc: linux-kernel@vger.kernel.org; Steve Capper <Steve.Capper@arm.com>;
> > Kaly Xin (Arm Technology China) <Kaly.Xin@arm.com>; Justin He (Arm
> > Technology China) <Justin.He@arm.com>
> > Subject: Re: [RFC PATCH 3/3] Enable ptp_kvm for arm64
> >
> > On 29/08/2019 07:39, Jianyong Wu wrote:
> > > Currently in arm64 virtualization environment, there is no mechanism
> > > to keep time sync between guest and host. Time in guest will drift
> > > compared with host after boot up as they may both use third party time
> > > sources to correct their time respectively. The time deviation will be
> > > in order of milliseconds but some scenarios ask for higher time
> > > precision, like in cloud envirenment, we want all the VMs running in
> > > the host aquire the same level accuracy from host clock.
> > >
> > > Use of kvm ptp clock, which choose the host clock source clock as a
> > > reference clock to sync time clock between guest and host has been
> > > adopted by x86 which makes the time sync order from milliseconds to
> > nanoseconds.
> > >
> > > This patch enable kvm ptp on arm64 and we get the similar clock drift
> > > as found with x86 with kvm ptp.
> > >
> > > Test result comparison between with kvm ptp and without it in arm64
> > > are as follows. This test derived from the result of command 'chronyc
> > > sources'. we should take more cure of the last sample column which
> > > shows the offset between the local clock and the source at the last
> > measurement.
> > >
> > > no kvm ptp in guest:
> > > MS Name/IP address Stratum Poll Reach LastRx Last sample
> > >
> > ==========================================================
> > ==============
> > > ^* dns1.synet.edu.cn 2 6 377 13 +1040us[+1581us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 21 +1040us[+1581us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 29 +1040us[+1581us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 37 +1040us[+1581us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 45 +1040us[+1581us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 53 +1040us[+1581us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 61 +1040us[+1581us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 4 -130us[ +796us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 12 -130us[ +796us] +/- 21ms
> > > ^* dns1.synet.edu.cn 2 6 377 20 -130us[ +796us] +/- 21ms
> > >
> > > in host:
> > > MS Name/IP address Stratum Poll Reach LastRx Last sample
> > >
> > ==========================================================
> > ==============
> > > ^* 120.25.115.20 2 7 377 72 -470us[ -603us] +/- 18ms
> > > ^* 120.25.115.20 2 7 377 92 -470us[ -603us] +/- 18ms
> > > ^* 120.25.115.20 2 7 377 112 -470us[ -603us] +/- 18ms
> > > ^* 120.25.115.20 2 7 377 2 +872ns[-6808ns] +/- 17ms
> > > ^* 120.25.115.20 2 7 377 22 +872ns[-6808ns] +/- 17ms
> > > ^* 120.25.115.20 2 7 377 43 +872ns[-6808ns] +/- 17ms
> > > ^* 120.25.115.20 2 7 377 63 +872ns[-6808ns] +/- 17ms
> > > ^* 120.25.115.20 2 7 377 83 +872ns[-6808ns] +/- 17ms
> > > ^* 120.25.115.20 2 7 377 103 +872ns[-6808ns] +/- 17ms
> > > ^* 120.25.115.20 2 7 377 123 +872ns[-6808ns] +/- 17ms
> > >
> > > The dns1.synet.edu.cn is the network reference clock for guest and
> > > 120.25.115.20 is the network reference clock for host. we can't get
> > > the clock error between guest and host directly, but a roughly
> > > estimated value will be in order of hundreds of us to ms.
> > >
> > > with kvm ptp in guest:
> > > chrony has been disabled in host to remove the disturb by network clock.
> >
> > Is that a realistic use case? Why should the host not use NTP?
> >
>
> Not really, NTP will change the the host clock which will contaminate the data of sync between
> Host and guest. But in reality, we will keep NTP online.
>
> > >
> > > MS Name/IP address Stratum Poll Reach LastRx Last sample
> > >
> > ==========================================================
> > ==============
> > > * PHC0 0 3 377 8 -7ns[ +1ns] +/- 3ns
> > > * PHC0 0 3 377 8 +1ns[ +16ns] +/- 3ns
> > > * PHC0 0 3 377 6 -4ns[ -0ns] +/- 6ns
> > > * PHC0 0 3 377 6 -8ns[ -12ns] +/- 5ns
> > > * PHC0 0 3 377 5 +2ns[ +4ns] +/- 4ns
> > > * PHC0 0 3 377 13 +2ns[ +4ns] +/- 4ns
> > > * PHC0 0 3 377 12 -4ns[ -6ns] +/- 4ns
> > > * PHC0 0 3 377 11 -8ns[ -11ns] +/- 6ns
> > > * PHC0 0 3 377 10 -14ns[ -20ns] +/- 4ns
> > > * PHC0 0 3 377 8 +4ns[ +5ns] +/- 4ns
> > >
> > > The PHC0 is the ptp clock which choose the host clock as its source
> > > clock. So we can be sure to say that the clock error between host and
> > > guest is in order of ns.
> > >
> > > Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> > > ---
> > > arch/arm64/include/asm/arch_timer.h | 3 ++
> > > arch/arm64/kvm/arch_ptp_kvm.c | 76
> > ++++++++++++++++++++++++++++
> > > drivers/clocksource/arm_arch_timer.c | 6 ++-
> > > drivers/ptp/Kconfig | 2 +-
> > > include/linux/arm-smccc.h | 14 +++++
> > > virt/kvm/arm/psci.c | 17 +++++++
> > > 6 files changed, 115 insertions(+), 3 deletions(-) create mode
> > > 100644 arch/arm64/kvm/arch_ptp_kvm.c
> >
> > Please split this patch into two parts: the hypervisor code in a patch and the
> > guest code in another patch. Having both of them together is confusing.
> >
> Ok, really better.
>
> > >
> > > diff --git a/arch/arm64/include/asm/arch_timer.h
> > > b/arch/arm64/include/asm/arch_timer.h
> > > index 6756178c27db..880576a814b6 100644
> > > --- a/arch/arm64/include/asm/arch_timer.h
> > > +++ b/arch/arm64/include/asm/arch_timer.h
> > > @@ -229,4 +229,7 @@ static inline int arch_timer_arch_init(void)
> > > return 0;
> > > }
> > >
> > > +extern struct clocksource clocksource_counter; extern u64
> > > +arch_counter_read(struct clocksource *cs);
> >
> > I'm definitely not keen on exposing the internals of the arch_timer driver to
> > random subsystems. Furthermore, you seem to expect that the guest kernel
> > will only use the arch timer as a clocksource, and nothing really guarantees
> > that (in which case get_device_system_crosststamp will fail).
> >
> The code here is really ugly, I need a better solution to offer a clock source
> For the guest.
>
> > It looks to me that we'd be better off exposing a core timekeeping API that
> > populates a struct system_counterval_t based on the *current* timekeeper
> > monotonic clocksource. This would simplify the split between generic and
> > arch-specific code.
> >
> I think it really necessary.
>
> > Whether or not tglx will be happy with the idea is another problem, but I'm
> > certainly not taking any change to the arch timer code based on this.
> >
> I can have a try, but the detail is not clear for me now.
Something along those lines:
From 5f1c061e55c691d64012bc7c1490a1a8c4432c67 Mon Sep 17 00:00:00 2001
From: Marc Zyngier <maz@kernel.org>
Date: Sat, 7 Sep 2019 10:11:49 +0100
Subject: [PATCH] timekeeping: Expose API allowing retrival of current
clocksource and counter value
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
include/linux/timekeeping.h | 5 +++++
kernel/time/timekeeping.c | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b27e2ffa96c1..6df26a913711 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -275,6 +275,11 @@ extern int get_device_system_crosststamp(
struct system_time_snapshot *history,
struct system_device_crosststamp *xtstamp);
+/*
+ * Obtain current monotonic clock and its counter value
+ */
+extern void get_current_counterval(struct system_counterval_t *sc);
+
/*
* Simultaneously snapshot realtime and monotonic raw clocks
*/
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d911c8470149..de689bbd3808 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1098,6 +1098,18 @@ static bool cycle_between(u64 before, u64 test, u64 after)
return false;
}
+/**
+ * get_current_counterval - Snapshot the current clocksource and counter value
+ * @sc: Pointer to a struct containing the current clocksource and its value
+ */
+void get_current_counterval(struct system_counterval_t *sc)
+{
+ struct timekeeper *tk = &tk_core.timekeeper;
+
+ sc->cs = READ_ONCE(tk->tkr_mono.clock);
+ sc->cycles = sc->cs->read(sc->cs);
+}
+
/**
* get_device_system_crosststamp - Synchronously capture system/device timestamp
* @get_time_fn: Callback to get simultaneous device time and
which should do the right thing.
>
> > > +
> > > #endif
> > > diff --git a/arch/arm64/kvm/arch_ptp_kvm.c
> > > b/arch/arm64/kvm/arch_ptp_kvm.c
> >
> > We don't put non-hypervisor in arch/arm64/kvm. Please move it back to
> > drivers/ptp (as well as its x86 counterpart), and just link the two parts there.
> > This should also allow this to be enabled for 32bit guests.
> >
> Err, sorry, what's mean of "link the two parts there"? should I add
> another two file update driver/ptp/ Both for arm64 and x86 to
> contains these arch-specific code or pack them all into ptp_kvm.c?
What I'm suggesting is that you have 3 files:
drivers/ptp/ptp_kvm.c
drivers/ptp/ptp_kvm_x86.c
drivers/ptp/ptp_kvm_arm.c
and let the Makefile combine them.
[...]
> > Other questions: how does this works with VM migration? Specially when
> > moving from a hypervisor that supports the feature to one that doesn't?
> >
> I think it won't solve the problem generated by VM migration and
> only for VMs in a single machine. Ptp_kvm only works for VMs in the
> same machine. But using ptp (not ptp_kvm) clock, all the machines
> in a low latency network environment can keep time sync in high
> precision, Then VMs move from one machine to another will obtain a
> high precision time sync.
That's a problem. Migration must be possible from one host to another,
even if that means temporarily loosing some (or a lot of)
precision. The service must be discoverable from userspace on the host
so that the MVV can decie whether a migration is possible or not.
Thanks,
M.
--
Jazz is not dead, it just smells funny.
^ permalink raw reply related
* Re: INFO: rcu detected stall in igmp_ifc_timer_expire
From: syzbot @ 2019-09-07 9:56 UTC (permalink / raw)
To: davem, herbert, jhs, jiri, linux-kernel, netdev, steffen.klassert,
syzkaller-bugs, xiyou.wangcong
In-Reply-To: <000000000000a26437057e4915ff@google.com>
syzbot has found a reproducer for the following crash on:
HEAD commit: 1e3778cb Merge tag 'scsi-fixes' of git://git.kernel.org/pu..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12df164e600000
kernel config: https://syzkaller.appspot.com/x/.config?x=b89bb446a3faaba4
dashboard link: https://syzkaller.appspot.com/bug?extid=041483004a7f45f1f20a
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=148c3001600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13b12cd1600000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+041483004a7f45f1f20a@syzkaller.appspotmail.com
rcu: INFO: rcu_preempt self-detected stall on CPU
rcu: 1-...!: (1 GPs behind) idle=b8e/0/0x3 softirq=12119/12122 fqs=6
(t=10500 jiffies g=10289 q=55)
rcu: rcu_preempt kthread starved for 10480 jiffies! g10289 f0x0
RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=0
rcu: RCU grace-period kthread stack dump:
rcu_preempt I29520 10 2 0x80004000
Call Trace:
context_switch kernel/sched/core.c:3254 [inline]
__schedule+0x755/0x1580 kernel/sched/core.c:3880
schedule+0xd9/0x260 kernel/sched/core.c:3947
schedule_timeout+0x486/0xc50 kernel/time/timer.c:1807
rcu_gp_fqs_loop kernel/rcu/tree.c:1611 [inline]
rcu_gp_kthread+0x9b2/0x18c0 kernel/rcu/tree.c:1768
kthread+0x361/0x430 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
NMI backtrace for cpu 1
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.3.0-rc7+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
nmi_cpu_backtrace.cold+0x70/0xb2 lib/nmi_backtrace.c:101
nmi_trigger_cpumask_backtrace+0x23b/0x28b lib/nmi_backtrace.c:62
arch_trigger_cpumask_backtrace+0x14/0x20 arch/x86/kernel/apic/hw_nmi.c:38
trigger_single_cpu_backtrace include/linux/nmi.h:164 [inline]
rcu_dump_cpu_stacks+0x183/0x1cf kernel/rcu/tree_stall.h:254
print_cpu_stall kernel/rcu/tree_stall.h:455 [inline]
check_cpu_stall kernel/rcu/tree_stall.h:529 [inline]
rcu_pending kernel/rcu/tree.c:2736 [inline]
rcu_sched_clock_irq.cold+0x4dd/0xc13 kernel/rcu/tree.c:2183
update_process_times+0x32/0x80 kernel/time/timer.c:1639
tick_sched_handle+0xa2/0x190 kernel/time/tick-sched.c:167
tick_sched_timer+0x53/0x140 kernel/time/tick-sched.c:1296
__run_hrtimer kernel/time/hrtimer.c:1389 [inline]
__hrtimer_run_queues+0x364/0xe40 kernel/time/hrtimer.c:1451
hrtimer_interrupt+0x314/0x770 kernel/time/hrtimer.c:1509
local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1106 [inline]
smp_apic_timer_interrupt+0x160/0x610 arch/x86/kernel/apic/apic.c:1131
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830
RIP: 0010:__list_del_entry_valid+0xb3/0xf5 lib/list_debug.c:54
Code: 75 53 49 8b 14 24 4c 39 f2 0f 85 99 00 00 00 49 8d 7d 08 48 b8 00 00
00 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 75 24 <49> 8b 55 08 4c
39 f2 0f 85 aa 00 00 00 41 5c b8 01 00 00 00 41 5d
RSP: 0018:ffff8880ae909010 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: dffffc0000000000 RBX: ffff88808c064338 RCX: ffffffff85c65b39
RDX: 1ffff1101180c87b RSI: ffffffff85c66006 RDI: ffff88808c0643d8
RBP: ffff8880ae909028 R08: ffff8880a98d6340 R09: 0000000000000000
R10: fffffbfff134afaf R11: ffff8880a98d6340 R12: ffff88808c0643d0
R13: ffff88808c0643d0 R14: ffff88808c064338 R15: 0000000000000000
__list_del_entry include/linux/list.h:131 [inline]
list_move_tail include/linux/list.h:213 [inline]
hhf_dequeue+0x5c5/0xa20 net/sched/sch_hhf.c:439
dequeue_skb net/sched/sch_generic.c:258 [inline]
qdisc_restart net/sched/sch_generic.c:361 [inline]
__qdisc_run+0x1e7/0x19d0 net/sched/sch_generic.c:379
__dev_xmit_skb net/core/dev.c:3533 [inline]
__dev_queue_xmit+0x16f1/0x3650 net/core/dev.c:3838
dev_queue_xmit+0x18/0x20 net/core/dev.c:3902
br_dev_queue_push_xmit+0x3f3/0x5c0 net/bridge/br_forward.c:52
NF_HOOK include/linux/netfilter.h:305 [inline]
NF_HOOK include/linux/netfilter.h:299 [inline]
br_forward_finish+0xfa/0x400 net/bridge/br_forward.c:65
NF_HOOK include/linux/netfilter.h:305 [inline]
NF_HOOK include/linux/netfilter.h:299 [inline]
__br_forward+0x641/0xb00 net/bridge/br_forward.c:109
deliver_clone+0x61/0xc0 net/bridge/br_forward.c:125
maybe_deliver+0x2c7/0x390 net/bridge/br_forward.c:181
br_flood+0x13a/0x3d0 net/bridge/br_forward.c:223
br_dev_xmit+0x98c/0x15a0 net/bridge/br_device.c:100
__netdev_start_xmit include/linux/netdevice.h:4406 [inline]
netdev_start_xmit include/linux/netdevice.h:4420 [inline]
xmit_one net/core/dev.c:3280 [inline]
dev_hard_start_xmit+0x1a3/0x9c0 net/core/dev.c:3296
__dev_queue_xmit+0x2b15/0x3650 net/core/dev.c:3869
dev_queue_xmit+0x18/0x20 net/core/dev.c:3902
neigh_hh_output include/net/neighbour.h:500 [inline]
neigh_output include/net/neighbour.h:509 [inline]
ip_finish_output2+0x1726/0x2570 net/ipv4/ip_output.c:228
__ip_finish_output net/ipv4/ip_output.c:308 [inline]
__ip_finish_output+0x5fc/0xb90 net/ipv4/ip_output.c:290
ip_finish_output+0x38/0x1f0 net/ipv4/ip_output.c:318
NF_HOOK_COND include/linux/netfilter.h:294 [inline]
ip_output+0x21f/0x640 net/ipv4/ip_output.c:432
dst_output include/net/dst.h:436 [inline]
ip_local_out+0xbb/0x190 net/ipv4/ip_output.c:125
igmpv3_sendpack+0x1b5/0x2c0 net/ipv4/igmp.c:426
igmpv3_send_cr net/ipv4/igmp.c:721 [inline]
igmp_ifc_timer_expire+0x687/0xa00 net/ipv4/igmp.c:809
call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1322
expire_timers kernel/time/timer.c:1366 [inline]
__run_timers kernel/time/timer.c:1685 [inline]
__run_timers kernel/time/timer.c:1653 [inline]
run_timer_softirq+0x697/0x17a0 kernel/time/timer.c:1698
__do_softirq+0x262/0x98c kernel/softirq.c:292
invoke_softirq kernel/softirq.c:373 [inline]
irq_exit+0x19b/0x1e0 kernel/softirq.c:413
exiting_irq arch/x86/include/asm/apic.h:537 [inline]
smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1133
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830
</IRQ>
RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
Code: 38 73 6e fa eb 8a 90 90 90 90 90 90 e9 07 00 00 00 0f 00 2d 24 1b 4a
00 f4 c3 66 90 e9 07 00 00 00 0f 00 2d 14 1b 4a 00 fb f4 <c3> 90 55 48 89
e5 41 57 41 56 41 55 41 54 53 e8 ee 32 22 fa e8 39
RSP: 0018:ffff8880a98e7d68 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13
RAX: 1ffffffff11a5e8d RBX: ffff8880a98d6340 RCX: 1ffffffff134b5ee
RDX: dffffc0000000000 RSI: ffffffff8177f14e RDI: ffffffff873e050c
RBP: ffff8880a98e7d98 R08: ffff8880a98d6340 R09: ffffed101531ac69
R10: ffffed101531ac68 R11: ffff8880a98d6347 R12: dffffc0000000000
R13: ffffffff89a57d78 R14: 0000000000000000 R15: 0000000000000001
arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:571
default_idle_call+0x84/0xb0 kernel/sched/idle.c:94
cpuidle_idle_call kernel/sched/idle.c:154 [inline]
do_idle+0x413/0x760 kernel/sched/idle.c:263
cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:354
start_secondary+0x315/0x430 arch/x86/kernel/smpboot.c:264
secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241
^ permalink raw reply
* Re: [net-next 02/11] devlink: add 'reset_dev_on_drv_probe' param
From: Jiri Pirko @ 2019-09-07 10:28 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Dirk van der Merwe, Simon Horman, David Miller, netdev,
oss-drivers
In-Reply-To: <20190906211730.5c362b48@cakuba.netronome.com>
Sat, Sep 07, 2019 at 06:17:30AM CEST, jakub.kicinski@netronome.com wrote:
>On Fri, 6 Sep 2019 11:40:54 -0700, Dirk van der Merwe wrote:
>> >> DEVLINK_PARAM_RESET_DEV_VALUE_UNKNOWN (0)
>> >> + Unknown or invalid value.
>> > Why do you need this? Do you have usecase for this value?
>>
>> I added this in to avoid having the entire netlink dump fail when there
>> are invalid values read from hardware.
>>
>> This way, it can report an unknown or invalid value instead of failing
>> the operation.
>
>That's the first reason, the second is that we also want to report
>the unknown value if it's not recognized by the driver. For u8/enum
>parameters the value may possibly be set to a value older driver
>doesn't understand, but users should still be able to set them to one
>of the known ones.
Ok.
>
>We'd also like to add that to 'fw_load_policy'. WDYT?
Ok.
^ permalink raw reply
* Re: [PATCH] net/skbuff: silence warnings under memory pressure
From: Tetsuo Handa @ 2019-09-07 11:00 UTC (permalink / raw)
To: Michal Hocko, Sergey Senozhatsky
Cc: Qian Cai, Eric Dumazet, davem, netdev, linux-mm, linux-kernel,
Petr Mladek, Sergey Senozhatsky, Steven Rostedt
In-Reply-To: <20190904082540.GI3838@dhcp22.suse.cz>
On 2019/09/04 17:25, Michal Hocko wrote:
> On Wed 04-09-19 16:00:42, Sergey Senozhatsky wrote:
>> On (09/04/19 15:41), Sergey Senozhatsky wrote:
>>> But the thing is different in case of dump_stack() + show_mem() +
>>> some other output. Because now we ratelimit not a single printk() line,
>>> but hundreds of them. The ratelimit becomes - 10 * $$$ lines in 5 seconds
>>> (IOW, now we talk about thousands of lines).
>>
>> And on devices with slow serial consoles this can be somewhat close to
>> "no ratelimit". *Suppose* that warn_alloc() adds 700 lines each time.
>> Within 5 seconds we can call warn_alloc() 10 times, which will add 7000
>> lines to the logbuf. If printk() can evict only 6000 lines in 5 seconds
>> then we have a growing number of pending logbuf messages.
>
> Yes, ratelimit is problematic when the ratelimited operation is slow. I
> guess that is a well known problem and we would need to rework both the
> api and the implementation to make it work in those cases as well.
> Essentially we need to make the ratelimit act as a gatekeeper to an
> operation section - something like a critical section except you can
> tolerate more code executions but not too many. So effectively
>
> start_throttle(rate, number);
> /* here goes your operation */
> end_throttle();
>
> one operation is not considered done until the whole section ends.
> Or something along those lines.
Regarding OOM killer which is serialized by oom_lock mutex, I proposed
"mm, oom: More aggressively ratelimit dump_header()." at
https://lkml.kernel.org/r/1550325895-9291-2-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
but it was ignored.
>
> In this particular case we can increase the rate limit parameters of
> course but I think that longterm we need a better api.
>
I proposed "printk: Introduce "store now but print later" prefix." at
https://lkml.kernel.org/r/1550896930-12324-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
but it was not accepted.
But I think that more better solution for warn_alloc() is to defer printing
from allocating context (which may not be allowed to sleep) to WQ context.
I proposed "mm,oom: Defer dump_tasks() output." at
https://lkml.kernel.org/r/7de2310d-afbd-e616-e83a-d75103b986c6@i-love.sakura.ne.jp
and answered to Michal's concerns. I hope we can apply the same thing for
warn_alloc() and show_mem(). Then, we can minimize latency for both
"memory allocation failures" and "OOM killer invocations".
^ permalink raw reply
* Re: [PATCH] net: stmmac: socfpga: re-use the `interface` parameter from platform data
From: kbuild test robot @ 2019-09-07 12:54 UTC (permalink / raw)
To: Alexandru Ardelean
Cc: kbuild-all, netdev, linux-stm32, linux-arm-kernel, linux-kernel,
peppe.cavallaro, alexandre.torgue, joabreu, mcoquelin.stm32,
davem, Alexandru Ardelean
In-Reply-To: <20190906123054.5514-1-alexandru.ardelean@analog.com>
[-- Attachment #1: Type: text/plain, Size: 7941 bytes --]
Hi Alexandru,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc7 next-20190904]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/net-stmmac-socfpga-re-use-the-interface-parameter-from-platform-data/20190907-190627
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sparc64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/dma-mapping.h:7:0,
from include/linux/skbuff.h:30,
from include/linux/if_ether.h:19,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from include/linux/phy.h:16,
from drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:11:
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 'socfpga_gen5_set_phy_mode':
>> drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: error: 'phymode' undeclared (first use in this function); did you mean 'phy_modes'?
dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
^
include/linux/device.h:1499:32: note: in definition of macro 'dev_err'
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:264:44: note: each undeclared identifier is reported only once for each function it appears in
dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
^
include/linux/device.h:1499:32: note: in definition of macro 'dev_err'
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 'socfpga_gen10_set_phy_mode':
drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c:340:6: error: 'phymode' undeclared (first use in this function); did you mean 'phy_modes'?
phymode == PHY_INTERFACE_MODE_MII ||
^~~~~~~
phy_modes
vim +264 drivers/net//ethernet/stmicro/stmmac/dwmac-socfpga.c
40ae25505fe834 Dinh Nguyen 2019-06-05 255
40ae25505fe834 Dinh Nguyen 2019-06-05 256 static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac)
40ae25505fe834 Dinh Nguyen 2019-06-05 257 {
40ae25505fe834 Dinh Nguyen 2019-06-05 258 struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
40ae25505fe834 Dinh Nguyen 2019-06-05 259 u32 reg_offset = dwmac->reg_offset;
40ae25505fe834 Dinh Nguyen 2019-06-05 260 u32 reg_shift = dwmac->reg_shift;
40ae25505fe834 Dinh Nguyen 2019-06-05 261 u32 ctrl, val, module;
40ae25505fe834 Dinh Nguyen 2019-06-05 262
6169afbe4a340b Alexandru Ardelean 2019-09-06 263 if (socfpga_set_phy_mode_common(dwmac, &val)) {
801d233b7302ee Dinh Nguyen 2014-03-26 @264 dev_err(dwmac->dev, "bad phy mode %d\n", phymode);
801d233b7302ee Dinh Nguyen 2014-03-26 265 return -EINVAL;
801d233b7302ee Dinh Nguyen 2014-03-26 266 }
801d233b7302ee Dinh Nguyen 2014-03-26 267
b4834c86e11baf Ley Foon Tan 2014-08-20 268 /* Overwrite val to GMII if splitter core is enabled. The phymode here
b4834c86e11baf Ley Foon Tan 2014-08-20 269 * is the actual phy mode on phy hardware, but phy interface from
b4834c86e11baf Ley Foon Tan 2014-08-20 270 * EMAC core is GMII.
b4834c86e11baf Ley Foon Tan 2014-08-20 271 */
b4834c86e11baf Ley Foon Tan 2014-08-20 272 if (dwmac->splitter_base)
b4834c86e11baf Ley Foon Tan 2014-08-20 273 val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
b4834c86e11baf Ley Foon Tan 2014-08-20 274
70cb136f773083 Joachim Eastwood 2016-05-01 275 /* Assert reset to the enet controller before changing the phy mode */
bc8a2d9bcbf1ca Dinh Nguyen 2018-06-19 276 reset_control_assert(dwmac->stmmac_ocp_rst);
70cb136f773083 Joachim Eastwood 2016-05-01 277 reset_control_assert(dwmac->stmmac_rst);
70cb136f773083 Joachim Eastwood 2016-05-01 278
801d233b7302ee Dinh Nguyen 2014-03-26 279 regmap_read(sys_mgr_base_addr, reg_offset, &ctrl);
801d233b7302ee Dinh Nguyen 2014-03-26 280 ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
801d233b7302ee Dinh Nguyen 2014-03-26 281 ctrl |= val << reg_shift;
801d233b7302ee Dinh Nguyen 2014-03-26 282
013dae5dbc07aa Stephan Gatzka 2017-08-22 283 if (dwmac->f2h_ptp_ref_clk ||
013dae5dbc07aa Stephan Gatzka 2017-08-22 284 phymode == PHY_INTERFACE_MODE_MII ||
013dae5dbc07aa Stephan Gatzka 2017-08-22 285 phymode == PHY_INTERFACE_MODE_GMII ||
013dae5dbc07aa Stephan Gatzka 2017-08-22 286 phymode == PHY_INTERFACE_MODE_SGMII) {
43569814fa35b2 Phil Reid 2015-12-14 287 ctrl |= SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2);
734e00fa02eff5 Phil Reid 2016-04-07 288 regmap_read(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG,
734e00fa02eff5 Phil Reid 2016-04-07 289 &module);
734e00fa02eff5 Phil Reid 2016-04-07 290 module |= (SYSMGR_FPGAGRP_MODULE_EMAC << (reg_shift / 2));
734e00fa02eff5 Phil Reid 2016-04-07 291 regmap_write(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG,
734e00fa02eff5 Phil Reid 2016-04-07 292 module);
734e00fa02eff5 Phil Reid 2016-04-07 293 } else {
43569814fa35b2 Phil Reid 2015-12-14 294 ctrl &= ~(SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2));
734e00fa02eff5 Phil Reid 2016-04-07 295 }
43569814fa35b2 Phil Reid 2015-12-14 296
801d233b7302ee Dinh Nguyen 2014-03-26 297 regmap_write(sys_mgr_base_addr, reg_offset, ctrl);
734e00fa02eff5 Phil Reid 2016-04-07 298
70cb136f773083 Joachim Eastwood 2016-05-01 299 /* Deassert reset for the phy configuration to be sampled by
70cb136f773083 Joachim Eastwood 2016-05-01 300 * the enet controller, and operation to start in requested mode
70cb136f773083 Joachim Eastwood 2016-05-01 301 */
bc8a2d9bcbf1ca Dinh Nguyen 2018-06-19 302 reset_control_deassert(dwmac->stmmac_ocp_rst);
70cb136f773083 Joachim Eastwood 2016-05-01 303 reset_control_deassert(dwmac->stmmac_rst);
fb3bbdb859891e Tien Hock Loh 2016-07-07 304 if (phymode == PHY_INTERFACE_MODE_SGMII) {
fb3bbdb859891e Tien Hock Loh 2016-07-07 305 if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) {
fb3bbdb859891e Tien Hock Loh 2016-07-07 306 dev_err(dwmac->dev, "Unable to initialize TSE PCS");
fb3bbdb859891e Tien Hock Loh 2016-07-07 307 return -EINVAL;
fb3bbdb859891e Tien Hock Loh 2016-07-07 308 }
fb3bbdb859891e Tien Hock Loh 2016-07-07 309 }
70cb136f773083 Joachim Eastwood 2016-05-01 310
801d233b7302ee Dinh Nguyen 2014-03-26 311 return 0;
801d233b7302ee Dinh Nguyen 2014-03-26 312 }
801d233b7302ee Dinh Nguyen 2014-03-26 313
:::::: The code at line 264 was first introduced by commit
:::::: 801d233b7302eeab94750427a623c10c044cb0ca net: stmmac: Add SOCFPGA glue driver
:::::: TO: Dinh Nguyen <dinguyen@altera.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
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: 58668 bytes --]
^ permalink raw reply
* Re: [net-next 00/16][pull request] 100GbE Intel Wired LAN Driver Updates 2019-09-05
From: David Miller @ 2019-09-07 13:27 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann
In-Reply-To: <20190905203406.4152-1-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu, 5 Sep 2019 13:33:50 -0700
> This series contains updates to ice driver.
Pulled, thanks Jeff.
^ permalink raw reply
* [PATCH net v2 00/11] net: fix nested device bugs
From: Taehee Yoo @ 2019-09-07 13:45 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
This patchset fixes several bugs that are related to nesting
device infrastructure.
Current nesting infrastructure code doesn't limit the depth level of
devices. nested devices could be handled recursively. at that moment,
it needs huge memory and stack overflow could occur.
Below devices type have same bug.
VLAN, BONDING, TEAM, MACSEC, MACVLAN and VXLAN.
Test commands:
ip link add dummy0 type dummy
ip link add vlan1 link dummy0 type vlan id 1
for i in {2..100}
do
let A=$i-1
ip link add name vlan$i link vlan$A type vlan id $i
done
ip link del dummy0
1st patch actually fixes the root cause.
It adds new common variables {upper/lower}_level that represent
depth level. upper_level variable is depth of upper devices.
lower_level variable is depth of lower devices.
[U][L] [U][L]
vlan1 1 5 vlan4 1 4
vlan2 2 4 vlan5 2 3
vlan3 3 3 |
| |
+------------+
|
vlan6 4 2
dummy0 5 1
After this patch, the nesting infrastructure code uses this variable to
check the depth level.
2, 4, 5, 6, 7 patches fix lockdep related problem.
Before this patch, devices use static lockdep map.
So, if devices that are same type is nested, lockdep will warn about
recursive situation.
These patches make these devices use dynamic lockdep key instead of
static lock or subclass.
3rd patch fixes unexpected IFF_BONDING bit unset.
8th patch fixes a refcnt leak in the macsec module.
9th patch adds ignore flag to an adjacent structure.
In order to exchange an adjacent node safely, ignore flag is needed.
10th patch makes vxlan add an adjacent link to limit depth level.
11th patch removes unnecessary variables and callback.
v1 -> v2 :
- Make the 3rd patch do not add a new priv_flag.
Taehee Yoo (11):
net: core: limit nested device depth
vlan: use dynamic lockdep key instead of subclass
bonding: fix unexpected IFF_BONDING bit unset
bonding: use dynamic lockdep key instead of subclass
team: use dynamic lockdep key instead of static key
macsec: use dynamic lockdep key instead of subclass
macvlan: use dynamic lockdep key instead of subclass
macsec: fix refcnt leak in module exit routine
net: core: add ignore flag to netdev_adjacent structure
vxlan: add adjacent link to limit depth level
net: remove unnecessary variables and callback
drivers/net/bonding/bond_alb.c | 2 +-
drivers/net/bonding/bond_main.c | 81 ++++--
.../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +-
drivers/net/macsec.c | 50 ++--
drivers/net/macvlan.c | 36 ++-
drivers/net/team/team.c | 61 ++++-
drivers/net/vxlan.c | 71 ++++-
include/linux/if_macvlan.h | 3 +-
include/linux/if_team.h | 5 +
include/linux/if_vlan.h | 13 +-
include/linux/netdevice.h | 20 +-
include/net/bonding.h | 4 +-
include/net/vxlan.h | 1 +
net/8021q/vlan.c | 1 -
net/8021q/vlan_dev.c | 32 +--
net/core/dev.c | 252 ++++++++++++++++--
net/core/dev_addr_lists.c | 12 +-
net/smc/smc_core.c | 2 +-
net/smc/smc_pnet.c | 2 +-
19 files changed, 508 insertions(+), 142 deletions(-)
--
2.17.1
^ permalink raw reply
* [PATCH net v2 01/11] net: core: limit nested device depth
From: Taehee Yoo @ 2019-09-07 13:45 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
Current code doesn't limit the number of nested devices.
Nested devices would be handled recursively and this needs huge stack
memory. So, unlimited nested devices could make stack overflow.
This patch adds upper_level and lower_leve, they are common variables
and represent maximum lower/upper depth.
When upper/lower device is attached or dettached,
{lower/upper}_level are updated. and if maximum depth is bigger than 8,
attach routine fails and returns -EMLINK.
Test commands:
ip link add dummy0 type dummy
ip link add link dummy0 name vlan1 type vlan id 1
ip link set vlan1 up
for i in {2..100}
do
let A=$i-1
ip link add name vlan$i link vlan$A type vlan id $i
done
Splat looks like:
[ 140.483124] BUG: looking up invalid subclass: 8
[ 140.483505] turning off the locking correctness validator.
[ 140.483505] CPU: 0 PID: 1324 Comm: ip Not tainted 5.3.0-rc7+ #322
[ 140.483505] Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 07/08/2015
[ 140.483505] Call Trace:
[ 140.483505] dump_stack+0x7c/0xbb
[ 140.483505] register_lock_class+0x64d/0x14d0
[ 140.483505] ? is_dynamic_key+0x230/0x230
[ 140.483505] ? module_assert_mutex_or_preempt+0x41/0x70
[ 140.483505] ? __module_address+0x3f/0x3c0
[ 140.483505] lockdep_init_map+0x24e/0x630
[ 140.483505] vlan_dev_init+0x828/0xce0 [8021q]
[ 140.483505] register_netdevice+0x24f/0xd70
[ 140.483505] ? netdev_change_features+0xa0/0xa0
[ 140.483505] ? dev_get_nest_level+0xe1/0x170
[ 140.483505] register_vlan_dev+0x29b/0x710 [8021q]
[ 140.483505] __rtnl_newlink+0xb75/0x1180
[ ... ]
[ 168.446539] WARNING: can't dereference registers at 00000000bef3d701 for ip apic_timer_interrupt+0xf/0x20
[ 168.466843] ==================================================================
[ 168.469452] BUG: KASAN: slab-out-of-bounds in __unwind_start+0x71/0x850
[ 168.480707] Write of size 88 at addr ffff8880b8856d38 by task ip/1758
[ 168.480707]
[ 168.480707] CPU: 1 PID: 1758 Comm: ip Not tainted 5.3.0-rc7+ #322
[ ... ]
[ 168.794493] Rebooting in 5 seconds..
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
include/linux/netdevice.h | 4 ++
net/core/dev.c | 106 ++++++++++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 88292953aa6f..5bb5756129af 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1624,6 +1624,8 @@ enum netdev_priv_flags {
* @type: Interface hardware type
* @hard_header_len: Maximum hardware header length.
* @min_header_len: Minimum hardware header length
+ * @upper_level: Maximum depth level of upper devices.
+ * @lower_level: Maximum depth level of lower devices.
*
* @needed_headroom: Extra headroom the hardware may need, but not in all
* cases can this be guaranteed
@@ -1854,6 +1856,8 @@ struct net_device {
unsigned short type;
unsigned short hard_header_len;
unsigned char min_header_len;
+ unsigned char upper_level;
+ unsigned char lower_level;
unsigned short needed_headroom;
unsigned short needed_tailroom;
diff --git a/net/core/dev.c b/net/core/dev.c
index 0891f499c1bb..6a4b4ce62204 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -146,6 +146,7 @@
#include "net-sysfs.h"
#define MAX_GRO_SKBS 8
+#define MAX_NEST_DEV 8
/* This should be increased if a protocol with a bigger head is added. */
#define GRO_MAX_HEAD (MAX_HEADER + 128)
@@ -6602,6 +6603,21 @@ struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
}
EXPORT_SYMBOL(netdev_upper_get_next_dev_rcu);
+static struct net_device *netdev_next_upper_dev(struct net_device *dev,
+ struct list_head **iter)
+{
+ struct netdev_adjacent *upper;
+
+ upper = list_entry((*iter)->next, struct netdev_adjacent, list);
+
+ if (&upper->list == &dev->adj_list.upper)
+ return NULL;
+
+ *iter = &upper->list;
+
+ return upper->dev;
+}
+
static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev,
struct list_head **iter)
{
@@ -6619,6 +6635,33 @@ static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev,
return upper->dev;
}
+int netdev_walk_all_upper_dev(struct net_device *dev,
+ int (*fn)(struct net_device *dev,
+ void *data),
+ void *data)
+{
+ struct net_device *udev;
+ struct list_head *iter;
+ int ret;
+
+ for (iter = &dev->adj_list.upper,
+ udev = netdev_next_upper_dev(dev, &iter);
+ udev;
+ udev = netdev_next_upper_dev(dev, &iter)) {
+ /* first is the upper device itself */
+ ret = fn(udev, data);
+ if (ret)
+ return ret;
+
+ /* then look at all of its upper devices */
+ ret = netdev_walk_all_upper_dev(udev, fn, data);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
int netdev_walk_all_upper_dev_rcu(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
@@ -6785,6 +6828,52 @@ static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
return lower->dev;
}
+static u8 __netdev_upper_depth(struct net_device *dev)
+{
+ struct net_device *udev;
+ struct list_head *iter;
+ u8 max_depth = 0;
+
+ for (iter = &dev->adj_list.upper,
+ udev = netdev_next_upper_dev(dev, &iter);
+ udev;
+ udev = netdev_next_upper_dev(dev, &iter)) {
+ if (max_depth < udev->upper_level)
+ max_depth = udev->upper_level;
+ }
+
+ return max_depth;
+}
+
+static u8 __netdev_lower_depth(struct net_device *dev)
+{
+ struct net_device *ldev;
+ struct list_head *iter;
+ u8 max_depth = 0;
+
+ for (iter = &dev->adj_list.lower,
+ ldev = netdev_next_lower_dev(dev, &iter);
+ ldev;
+ ldev = netdev_next_lower_dev(dev, &iter)) {
+ if (max_depth < ldev->lower_level)
+ max_depth = ldev->lower_level;
+ }
+
+ return max_depth;
+}
+
+static int __netdev_update_upper_level(struct net_device *dev, void *data)
+{
+ dev->upper_level = __netdev_upper_depth(dev) + 1;
+ return 0;
+}
+
+static int __netdev_update_lower_level(struct net_device *dev, void *data)
+{
+ dev->lower_level = __netdev_lower_depth(dev) + 1;
+ return 0;
+}
+
int netdev_walk_all_lower_dev_rcu(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
@@ -7063,6 +7152,9 @@ static int __netdev_upper_dev_link(struct net_device *dev,
if (netdev_has_upper_dev(upper_dev, dev))
return -EBUSY;
+ if ((dev->lower_level + upper_dev->upper_level) > MAX_NEST_DEV)
+ return -EMLINK;
+
if (!master) {
if (netdev_has_upper_dev(dev, upper_dev))
return -EEXIST;
@@ -7089,6 +7181,12 @@ static int __netdev_upper_dev_link(struct net_device *dev,
if (ret)
goto rollback;
+ __netdev_update_upper_level(dev, NULL);
+ netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL);
+
+ __netdev_update_lower_level(upper_dev, NULL);
+ netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, NULL);
+
return 0;
rollback:
@@ -7171,6 +7269,12 @@ void netdev_upper_dev_unlink(struct net_device *dev,
call_netdevice_notifiers_info(NETDEV_CHANGEUPPER,
&changeupper_info.info);
+
+ __netdev_update_upper_level(dev, NULL);
+ netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL);
+
+ __netdev_update_lower_level(upper_dev, NULL);
+ netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, NULL);
}
EXPORT_SYMBOL(netdev_upper_dev_unlink);
@@ -9157,6 +9261,8 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
dev->gso_max_size = GSO_MAX_SIZE;
dev->gso_max_segs = GSO_MAX_SEGS;
+ dev->upper_level = 1;
+ dev->lower_level = 1;
INIT_LIST_HEAD(&dev->napi_list);
INIT_LIST_HEAD(&dev->unreg_list);
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 02/11] vlan: use dynamic lockdep key instead of subclass
From: Taehee Yoo @ 2019-09-07 13:45 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
All VLAN device has same lockdep key and subclass is initialized with
nest_level.
But actual nest_level value can be changed when a lower device is attached.
And at this moment, the subclass should be updated but it seems to be
unsafe.
So this patch makes VLAN use dynamic lockdep key instead of the subclass.
Test commands:
ip link add dummy0 type dummy
ip link set dummy0 up
ip link add bond0 type bond
ip link add vlan_dummy1 link dummy0 type vlan id 1
ip link add vlan_bond1 link bond0 type vlan id 2
ip link set vlan_dummy1 master bond0
ip link set bond0 up
ip link set vlan_dummy1 up
ip link set vlan_bond1 up
Both vlan_dummy1 and vlan_bond1 have the same subclass and it makes
unnecessary deadlock warning message.
Splat looks like:
[ 149.244978] ============================================
[ 149.244978] WARNING: possible recursive locking detected
[ 149.244978] 5.3.0-rc7+ #322 Not tainted
[ 149.244978] --------------------------------------------
[ 149.244978] ip/1340 is trying to acquire lock:
[ 149.244978] 000000001399b1a7 (&vlan_netdev_addr_lock_key/1){+...}, at: dev_uc_sync_multiple+0xfa/0x1a0
[ 149.279600]
[ 149.279600] but task is already holding lock:
[ 149.279600] 00000000b963d9b4 (&vlan_netdev_addr_lock_key/1){+...}, at: dev_set_rx_mode+0x19/0x30
[ 149.279600]
[ 149.279600] other info that might help us debug this:
[ 149.305981] Possible unsafe locking scenario:
[ 149.305981]
[ 149.305981] CPU0
[ 149.305981] ----
[ 149.305981] lock(&vlan_netdev_addr_lock_key/1);
[ 149.305981] lock(&vlan_netdev_addr_lock_key/1);
[ 149.326258]
[ 149.326258] *** DEADLOCK ***
[ 149.326258]
[ 149.326258] May be due to missing lock nesting notation
[ 149.326258]
[ 149.326258] 4 locks held by ip/1340:
[ 149.326258] #0: 00000000927f0698 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x466/0x8a0
[ 149.326258] #1: 00000000b963d9b4 (&vlan_netdev_addr_lock_key/1){+...}, at: dev_set_rx_mode+0x19/0x30
[ 149.326258] #2: 0000000027395445 (&dev_addr_list_lock_key/3){+...}, at: dev_mc_sync+0xfa/0x1a0
[ 149.369961] #3: 00000000ce334932 (rcu_read_lock){....}, at: bond_set_rx_mode+0x5/0x3c0 [bonding]
[ 149.369961]
[ 149.369961] stack backtrace:
[ 149.369961] CPU: 1 PID: 1340 Comm: ip Not tainted 5.3.0-rc7+ #322
[ 149.369961] Call Trace:
[ 149.369961] dump_stack+0x7c/0xbb
[ 149.369961] __lock_acquire+0x26a9/0x3de0
[ 149.369961] ? register_lock_class+0x14d0/0x14d0
[ 149.369961] ? register_lock_class+0x14d0/0x14d0
[ 149.369961] lock_acquire+0x164/0x3b0
[ 149.433970] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 149.433970] _raw_spin_lock_nested+0x2e/0x60
[ 149.433970] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 149.433970] dev_uc_sync_multiple+0xfa/0x1a0
[ 149.433970] bond_set_rx_mode+0x269/0x3c0 [bonding]
[ 149.433970] ? bond_init+0x6f0/0x6f0 [bonding]
[ 149.433970] dev_mc_sync+0x15a/0x1a0
[ 149.433970] vlan_dev_set_rx_mode+0x37/0x80 [8021q]
[ 149.433970] dev_set_rx_mode+0x21/0x30
[ 149.433970] __dev_open+0x202/0x310
[ 149.433970] ? dev_set_rx_mode+0x30/0x30
[ 149.433970] ? mark_held_locks+0xa5/0xe0
[ 149.433970] ? __local_bh_enable_ip+0xe9/0x1b0
[ 149.433970] __dev_change_flags+0x3c3/0x500
[ ... ]
Fixes: 0fe1e567d0b4 ("[VLAN]: nested VLAN: fix lockdep's recursive locking warning")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
include/linux/if_vlan.h | 3 +++
net/8021q/vlan_dev.c | 28 +++++++++++++++-------------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 244278d5c222..1aed9f613e90 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -183,6 +183,9 @@ struct vlan_dev_priv {
struct netpoll *netpoll;
#endif
unsigned int nest_level;
+
+ struct lock_class_key xmit_lock_key;
+ struct lock_class_key addr_lock_key;
};
static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 93eadf179123..12bc80650087 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -494,24 +494,24 @@ static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
* "super class" of normal network devices; split their locks off into a
* separate class since they always nest.
*/
-static struct lock_class_key vlan_netdev_xmit_lock_key;
-static struct lock_class_key vlan_netdev_addr_lock_key;
-
static void vlan_dev_set_lockdep_one(struct net_device *dev,
struct netdev_queue *txq,
- void *_subclass)
+ void *_unused)
{
- lockdep_set_class_and_subclass(&txq->_xmit_lock,
- &vlan_netdev_xmit_lock_key,
- *(int *)_subclass);
+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
+
+ lockdep_set_class(&txq->_xmit_lock, &vlan->xmit_lock_key);
}
-static void vlan_dev_set_lockdep_class(struct net_device *dev, int subclass)
+static void vlan_dev_set_lockdep_class(struct net_device *dev)
{
- lockdep_set_class_and_subclass(&dev->addr_list_lock,
- &vlan_netdev_addr_lock_key,
- subclass);
- netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, &subclass);
+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
+
+ lockdep_register_key(&vlan->addr_lock_key);
+ lockdep_set_class(&dev->addr_list_lock, &vlan->addr_lock_key);
+
+ lockdep_register_key(&vlan->xmit_lock_key);
+ netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, NULL);
}
static int vlan_dev_get_lock_subclass(struct net_device *dev)
@@ -609,7 +609,7 @@ static int vlan_dev_init(struct net_device *dev)
SET_NETDEV_DEVTYPE(dev, &vlan_type);
- vlan_dev_set_lockdep_class(dev, vlan_dev_get_lock_subclass(dev));
+ vlan_dev_set_lockdep_class(dev);
vlan->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
if (!vlan->vlan_pcpu_stats)
@@ -630,6 +630,8 @@ static void vlan_dev_uninit(struct net_device *dev)
kfree(pm);
}
}
+ lockdep_unregister_key(&vlan->addr_lock_key);
+ lockdep_unregister_key(&vlan->xmit_lock_key);
}
static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 03/11] bonding: fix unexpected IFF_BONDING bit unset
From: Taehee Yoo @ 2019-09-07 13:46 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
The IFF_BONDING means bonding master or bonding slave device.
->ndo_add_slave() sets IFF_BONDING flag and ->ndo_del_slave() unsets
IFF_BONDING flag.
bond0<--bond1
Both bond0 and bond1 are bonding device and these should keep having
IFF_BONDING flag until they are removed.
But bond1 would lose IFF_BONDING at ->ndo_del_slave() because that routine
do not check whether the slave device is the bonding type or not.
This patch adds the interface type check routine before removing
IFF_BONDING flag.
Test commands:
ip link add bond0 type bond
ip link add bond1 type bond
ip link set bond1 master bond0
ip link set bond1 nomaster
ip link del bond1 type bond
ip link add bond1 type bond
Splat looks like:
[ 149.201107] proc_dir_entry 'bonding/bond1' already registered
[ 149.208013] WARNING: CPU: 1 PID: 1308 at fs/proc/generic.c:361 proc_register+0x2a9/0x3e0
[ 149.208866] Modules linked in: bonding veth openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv4 ip_tables6
[ 149.208866] CPU: 1 PID: 1308 Comm: ip Not tainted 5.3.0-rc7+ #322
[ 149.208866] RIP: 0010:proc_register+0x2a9/0x3e0
[ 149.208866] Code: 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 39 01 00 00 48 8b 04 24 48 89 ea 48 c7 c7 a0 a0 13 89 48 8b b0 0
[ 149.208866] RSP: 0018:ffff88810df9f098 EFLAGS: 00010286
[ 149.208866] RAX: dffffc0000000008 RBX: ffff8880b5d3aa50 RCX: ffffffff87cdec92
[ 149.208866] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff888116bf6a8c
[ 149.208866] RBP: ffff8880b5d3acd3 R08: ffffed1022d7ff71 R09: ffffed1022d7ff71
[ 149.208866] R10: 0000000000000001 R11: ffffed1022d7ff70 R12: ffff8880b5d3abe8
[ 149.208866] R13: ffff8880b5d3acd2 R14: dffffc0000000000 R15: ffffed1016ba759a
[ 149.208866] FS: 00007f4bd1f650c0(0000) GS:ffff888116a00000(0000) knlGS:0000000000000000
[ 149.208866] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 149.208866] CR2: 000055e7ca686118 CR3: 0000000106fd4000 CR4: 00000000001006e0
[ 149.208866] Call Trace:
[ 149.208866] proc_create_seq_private+0xb3/0xf0
[ 149.208866] bond_create_proc_entry+0x1b3/0x3f0 [bonding]
[ 149.208866] bond_netdev_event+0x433/0x970 [bonding]
[ 149.208866] ? __module_text_address+0x13/0x140
[ 149.208866] notifier_call_chain+0x90/0x160
[ 149.208866] register_netdevice+0x9b3/0xd70
[ 149.208866] ? alloc_netdev_mqs+0x854/0xc10
[ 149.208866] ? netdev_change_features+0xa0/0xa0
[ 149.208866] ? rtnl_create_link+0x2ed/0xad0
[ 149.208866] bond_newlink+0x2a/0x60 [bonding]
[ 149.208866] __rtnl_newlink+0xb75/0x1180
[ ... ]
Fixes: 0b680e753724 ("[PATCH] bonding: Add priv_flag to avoid event mishandling")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2: do not add a new priv_flag.
drivers/net/bonding/bond_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 931d9d935686..0db12fcfc953 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1816,7 +1816,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
slave_disable_netpoll(new_slave);
err_close:
- slave_dev->priv_flags &= ~IFF_BONDING;
+ if (!netif_is_bond_master(slave_dev))
+ slave_dev->priv_flags &= ~IFF_BONDING;
dev_close(slave_dev);
err_restore_mac:
@@ -2017,7 +2018,8 @@ static int __bond_release_one(struct net_device *bond_dev,
else
dev_set_mtu(slave_dev, slave->original_mtu);
- slave_dev->priv_flags &= ~IFF_BONDING;
+ if (!netif_is_bond_master(slave_dev))
+ slave_dev->priv_flags &= ~IFF_BONDING;
bond_free_slave(slave);
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 04/11] bonding: use dynamic lockdep key instead of subclass
From: Taehee Yoo @ 2019-09-07 13:46 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
All bonding device has same lockdep key and subclass is initialized with
nest_level.
But actual nest_level value can be changed when a lower device is attached.
And at this moment, the subclass should be updated but it seems to be
unsafe.
So this patch makes bonding use dynamic lockdep key instead of the
subclass.
Test commands:
ip link add bond0 type bond
for i in {1..5}
do
let A=$i-1
ip link add bond$i type bond
ip link set bond$i master bond$A
done
ip link set bond5 master bond0
Splat looks like:
[ 327.477830] ============================================
[ 327.477830] WARNING: possible recursive locking detected
[ 327.477830] 5.3.0-rc7+ #322 Not tainted
[ 327.477830] --------------------------------------------
[ 327.477830] ip/1399 is trying to acquire lock:
[ 327.477830] 00000000f604be63 (&(&bond->stats_lock)->rlock#2/2){+.+.}, at: bond_get_stats+0xb8/0x500 [bonding]
[ 327.477830]
[ 327.477830] but task is already holding lock:
[ 327.477830] 00000000e9d31238 (&(&bond->stats_lock)->rlock#2/2){+.+.}, at: bond_get_stats+0xb8/0x500 [bonding]
[ 327.477830]
[ 327.477830] other info that might help us debug this:
[ 327.477830] Possible unsafe locking scenario:
[ 327.477830]
[ 327.477830] CPU0
[ 327.477830] ----
[ 327.477830] lock(&(&bond->stats_lock)->rlock#2/2);
[ 327.477830] lock(&(&bond->stats_lock)->rlock#2/2);
[ 327.477830]
[ 327.477830] *** DEADLOCK ***
[ 327.477830]
[ 327.477830] May be due to missing lock nesting notation
[ 327.477830]
[ 327.477830] 3 locks held by ip/1399:
[ 327.477830] #0: 00000000a762c4e3 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x466/0x8a0
[ 327.477830] #1: 00000000e9d31238 (&(&bond->stats_lock)->rlock#2/2){+.+.}, at: bond_get_stats+0xb8/0x500 [bonding]
[ 327.477830] #2: 000000008f7ebff4 (rcu_read_lock){....}, at: bond_get_stats+0x9f/0x500 [bonding]
[ 327.477830]
[ 327.477830] stack backtrace:
[ 327.477830] CPU: 0 PID: 1399 Comm: ip Not tainted 5.3.0-rc7+ #322
[ 327.477830] Call Trace:
[ 327.477830] dump_stack+0x7c/0xbb
[ 327.477830] __lock_acquire+0x26a9/0x3de0
[ 327.477830] ? __change_page_attr_set_clr+0x133b/0x1d20
[ 327.477830] ? register_lock_class+0x14d0/0x14d0
[ 327.477830] lock_acquire+0x164/0x3b0
[ 327.477830] ? bond_get_stats+0xb8/0x500 [bonding]
[ 327.666914] _raw_spin_lock_nested+0x2e/0x60
[ 327.666914] ? bond_get_stats+0xb8/0x500 [bonding]
[ 327.678302] bond_get_stats+0xb8/0x500 [bonding]
[ 327.678302] ? bond_arp_rcv+0xf10/0xf10 [bonding]
[ 327.678302] ? register_lock_class+0x14d0/0x14d0
[ 327.678302] ? bond_get_stats+0xb8/0x500 [bonding]
[ 327.678302] dev_get_stats+0x1ec/0x270
[ 327.678302] bond_get_stats+0x1d1/0x500 [bonding]
[ 327.678302] ? lock_acquire+0x164/0x3b0
[ 327.678302] ? bond_arp_rcv+0xf10/0xf10 [bonding]
[ 327.678302] ? rtnl_is_locked+0x16/0x30
[ 327.678302] ? devlink_compat_switch_id_get+0x18/0x140
[ 327.678302] ? dev_get_alias+0xe2/0x190
[ 327.731145] ? dev_get_port_parent_id+0x12a/0x340
[ 327.731145] ? rtnl_phys_switch_id_fill+0x88/0xe0
[ 327.731145] dev_get_stats+0x1ec/0x270
[ 327.731145] rtnl_fill_stats+0x44/0xbe0
[ 327.731145] ? nla_put+0xc2/0x140
[ ... ]
Fixes: d3fff6c443fe ("net: add netdev_lockdep_set_classes() helper")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
drivers/net/bonding/bond_main.c | 61 ++++++++++++++++++++++++++++++---
include/net/bonding.h | 3 ++
2 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 0db12fcfc953..7f574e74ed78 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1857,6 +1857,32 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
return res;
}
+static void bond_dev_set_lockdep_one(struct net_device *dev,
+ struct netdev_queue *txq,
+ void *_unused)
+{
+ struct bonding *bond = netdev_priv(dev);
+
+ lockdep_set_class(&txq->_xmit_lock, &bond->xmit_lock_key);
+}
+
+static void bond_update_lock_key(struct net_device *dev)
+{
+ struct bonding *bond = netdev_priv(dev);
+
+ lockdep_unregister_key(&bond->stats_lock_key);
+ lockdep_unregister_key(&bond->addr_lock_key);
+ lockdep_unregister_key(&bond->xmit_lock_key);
+
+ lockdep_register_key(&bond->stats_lock_key);
+ lockdep_register_key(&bond->addr_lock_key);
+ lockdep_register_key(&bond->xmit_lock_key);
+
+ lockdep_set_class(&bond->stats_lock, &bond->stats_lock_key);
+ lockdep_set_class(&dev->addr_list_lock, &bond->addr_lock_key);
+ netdev_for_each_tx_queue(dev, bond_dev_set_lockdep_one, NULL);
+}
+
/* Try to release the slave device <slave> from the bond device <master>
* It is legal to access curr_active_slave without a lock because all the function
* is RTNL-locked. If "all" is true it means that the function is being called
@@ -2022,6 +2048,8 @@ static int __bond_release_one(struct net_device *bond_dev,
slave_dev->priv_flags &= ~IFF_BONDING;
bond_free_slave(slave);
+ if (netif_is_bond_master(slave_dev))
+ bond_update_lock_key(slave_dev);
return 0;
}
@@ -3459,7 +3487,7 @@ static void bond_get_stats(struct net_device *bond_dev,
struct list_head *iter;
struct slave *slave;
- spin_lock_nested(&bond->stats_lock, bond_get_nest_level(bond_dev));
+ spin_lock(&bond->stats_lock);
memcpy(stats, &bond->bond_stats, sizeof(*stats));
rcu_read_lock();
@@ -4297,8 +4325,6 @@ void bond_setup(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
- spin_lock_init(&bond->mode_lock);
- spin_lock_init(&bond->stats_lock);
bond->params = bonding_defaults;
/* Initialize pointers */
@@ -4367,6 +4393,9 @@ static void bond_uninit(struct net_device *bond_dev)
list_del(&bond->bond_list);
+ lockdep_unregister_key(&bond->stats_lock_key);
+ lockdep_unregister_key(&bond->addr_lock_key);
+ lockdep_unregister_key(&bond->xmit_lock_key);
bond_debug_unregister(bond);
}
@@ -4758,6 +4787,29 @@ static int bond_check_params(struct bond_params *params)
return 0;
}
+static struct lock_class_key qdisc_tx_busylock_key;
+static struct lock_class_key qdisc_running_key;
+
+static void bond_dev_set_lockdep_class(struct net_device *dev)
+{
+ struct bonding *bond = netdev_priv(dev);
+
+ dev->qdisc_tx_busylock = &qdisc_tx_busylock_key;
+ dev->qdisc_running_key = &qdisc_running_key;
+
+ spin_lock_init(&bond->mode_lock);
+
+ spin_lock_init(&bond->stats_lock);
+ lockdep_register_key(&bond->stats_lock_key);
+ lockdep_set_class(&bond->stats_lock, &bond->stats_lock_key);
+
+ lockdep_register_key(&bond->addr_lock_key);
+ lockdep_set_class(&dev->addr_list_lock, &bond->addr_lock_key);
+
+ lockdep_register_key(&bond->xmit_lock_key);
+ netdev_for_each_tx_queue(dev, bond_dev_set_lockdep_one, NULL);
+}
+
/* Called from registration process */
static int bond_init(struct net_device *bond_dev)
{
@@ -4771,8 +4823,7 @@ static int bond_init(struct net_device *bond_dev)
return -ENOMEM;
bond->nest_level = SINGLE_DEPTH_NESTING;
- netdev_lockdep_set_classes(bond_dev);
-
+ bond_dev_set_lockdep_class(bond_dev);
list_add_tail(&bond->bond_list, &bn->dev_list);
bond_prepare_sysfs_group(bond);
diff --git a/include/net/bonding.h b/include/net/bonding.h
index f7fe45689142..c39ac7061e41 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -239,6 +239,9 @@ struct bonding {
struct dentry *debug_dir;
#endif /* CONFIG_DEBUG_FS */
struct rtnl_link_stats64 bond_stats;
+ struct lock_class_key stats_lock_key;
+ struct lock_class_key xmit_lock_key;
+ struct lock_class_key addr_lock_key;
};
#define bond_slave_get_rcu(dev) \
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 05/11] team: use dynamic lockdep key instead of static key
From: Taehee Yoo @ 2019-09-07 13:46 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
In the current code, all team devices have same static lockdep key
and team devices could be nested so that it makes unnecessary
lockdep warning.
Test commands:
ip link add team0 type team
for i in {1..7}
do
let A=$i-1
ip link add team$i type team
ip link set team$i master team$A
done
ip link del team0
Splat looks like:
[ 137.406730] ============================================
[ 137.412685] WARNING: possible recursive locking detected
[ 137.418642] 5.3.0-rc7+ #322 Not tainted
[ 137.422941] --------------------------------------------
[ 137.428886] ip/1383 is trying to acquire lock:
[ 137.433869] 0000000089571080 (&dev_addr_list_lock_key/1){+...}, at: dev_uc_sync_multiple+0xfa/0x1a0
[ 137.444034]
[ 137.444034] but task is already holding lock:
[ 137.450572] 00000000d9597252 (&dev_addr_list_lock_key/1){+...}, at: dev_uc_unsync+0x10c/0x1b0
[ 137.460142]
[ 137.460142] other info that might help us debug this:
[ 137.467458] Possible unsafe locking scenario:
[ 137.467458]
[ 137.474096] CPU0
[ 137.476828] ----
[ 137.479569] lock(&dev_addr_list_lock_key/1);
[ 137.484554] lock(&dev_addr_list_lock_key/1);
[ 137.489539]
[ 137.489539] *** DEADLOCK ***
[ 137.489539]
[ 137.496178] May be due to missing lock nesting notation
[ 137.496178]
[ 137.503789] 5 locks held by ip/1383:
[ 137.507797] #0: 00000000d497f415 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x466/0x8a0
[ 137.516786] #1: 000000008e4b4656 (&team->lock){+.+.}, at: team_uninit+0x3a/0x1a0 [team]
[ 137.525882] #2: 000000005cf248d1 (&dev_addr_list_lock_key){+...}, at: dev_uc_unsync+0x98/0x1b0
[ 137.535649] #3: 00000000d9597252 (&dev_addr_list_lock_key/1){+...}, at: dev_uc_unsync+0x10c/0x1b0
[ 137.545709] #4: 00000000bec134c3 (rcu_read_lock){....}, at: team_set_rx_mode+0x5/0x1d0 [team]
[ 137.555384]
[ 137.555384] stack backtrace:
[ 137.560277] CPU: 0 PID: 1383 Comm: ip Not tainted 5.3.0-rc7+ #322
[ 137.577826] Call Trace:
[ 137.580586] dump_stack+0x7c/0xbb
[ 137.584307] __lock_acquire+0x26a9/0x3de0
[ 137.588820] ? register_lock_class+0x14d0/0x14d0
[ 137.594008] ? register_lock_class+0x14d0/0x14d0
[ 137.599194] lock_acquire+0x164/0x3b0
[ 137.603310] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 137.608307] _raw_spin_lock_nested+0x2e/0x60
[ 137.613105] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 137.618095] dev_uc_sync_multiple+0xfa/0x1a0
[ 137.622900] team_set_rx_mode+0xa9/0x1d0 [team]
[ 137.627993] dev_uc_unsync+0x151/0x1b0
[ 137.632205] team_port_del+0x304/0x790 [team]
[ 137.637110] team_uninit+0xb0/0x1a0 [team]
[ 137.641717] rollback_registered_many+0x728/0xda0
[ 137.647005] ? generic_xdp_install+0x310/0x310
[ 137.651994] ? __set_pages_p+0xf4/0x150
[ 137.656306] ? check_chain_key+0x236/0x5d0
[ 137.660914] ? __nla_validate_parse+0x98/0x1ad0
[ 137.666006] unregister_netdevice_many.part.120+0x13/0x1b0
[ 137.672167] rtnl_delete_link+0xbc/0x100
[ 137.676575] ? rtnl_af_register+0xc0/0xc0
[ 137.681084] rtnl_dellink+0x2e7/0x870
[ 137.685204] ? find_held_lock+0x39/0x1d0
[ ... ]
Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
drivers/net/team/team.c | 61 ++++++++++++++++++++++++++++++++++++++---
include/linux/if_team.h | 5 ++++
2 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index e8089def5a46..bfcd6ed57493 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1607,6 +1607,34 @@ static const struct team_option team_options[] = {
},
};
+static void team_dev_set_lockdep_one(struct net_device *dev,
+ struct netdev_queue *txq,
+ void *_unused)
+{
+ struct team *team = netdev_priv(dev);
+
+ lockdep_set_class(&txq->_xmit_lock, &team->xmit_lock_key);
+}
+
+static struct lock_class_key qdisc_tx_busylock_key;
+static struct lock_class_key qdisc_running_key;
+
+static void team_dev_set_lockdep_class(struct net_device *dev)
+{
+ struct team *team = netdev_priv(dev);
+
+ dev->qdisc_tx_busylock = &qdisc_tx_busylock_key;
+ dev->qdisc_running_key = &qdisc_running_key;
+
+ lockdep_register_key(&team->team_lock_key);
+ __mutex_init(&team->lock, "team->team_lock_key", &team->team_lock_key);
+
+ lockdep_register_key(&team->addr_lock_key);
+ lockdep_set_class(&dev->addr_list_lock, &team->addr_lock_key);
+
+ lockdep_register_key(&team->xmit_lock_key);
+ netdev_for_each_tx_queue(dev, team_dev_set_lockdep_one, NULL);
+}
static int team_init(struct net_device *dev)
{
@@ -1615,7 +1643,6 @@ static int team_init(struct net_device *dev)
int err;
team->dev = dev;
- mutex_init(&team->lock);
team_set_no_mode(team);
team->pcpu_stats = netdev_alloc_pcpu_stats(struct team_pcpu_stats);
@@ -1642,7 +1669,7 @@ static int team_init(struct net_device *dev)
goto err_options_register;
netif_carrier_off(dev);
- netdev_lockdep_set_classes(dev);
+ team_dev_set_lockdep_class(dev);
return 0;
@@ -1673,6 +1700,11 @@ static void team_uninit(struct net_device *dev)
team_queue_override_fini(team);
mutex_unlock(&team->lock);
netdev_change_features(dev);
+
+ lockdep_unregister_key(&team->team_lock_key);
+ lockdep_unregister_key(&team->addr_lock_key);
+ lockdep_unregister_key(&team->xmit_lock_key);
+
}
static void team_destructor(struct net_device *dev)
@@ -1967,6 +1999,23 @@ static int team_add_slave(struct net_device *dev, struct net_device *port_dev,
return err;
}
+static void team_update_lock_key(struct net_device *dev)
+{
+ struct team *team = netdev_priv(dev);
+
+ lockdep_unregister_key(&team->team_lock_key);
+ lockdep_unregister_key(&team->addr_lock_key);
+ lockdep_unregister_key(&team->xmit_lock_key);
+
+ lockdep_register_key(&team->team_lock_key);
+ lockdep_register_key(&team->addr_lock_key);
+ lockdep_register_key(&team->xmit_lock_key);
+
+ lockdep_set_class(&team->lock, &team->team_lock_key);
+ lockdep_set_class(&dev->addr_list_lock, &team->addr_lock_key);
+ netdev_for_each_tx_queue(dev, team_dev_set_lockdep_one, NULL);
+}
+
static int team_del_slave(struct net_device *dev, struct net_device *port_dev)
{
struct team *team = netdev_priv(dev);
@@ -1976,8 +2025,12 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev)
err = team_port_del(team, port_dev);
mutex_unlock(&team->lock);
- if (!err)
- netdev_change_features(dev);
+ if (err)
+ return err;
+
+ if (netif_is_team_master(port_dev))
+ team_update_lock_key(port_dev);
+ netdev_change_features(dev);
return err;
}
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 06faa066496f..9c97bb19ed34 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -223,6 +223,11 @@ struct team {
atomic_t count_pending;
struct delayed_work dw;
} mcast_rejoin;
+
+ struct lock_class_key team_lock_key;
+ struct lock_class_key xmit_lock_key;
+ struct lock_class_key addr_lock_key;
+
long mode_priv[TEAM_MODE_PRIV_LONGS];
};
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 06/11] macsec: use dynamic lockdep key instead of subclass
From: Taehee Yoo @ 2019-09-07 13:46 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
All macsec device has same lockdep key and subclass is initialized with
nest_level.
But actual nest_level value can be changed when a lower device is attached.
And at this moment, the subclass should be updated but it seems to be
unsafe.
So this patch makes macsec use dynamic lockdep key instead of the subclass.
Test commands:
ip link add bond0 type bond
ip link add dummy0 type dummy
ip link add macsec0 link bond0 type macsec
ip link add macsec1 link dummy0 type macsec
ip link set bond0 mtu 1000
ip link set macsec1 master bond0
ip link set bond0 up
ip link set macsec0 up
ip link set dummy0 up
ip link set macsec1 up
Splat looks like:
[ 146.540123] ============================================
[ 146.540123] WARNING: possible recursive locking detected
[ 146.540123] 5.3.0-rc7+ #322 Not tainted
[ 146.540123] --------------------------------------------
[ 146.540123] ip/1340 is trying to acquire lock:
[ 146.540123] 00000000446fd8bd (&macsec_netdev_addr_lock_key/1){+...}, at: dev_uc_sync_multiple+0xfa/0x1a0
[ 146.540123]
[ 146.540123] but task is already holding lock:
[ 146.540123] 00000000a9ab6378 (&macsec_netdev_addr_lock_key/1){+...}, at: dev_set_rx_mode+0x19/0x30
[ 146.540123]
[ 146.540123] other info that might help us debug this:
[ 146.540123] Possible unsafe locking scenario:
[ 146.540123]
[ 146.540123] CPU0
[ 146.540123] ----
[ 146.540123] lock(&macsec_netdev_addr_lock_key/1);
[ 146.540123] lock(&macsec_netdev_addr_lock_key/1);
[ 146.623155]
[ 146.623155] *** DEADLOCK ***
[ 146.623155]
[ 146.623155] May be due to missing lock nesting notation
[ 146.623155]
[ 146.623155] 4 locks held by ip/1340:
[ 146.623155] #0: 0000000026436ef0 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x466/0x8a0
[ 146.623155] #1: 00000000a9ab6378 (&macsec_netdev_addr_lock_key/1){+...}, at: dev_set_rx_mode+0x19/0x30
[ 146.623155] #2: 00000000a8947dd0 (&dev_addr_list_lock_key/3){+...}, at: dev_mc_sync+0xfa/0x1a0
[ 146.623155] #3: 00000000b62011e9 (rcu_read_lock){....}, at: bond_set_rx_mode+0x5/0x3c0 [bonding]
[ 146.674970]
[ 146.674970] stack backtrace:
[ 146.687145] CPU: 0 PID: 1340 Comm: ip Not tainted 5.3.0-rc7+ #322
[ 146.693024] Call Trace:
[ 146.693024] dump_stack+0x7c/0xbb
[ 146.693024] __lock_acquire+0x26a9/0x3de0
[ 146.693024] ? register_lock_class+0x14d0/0x14d0
[ 146.693024] ? register_lock_class+0x14d0/0x14d0
[ 146.693024] lock_acquire+0x164/0x3b0
[ 146.693024] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 146.693024] _raw_spin_lock_nested+0x2e/0x60
[ 146.693024] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 146.693024] dev_uc_sync_multiple+0xfa/0x1a0
[ 146.693024] bond_set_rx_mode+0x269/0x3c0 [bonding]
[ 146.751163] ? bond_init+0x6f0/0x6f0 [bonding]
[ 146.757006] ? do_raw_spin_trylock+0xa9/0x170
[ 146.757006] dev_mc_sync+0x15a/0x1a0
[ 146.757006] macsec_dev_set_rx_mode+0x3a/0x50 [macsec]
[ 146.757006] dev_set_rx_mode+0x21/0x30
[ 146.757006] __dev_open+0x202/0x310
[ 146.757006] ? dev_set_rx_mode+0x30/0x30
[ 146.757006] ? mark_held_locks+0xa5/0xe0
[ 146.757006] ? __local_bh_enable_ip+0xe9/0x1b0
[ 146.757006] __dev_change_flags+0x3c3/0x500
[ 146.757006] ? dev_set_allmulti+0x10/0x10
[ 146.757006] ? sched_clock_local+0xd4/0x140
[ 146.757006] ? check_chain_key+0x236/0x5d0
[ 146.757006] dev_change_flags+0x7a/0x160
[ 146.757006] do_setlink+0xa26/0x2f20
[ 146.757006] ? sched_clock_local+0xd4/0x140
[ ... ]
Fixes: e20038724552 ("macsec: fix lockdep splats when nesting devices")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
drivers/net/macsec.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 8f46aa1ddec0..25a4fc88145d 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -267,6 +267,8 @@ struct macsec_dev {
struct pcpu_secy_stats __percpu *stats;
struct list_head secys;
struct gro_cells gro_cells;
+ struct lock_class_key xmit_lock_key;
+ struct lock_class_key addr_lock_key;
unsigned int nest_level;
};
@@ -2749,7 +2751,32 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,
#define MACSEC_FEATURES \
(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
-static struct lock_class_key macsec_netdev_addr_lock_key;
+
+static void macsec_dev_set_lockdep_one(struct net_device *dev,
+ struct netdev_queue *txq,
+ void *_unused)
+{
+ struct macsec_dev *macsec = macsec_priv(dev);
+
+ lockdep_set_class(&txq->_xmit_lock, &macsec->xmit_lock_key);
+}
+
+static struct lock_class_key qdisc_tx_busylock_key;
+static struct lock_class_key qdisc_running_key;
+
+static void macsec_dev_set_lockdep_class(struct net_device *dev)
+{
+ struct macsec_dev *macsec = macsec_priv(dev);
+
+ dev->qdisc_tx_busylock = &qdisc_tx_busylock_key;
+ dev->qdisc_running_key = &qdisc_running_key;
+
+ lockdep_register_key(&macsec->addr_lock_key);
+ lockdep_set_class(&dev->addr_list_lock, &macsec->addr_lock_key);
+
+ lockdep_register_key(&macsec->xmit_lock_key);
+ netdev_for_each_tx_queue(dev, macsec_dev_set_lockdep_one, NULL);
+}
static int macsec_dev_init(struct net_device *dev)
{
@@ -2780,6 +2807,7 @@ static int macsec_dev_init(struct net_device *dev)
if (is_zero_ether_addr(dev->broadcast))
memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len);
+ macsec_dev_set_lockdep_class(dev);
return 0;
}
@@ -2789,6 +2817,9 @@ static void macsec_dev_uninit(struct net_device *dev)
gro_cells_destroy(&macsec->gro_cells);
free_percpu(dev->tstats);
+
+ lockdep_unregister_key(&macsec->addr_lock_key);
+ lockdep_unregister_key(&macsec->xmit_lock_key);
}
static netdev_features_t macsec_fix_features(struct net_device *dev,
@@ -3263,10 +3294,6 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
dev_hold(real_dev);
macsec->nest_level = dev_get_nest_level(real_dev) + 1;
- netdev_lockdep_set_classes(dev);
- lockdep_set_class_and_subclass(&dev->addr_list_lock,
- &macsec_netdev_addr_lock_key,
- macsec_get_nest_level(dev));
err = netdev_upper_dev_link(real_dev, dev, extack);
if (err < 0)
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 07/11] macvlan: use dynamic lockdep key instead of subclass
From: Taehee Yoo @ 2019-09-07 13:46 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
All macvlan device has same lockdep key and subclass is initialized with
nest_level.
But actual nest_level value can be changed when a lower device is attached.
And at this moment, the subclass should be updated but it seems to be
unsafe.
So this patch makes macvlan use dynamic lockdep key instead of the
subclass.
Test commands:
ip link add bond0 type bond
ip link add dummy0 type dummy
ip link add macvlan0 link bond0 type macvlan mode bridge
ip link add macvlan1 link dummy0 type macvlan mode bridge
ip link set bond0 mtu 1000
ip link set macvlan1 master bond0
ip link set bond0 up
ip link set macvlan0 up
ip link set dummy0 up
ip link set macvlan1 up
Splat looks like:
[ 165.677603] ============================================
[ 165.679642] WARNING: possible recursive locking detected
[ 165.679642] 5.3.0-rc7+ #322 Not tainted
[ 165.679642] --------------------------------------------
[ 165.679642] ip/1812 is trying to acquire lock:
[ 165.679642] 00000000ae6a8a03 (&macvlan_netdev_addr_lock_key/1){+...}, at: dev_uc_sync_multiple+0xfa/0x1a0
[ 165.679642]
[ 165.679642] but task is already holding lock:
[ 165.679642] 00000000cec5da0b (&macvlan_netdev_addr_lock_key/1){+...}, at: dev_set_rx_mode+0x19/0x30
[ 165.679642]
[ 165.679642] other info that might help us debug this:
[ 165.679642] Possible unsafe locking scenario:
[ 165.679642]
[ 165.679642] CPU0
[ 165.679642] ----
[ 165.679642] lock(&macvlan_netdev_addr_lock_key/1);
[ 165.679642] lock(&macvlan_netdev_addr_lock_key/1);
[ 165.679642]
[ 165.679642] *** DEADLOCK ***
[ 165.679642]
[ 165.679642] May be due to missing lock nesting notation
[ 165.679642]
[ 165.679642] 4 locks held by ip/1812:
[ 165.679642] #0: 0000000088d10bd8 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x466/0x8a0
[ 165.679642] #1: 00000000cec5da0b (&macvlan_netdev_addr_lock_key/1){+...}, at: dev_set_rx_mode+0x19/0x30
[ 165.679642] #2: 000000000ca6fdb5 (&dev_addr_list_lock_key/3){+...}, at: dev_uc_sync+0xfa/0x1a0
[ 165.679642] #3: 00000000dc1495a2 (rcu_read_lock){....}, at: bond_set_rx_mode+0x5/0x3c0 [bonding]
[ 165.679642]
[ 165.679642] stack backtrace:
[ 165.679642] CPU: 1 PID: 1812 Comm: ip Not tainted 5.3.0-rc7+ #322
[ 165.679642] Call Trace:
[ 165.679642] dump_stack+0x7c/0xbb
[ 165.679642] __lock_acquire+0x26a9/0x3de0
[ 165.679642] ? register_lock_class+0x14d0/0x14d0
[ 165.679642] ? mark_held_locks+0xa5/0xe0
[ 165.679642] ? trace_hardirqs_on_thunk+0x1a/0x20
[ 165.679642] ? register_lock_class+0x14d0/0x14d0
[ 165.679642] lock_acquire+0x164/0x3b0
[ 165.679642] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 165.679642] _raw_spin_lock_nested+0x2e/0x60
[ 165.679642] ? dev_uc_sync_multiple+0xfa/0x1a0
[ 165.679642] dev_uc_sync_multiple+0xfa/0x1a0
[ 165.679642] bond_set_rx_mode+0x269/0x3c0 [bonding]
[ 165.679642] ? bond_init+0x6f0/0x6f0 [bonding]
[ 165.679642] dev_uc_sync+0x15a/0x1a0
[ 165.679642] macvlan_set_mac_lists+0x55/0x110 [macvlan]
[ 165.679642] dev_set_rx_mode+0x21/0x30
[ 165.679642] __dev_open+0x202/0x310
[ 165.679642] ? dev_set_rx_mode+0x30/0x30
[ 165.679642] ? mark_held_locks+0xa5/0xe0
[ 165.679642] ? __local_bh_enable_ip+0xe9/0x1b0
[ 165.679642] __dev_change_flags+0x3c3/0x500
[ 165.679642] ? dev_set_allmulti+0x10/0x10
[ 165.679642] dev_change_flags+0x7a/0x160
[ ...]
Fixes: c674ac30c549 ("macvlan: Fix lockdep warnings with stacked macvlan devices")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
drivers/net/macvlan.c | 35 +++++++++++++++++++++++++++--------
include/linux/if_macvlan.h | 2 ++
2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 940192c057b6..dae368a2e8d1 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -852,8 +852,6 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
* "super class" of normal network devices; split their locks off into a
* separate class since they always nest.
*/
-static struct lock_class_key macvlan_netdev_addr_lock_key;
-
#define ALWAYS_ON_OFFLOADS \
(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | \
NETIF_F_GSO_ROBUST | NETIF_F_GSO_ENCAP_ALL)
@@ -874,12 +872,30 @@ static int macvlan_get_nest_level(struct net_device *dev)
return ((struct macvlan_dev *)netdev_priv(dev))->nest_level;
}
-static void macvlan_set_lockdep_class(struct net_device *dev)
+static void macvlan_dev_set_lockdep_one(struct net_device *dev,
+ struct netdev_queue *txq,
+ void *_unused)
+{
+ struct macvlan_dev *macvlan = netdev_priv(dev);
+
+ lockdep_set_class(&txq->_xmit_lock, &macvlan->xmit_lock_key);
+}
+
+static struct lock_class_key qdisc_tx_busylock_key;
+static struct lock_class_key qdisc_running_key;
+
+static void macvlan_dev_set_lockdep_class(struct net_device *dev)
{
- netdev_lockdep_set_classes(dev);
- lockdep_set_class_and_subclass(&dev->addr_list_lock,
- &macvlan_netdev_addr_lock_key,
- macvlan_get_nest_level(dev));
+ struct macvlan_dev *macvlan = netdev_priv(dev);
+
+ dev->qdisc_tx_busylock = &qdisc_tx_busylock_key;
+ dev->qdisc_running_key = &qdisc_running_key;
+
+ lockdep_register_key(&macvlan->addr_lock_key);
+ lockdep_set_class(&dev->addr_list_lock, &macvlan->addr_lock_key);
+
+ lockdep_register_key(&macvlan->xmit_lock_key);
+ netdev_for_each_tx_queue(dev, macvlan_dev_set_lockdep_one, NULL);
}
static int macvlan_init(struct net_device *dev)
@@ -900,7 +916,7 @@ static int macvlan_init(struct net_device *dev)
dev->gso_max_segs = lowerdev->gso_max_segs;
dev->hard_header_len = lowerdev->hard_header_len;
- macvlan_set_lockdep_class(dev);
+ macvlan_dev_set_lockdep_class(dev);
vlan->pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
if (!vlan->pcpu_stats)
@@ -922,6 +938,9 @@ static void macvlan_uninit(struct net_device *dev)
port->count -= 1;
if (!port->count)
macvlan_port_destroy(port->dev);
+
+ lockdep_unregister_key(&vlan->addr_lock_key);
+ lockdep_unregister_key(&vlan->xmit_lock_key);
}
static void macvlan_dev_get_stats64(struct net_device *dev,
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 2e55e4cdbd8a..ea5b41823287 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -31,6 +31,8 @@ struct macvlan_dev {
u16 flags;
int nest_level;
unsigned int macaddr_count;
+ struct lock_class_key xmit_lock_key;
+ struct lock_class_key addr_lock_key;
#ifdef CONFIG_NET_POLL_CONTROLLER
struct netpoll *netpoll;
#endif
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 08/11] macsec: fix refcnt leak in module exit routine
From: Taehee Yoo @ 2019-09-07 13:47 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
When a macsec interface is created, it increases a refcnt to a lower
device(real device). when macsec interface is deleted, the refcnt is
decreased in macsec_free_netdev(), which is ->priv_destructor() of
macsec interface.
The problem scenario is this.
When nested macsec interfaces are exiting, the exit routine of the
macsec module makes refcnt leaks.
Test commands:
ip link add dummy0 type dummy
ip link add macsec0 link dummy0 type macsec
ip link add macsec1 link macsec0 type macsec
modprobe -rv macsec
[ 208.629433] unregister_netdevice: waiting for macsec0 to become free. Usage count = 1
Steps of exit routine of macsec module are below.
1. Calls ->dellink() in __rtnl_link_unregister().
2. Checks refcnt and wait refcnt to be 0 if refcnt is not 0 in
netdev_run_todo().
3. Calls ->priv_destruvtor() in netdev_run_todo().
Step2 checks refcnt, but step3 decreases refcnt.
So, step2 waits forever.
This patch makes the macsec module do not hold a refcnt of the lower
device because it already holds a refcnt of the lower device with
netdev_upper_dev_link().
Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
drivers/net/macsec.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 25a4fc88145d..41ec1ed0d545 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -3031,12 +3031,10 @@ static const struct nla_policy macsec_rtnl_policy[IFLA_MACSEC_MAX + 1] = {
static void macsec_free_netdev(struct net_device *dev)
{
struct macsec_dev *macsec = macsec_priv(dev);
- struct net_device *real_dev = macsec->real_dev;
free_percpu(macsec->stats);
free_percpu(macsec->secy.tx_sc.stats);
- dev_put(real_dev);
}
static void macsec_setup(struct net_device *dev)
@@ -3291,8 +3289,6 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
if (err < 0)
return err;
- dev_hold(real_dev);
-
macsec->nest_level = dev_get_nest_level(real_dev) + 1;
err = netdev_upper_dev_link(real_dev, dev, extack);
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 09/11] net: core: add ignore flag to netdev_adjacent structure
From: Taehee Yoo @ 2019-09-07 13:47 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
In order to link an adjacent node, netdev_upper_dev_link() is used
and in order to unlink an adjacent node, netdev_upper_dev_unlink() is used.
unlink operation does not fail, but link operation can fail.
In order to exchange adjacent nodes, we should unlink an old adjacent
node first. then, link a new adjacent node.
If link operation is failed, we should link an old adjacent node again.
But this link operation can fail too.
It eventually breaks the adjacent link relationship.
This patch adds an ignore flag into the netdev_adjacent structure.
If this flag is set, netdev_upper_dev_link() ignores an old adjacent
node for a moment.
So we can skip unlink operation before link operation.
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
include/linux/netdevice.h | 4 +
net/core/dev.c | 160 +++++++++++++++++++++++++++++++++-----
2 files changed, 144 insertions(+), 20 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5bb5756129af..309ae000bae7 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4319,6 +4319,10 @@ int netdev_master_upper_dev_link(struct net_device *dev,
struct netlink_ext_ack *extack);
void netdev_upper_dev_unlink(struct net_device *dev,
struct net_device *upper_dev);
+void netdev_adjacent_dev_disable(struct net_device *upper_dev,
+ struct net_device *lower_dev);
+void netdev_adjacent_dev_enable(struct net_device *upper_dev,
+ struct net_device *lower_dev);
void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
void *netdev_lower_dev_get_private(struct net_device *dev,
struct net_device *lower_dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index 6a4b4ce62204..ac055b531c96 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6448,6 +6448,9 @@ struct netdev_adjacent {
/* upper master flag, there can only be one master device per list */
bool master;
+ /* lookup ignore flag */
+ bool ignore;
+
/* counter for the number of times this device was added to us */
u16 ref_nr;
@@ -6553,6 +6556,22 @@ struct net_device *netdev_master_upper_dev_get(struct net_device *dev)
}
EXPORT_SYMBOL(netdev_master_upper_dev_get);
+struct net_device *netdev_master_upper_dev_get_ignore(struct net_device *dev)
+{
+ struct netdev_adjacent *upper;
+
+ ASSERT_RTNL();
+
+ if (list_empty(&dev->adj_list.upper))
+ return NULL;
+
+ upper = list_first_entry(&dev->adj_list.upper,
+ struct netdev_adjacent, list);
+ if (likely(upper->master) && !upper->ignore)
+ return upper->dev;
+ return NULL;
+}
+
/**
* netdev_has_any_lower_dev - Check if device is linked to some device
* @dev: device
@@ -6603,8 +6622,9 @@ struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
}
EXPORT_SYMBOL(netdev_upper_get_next_dev_rcu);
-static struct net_device *netdev_next_upper_dev(struct net_device *dev,
- struct list_head **iter)
+static struct net_device *netdev_next_upper_dev_ignore(struct net_device *dev,
+ struct list_head **iter,
+ bool *ignore)
{
struct netdev_adjacent *upper;
@@ -6614,6 +6634,7 @@ static struct net_device *netdev_next_upper_dev(struct net_device *dev,
return NULL;
*iter = &upper->list;
+ *ignore = upper->ignore;
return upper->dev;
}
@@ -6635,26 +6656,29 @@ static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev,
return upper->dev;
}
-int netdev_walk_all_upper_dev(struct net_device *dev,
- int (*fn)(struct net_device *dev,
- void *data),
- void *data)
+int netdev_walk_all_upper_dev_ignore(struct net_device *dev,
+ int (*fn)(struct net_device *dev,
+ void *data),
+ void *data)
{
struct net_device *udev;
struct list_head *iter;
int ret;
+ bool ignore;
for (iter = &dev->adj_list.upper,
- udev = netdev_next_upper_dev(dev, &iter);
+ udev = netdev_next_upper_dev_ignore(dev, &iter, &ignore);
udev;
- udev = netdev_next_upper_dev(dev, &iter)) {
+ udev = netdev_next_upper_dev_ignore(dev, &iter, &ignore)) {
+ if (ignore)
+ continue;
/* first is the upper device itself */
ret = fn(udev, data);
if (ret)
return ret;
/* then look at all of its upper devices */
- ret = netdev_walk_all_upper_dev(udev, fn, data);
+ ret = netdev_walk_all_upper_dev_ignore(udev, fn, data);
if (ret)
return ret;
}
@@ -6690,6 +6714,15 @@ int netdev_walk_all_upper_dev_rcu(struct net_device *dev,
}
EXPORT_SYMBOL_GPL(netdev_walk_all_upper_dev_rcu);
+bool netdev_has_upper_dev_ignore(struct net_device *dev,
+ struct net_device *upper_dev)
+{
+ ASSERT_RTNL();
+
+ return netdev_walk_all_upper_dev_ignore(dev, __netdev_has_upper_dev,
+ upper_dev);
+}
+
/**
* netdev_lower_get_next_private - Get the next ->private from the
* lower neighbour list
@@ -6786,6 +6819,23 @@ static struct net_device *netdev_next_lower_dev(struct net_device *dev,
return lower->dev;
}
+static struct net_device *netdev_next_lower_dev_ignore(struct net_device *dev,
+ struct list_head **iter,
+ bool *ignore)
+{
+ struct netdev_adjacent *lower;
+
+ lower = list_entry((*iter)->next, struct netdev_adjacent, list);
+
+ if (&lower->list == &dev->adj_list.lower)
+ return NULL;
+
+ *iter = &lower->list;
+ *ignore = lower->ignore;
+
+ return lower->dev;
+}
+
int netdev_walk_all_lower_dev(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
@@ -6814,6 +6864,36 @@ int netdev_walk_all_lower_dev(struct net_device *dev,
}
EXPORT_SYMBOL_GPL(netdev_walk_all_lower_dev);
+int netdev_walk_all_lower_dev_ignore(struct net_device *dev,
+ int (*fn)(struct net_device *dev,
+ void *data),
+ void *data)
+{
+ struct net_device *ldev;
+ struct list_head *iter;
+ int ret;
+ bool ignore;
+
+ for (iter = &dev->adj_list.lower,
+ ldev = netdev_next_lower_dev_ignore(dev, &iter, &ignore);
+ ldev;
+ ldev = netdev_next_lower_dev_ignore(dev, &iter, &ignore)) {
+ if (ignore)
+ continue;
+ /* first is the lower device itself */
+ ret = fn(ldev, data);
+ if (ret)
+ return ret;
+
+ /* then look at all of its lower devices */
+ ret = netdev_walk_all_lower_dev_ignore(ldev, fn, data);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev,
struct list_head **iter)
{
@@ -6833,11 +6913,14 @@ static u8 __netdev_upper_depth(struct net_device *dev)
struct net_device *udev;
struct list_head *iter;
u8 max_depth = 0;
+ bool ignore;
for (iter = &dev->adj_list.upper,
- udev = netdev_next_upper_dev(dev, &iter);
+ udev = netdev_next_upper_dev_ignore(dev, &iter, &ignore);
udev;
- udev = netdev_next_upper_dev(dev, &iter)) {
+ udev = netdev_next_upper_dev_ignore(dev, &iter, &ignore)) {
+ if (ignore)
+ continue;
if (max_depth < udev->upper_level)
max_depth = udev->upper_level;
}
@@ -6850,11 +6933,14 @@ static u8 __netdev_lower_depth(struct net_device *dev)
struct net_device *ldev;
struct list_head *iter;
u8 max_depth = 0;
+ bool ignore;
for (iter = &dev->adj_list.lower,
- ldev = netdev_next_lower_dev(dev, &iter);
+ ldev = netdev_next_lower_dev_ignore(dev, &iter, &ignore);
ldev;
- ldev = netdev_next_lower_dev(dev, &iter)) {
+ ldev = netdev_next_lower_dev_ignore(dev, &iter, &ignore)) {
+ if (ignore)
+ continue;
if (max_depth < ldev->lower_level)
max_depth = ldev->lower_level;
}
@@ -6999,6 +7085,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
adj->master = master;
adj->ref_nr = 1;
adj->private = private;
+ adj->ignore = false;
dev_hold(adj_dev);
pr_debug("Insert adjacency: dev %s adj_dev %s adj->ref_nr %d; dev_hold on %s\n",
@@ -7149,17 +7236,17 @@ static int __netdev_upper_dev_link(struct net_device *dev,
return -EBUSY;
/* To prevent loops, check if dev is not upper device to upper_dev. */
- if (netdev_has_upper_dev(upper_dev, dev))
+ if (netdev_has_upper_dev_ignore(upper_dev, dev))
return -EBUSY;
if ((dev->lower_level + upper_dev->upper_level) > MAX_NEST_DEV)
return -EMLINK;
if (!master) {
- if (netdev_has_upper_dev(dev, upper_dev))
+ if (netdev_has_upper_dev_ignore(dev, upper_dev))
return -EEXIST;
} else {
- master_dev = netdev_master_upper_dev_get(dev);
+ master_dev = netdev_master_upper_dev_get_ignore(dev);
if (master_dev)
return master_dev == upper_dev ? -EEXIST : -EBUSY;
}
@@ -7182,10 +7269,12 @@ static int __netdev_upper_dev_link(struct net_device *dev,
goto rollback;
__netdev_update_upper_level(dev, NULL);
- netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL);
+ netdev_walk_all_lower_dev_ignore(dev, __netdev_update_upper_level,
+ NULL);
__netdev_update_lower_level(upper_dev, NULL);
- netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, NULL);
+ netdev_walk_all_upper_dev_ignore(upper_dev,
+ __netdev_update_lower_level, NULL);
return 0;
@@ -7271,13 +7360,44 @@ void netdev_upper_dev_unlink(struct net_device *dev,
&changeupper_info.info);
__netdev_update_upper_level(dev, NULL);
- netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL);
+ netdev_walk_all_lower_dev_ignore(dev, __netdev_update_upper_level,
+ NULL);
__netdev_update_lower_level(upper_dev, NULL);
- netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, NULL);
+ netdev_walk_all_upper_dev_ignore(upper_dev,
+ __netdev_update_lower_level, NULL);
}
EXPORT_SYMBOL(netdev_upper_dev_unlink);
+void __netdev_adjacent_dev_set(struct net_device *upper_dev,
+ struct net_device *lower_dev,
+ bool val)
+{
+ struct netdev_adjacent *adj;
+
+ adj = __netdev_find_adj(lower_dev, &upper_dev->adj_list.lower);
+ if (adj)
+ adj->ignore = val;
+
+ adj = __netdev_find_adj(upper_dev, &lower_dev->adj_list.upper);
+ if (adj)
+ adj->ignore = val;
+}
+
+void netdev_adjacent_dev_disable(struct net_device *upper_dev,
+ struct net_device *lower_dev)
+{
+ __netdev_adjacent_dev_set(upper_dev, lower_dev, true);
+}
+EXPORT_SYMBOL(netdev_adjacent_dev_disable);
+
+void netdev_adjacent_dev_enable(struct net_device *upper_dev,
+ struct net_device *lower_dev)
+{
+ __netdev_adjacent_dev_set(upper_dev, lower_dev, false);
+}
+EXPORT_SYMBOL(netdev_adjacent_dev_enable);
+
/**
* netdev_bonding_info_change - Dispatch event about slave change
* @dev: device
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 10/11] vxlan: add adjacent link to limit depth level
From: Taehee Yoo @ 2019-09-07 13:47 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
Current vxlan code doesn't limit the number of nested devices.
Nested devices would be handled recursively and this routine needs
huge stack memory. So, unlimited nested devices could make
stack overflow.
In order to fix this issue, this patch adds adjacent links.
The adjacent link APIs internally check the depth level.
Test commands:
ip link add dummy0 type dummy
ip link add vxlan0 type vxlan id 0 group 239.1.1.1 dev dummy0 \
dstport 4789
for i in {1..100}
do
let A=$i-1
ip link add vxlan$i type vxlan id $i group 239.1.1.1 \
dev vxlan$A dstport 4789
done
ip link del dummy0
The top upper link is vxlan100 and the lowest link is vxlan0.
When vxlan0 is deleting, the upper devices will be deleted recursively.
It needs huge stack memory so it makes stack overflow.
Splat looks like:
[ 229.628477] =============================================================================
[ 229.629785] BUG page->ptl (Not tainted): Padding overwritten. 0x0000000026abf214-0x0000000091f6abb2
[ 229.629785] -----------------------------------------------------------------------------
[ 229.629785]
[ 229.655439] ==================================================================
[ 229.629785] INFO: Slab 0x00000000ff7cfda8 objects=19 used=19 fp=0x00000000fe33776c flags=0x200000000010200
[ 229.655688] BUG: KASAN: stack-out-of-bounds in unmap_single_vma+0x25a/0x2e0
[ 229.655688] Read of size 8 at addr ffff888113076928 by task vlan-network-in/2334
[ 229.655688]
[ 229.629785] Padding 0000000026abf214: 00 80 14 0d 81 88 ff ff 68 91 81 14 81 88 ff ff ........h.......
[ 229.629785] Padding 0000000001e24790: 38 91 81 14 81 88 ff ff 68 91 81 14 81 88 ff ff 8.......h.......
[ 229.629785] Padding 00000000b39397c8: 33 30 62 a7 ff ff ff ff ff eb 60 22 10 f1 ff 1f 30b.......`"....
[ 229.629785] Padding 00000000bc98f53a: 80 60 07 13 81 88 ff ff 00 80 14 0d 81 88 ff ff .`..............
[ 229.629785] Padding 000000002aa8123d: 68 91 81 14 81 88 ff ff f7 21 17 a7 ff ff ff ff h........!......
[ 229.629785] Padding 000000001c8c2369: 08 81 14 0d 81 88 ff ff 03 02 00 00 00 00 00 00 ................
[ 229.629785] Padding 000000004e290c5d: 21 90 a2 21 10 ed ff ff 00 00 00 00 00 fc ff df !..!............
[ 229.629785] Padding 000000000e25d731: 18 60 07 13 81 88 ff ff c0 8b 13 05 81 88 ff ff .`..............
[ 229.629785] Padding 000000007adc7ab3: b3 8a b5 41 00 00 00 00 ...A....
[ 229.629785] FIX page->ptl: Restoring 0x0000000026abf214-0x0000000091f6abb2=0x5a
[ ... ]
Fixes: acaf4e70997f ("net: vxlan: when lower dev unregisters remove vxlan dev as well")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
drivers/net/vxlan.c | 71 ++++++++++++++++++++++++++++++++++++++-------
include/net/vxlan.h | 1 +
2 files changed, 62 insertions(+), 10 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3d9bcc957f7d..0d5c8d22d8a4 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3567,6 +3567,8 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
struct vxlan_dev *vxlan = netdev_priv(dev);
struct vxlan_fdb *f = NULL;
+ struct net_device *remote_dev = NULL;
+ struct vxlan_rdst *dst = &vxlan->default_dst;
bool unregister = false;
int err;
@@ -3577,14 +3579,14 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
dev->ethtool_ops = &vxlan_ethtool_ops;
/* create an fdb entry for a valid default destination */
- if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
+ if (!vxlan_addr_any(&dst->remote_ip)) {
err = vxlan_fdb_create(vxlan, all_zeros_mac,
- &vxlan->default_dst.remote_ip,
+ &dst->remote_ip,
NUD_REACHABLE | NUD_PERMANENT,
vxlan->cfg.dst_port,
- vxlan->default_dst.remote_vni,
- vxlan->default_dst.remote_vni,
- vxlan->default_dst.remote_ifindex,
+ dst->remote_vni,
+ dst->remote_vni,
+ dst->remote_ifindex,
NTF_SELF, &f);
if (err)
return err;
@@ -3595,26 +3597,43 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
goto errout;
unregister = true;
+ if (dst->remote_ifindex) {
+ remote_dev = __dev_get_by_index(net, dst->remote_ifindex);
+ if (!remote_dev)
+ goto errout;
+
+ err = netdev_upper_dev_link(remote_dev, dev, extack);
+ if (err)
+ goto errout;
+ }
+
err = rtnl_configure_link(dev, NULL);
if (err)
- goto errout;
+ goto unlink;
if (f) {
- vxlan_fdb_insert(vxlan, all_zeros_mac,
- vxlan->default_dst.remote_vni, f);
+ vxlan_fdb_insert(vxlan, all_zeros_mac, dst->remote_vni, f);
/* notify default fdb entry */
err = vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f),
RTM_NEWNEIGH, true, extack);
if (err) {
vxlan_fdb_destroy(vxlan, f, false, false);
+ if (remote_dev)
+ netdev_upper_dev_unlink(remote_dev, dev);
goto unregister;
}
}
list_add(&vxlan->next, &vn->vxlan_list);
+ if (remote_dev) {
+ dst->remote_dev = remote_dev;
+ dev_hold(remote_dev);
+ }
return 0;
-
+unlink:
+ if (remote_dev)
+ netdev_upper_dev_unlink(remote_dev, dev);
errout:
/* unregister_netdevice() destroys the default FDB entry with deletion
* notification. But the addition notification was not sent yet, so
@@ -3936,6 +3955,8 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
struct net_device *lowerdev;
struct vxlan_config conf;
int err;
+ bool linked = false;
+ bool disabled = false;
err = vxlan_nl2conf(tb, data, dev, &conf, true, extack);
if (err)
@@ -3946,6 +3967,16 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
if (err)
return err;
+ if (lowerdev) {
+ if (dst->remote_dev && lowerdev != dst->remote_dev) {
+ netdev_adjacent_dev_disable(dst->remote_dev, dev);
+ disabled = true;
+ }
+ err = netdev_upper_dev_link(lowerdev, dev, extack);
+ if (err)
+ goto err;
+ linked = true;
+ }
/* handle default dst entry */
if (!vxlan_addr_equal(&conf.remote_ip, &dst->remote_ip)) {
u32 hash_index = fdb_head_index(vxlan, all_zeros_mac, conf.vni);
@@ -3962,7 +3993,7 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
NTF_SELF, true, extack);
if (err) {
spin_unlock_bh(&vxlan->hash_lock[hash_index]);
- return err;
+ goto err;
}
}
if (!vxlan_addr_any(&dst->remote_ip))
@@ -3979,8 +4010,24 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
if (conf.age_interval != vxlan->cfg.age_interval)
mod_timer(&vxlan->age_timer, jiffies);
+ if (disabled) {
+ netdev_adjacent_dev_enable(dst->remote_dev, dev);
+ netdev_upper_dev_unlink(dst->remote_dev, dev);
+ dev_put(dst->remote_dev);
+ }
+ if (linked) {
+ dst->remote_dev = lowerdev;
+ dev_hold(dst->remote_dev);
+ }
+
vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true);
return 0;
+err:
+ if (linked)
+ netdev_upper_dev_unlink(lowerdev, dev);
+ if (disabled)
+ netdev_adjacent_dev_enable(dst->remote_dev, dev);
+ return err;
}
static void vxlan_dellink(struct net_device *dev, struct list_head *head)
@@ -3991,6 +4038,10 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head)
list_del(&vxlan->next);
unregister_netdevice_queue(dev, head);
+ if (vxlan->default_dst.remote_dev) {
+ netdev_upper_dev_unlink(vxlan->default_dst.remote_dev, dev);
+ dev_put(vxlan->default_dst.remote_dev);
+ }
}
static size_t vxlan_get_size(const struct net_device *dev)
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index dc1583a1fb8a..08e237d7aa73 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -197,6 +197,7 @@ struct vxlan_rdst {
u8 offloaded:1;
__be32 remote_vni;
u32 remote_ifindex;
+ struct net_device *remote_dev;
struct list_head list;
struct rcu_head rcu;
struct dst_cache dst_cache;
--
2.17.1
^ permalink raw reply related
* Re: [PATCH] net/hamradio/6pack: Fix the size of a sk_buff used in 'sp_bump()'
From: David Miller @ 2019-09-07 13:48 UTC (permalink / raw)
To: christophe.jaillet; +Cc: ajk, linux-hams, netdev, linux-kernel, kernel-janitors
In-Reply-To: <20190826190209.16795-1-christophe.jaillet@wanadoo.fr>
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Mon, 26 Aug 2019 21:02:09 +0200
> We 'allocate' 'count' bytes here. In fact, 'dev_alloc_skb' already add some
> extra space for padding, so a bit more is allocated.
>
> However, we use 1 byte for the KISS command, then copy 'count' bytes, so
> count+1 bytes.
>
> Explicitly allocate and use 1 more byte to be safe.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
I applied your patch as-is, as it is correct and doesn't change the contents
of the data put into the SKB at all.
->rcount is the cooked count minus two, but then we copy effectively
cooked count minus one bytes from one byte past the beginning of the
cooked buffer and so all the accesses are in range on the input buffer
side.
^ permalink raw reply
* [PATCH net v2 11/11] net: remove unnecessary variables and callback
From: Taehee Yoo @ 2019-09-07 13:48 UTC (permalink / raw)
To: davem, netdev, j.vosburgh, vfalico, andy, jiri, sd, roopa, saeedm,
manishc, rahulv, kys, haiyangz, sthemmin, sashal, hare, varun,
ubraun, kgraul, jay.vosburgh
Cc: ap420073
This patch removes variables and callback these are related to the nested
device structure.
devices that can be nested have their own nest_level variable that
represents the depth of nested devices.
In the previous patch, new {lower/upper}_level variables are added and
they replace old private nest_level variable.
So, this patch removes all 'nest_level' variables.
In order to avoid lockdep warning, ->ndo_get_lock_subclass() was added
to get lockdep subclass value, which is actually lower nested depth value.
But now, they use the dynamic lockdep key to avoid lockdep warning instead
of the subclass.
So, this patch removes ->ndo_get_lock_subclass() callback.
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
v1 -> v2 : this patch isn't changed
drivers/net/bonding/bond_alb.c | 2 +-
drivers/net/bonding/bond_main.c | 14 -------------
.../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +-
drivers/net/macsec.c | 9 ---------
drivers/net/macvlan.c | 7 -------
include/linux/if_macvlan.h | 1 -
include/linux/if_vlan.h | 12 -----------
include/linux/netdevice.h | 12 -----------
include/net/bonding.h | 1 -
net/8021q/vlan.c | 1 -
net/8021q/vlan_dev.c | 6 ------
net/core/dev.c | 20 -------------------
net/core/dev_addr_lists.c | 12 +++++------
net/smc/smc_core.c | 2 +-
net/smc/smc_pnet.c | 2 +-
15 files changed, 10 insertions(+), 93 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 8c79bad2a9a5..4f2e6910c623 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -952,7 +952,7 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data)
struct bond_vlan_tag *tags;
if (is_vlan_dev(upper) &&
- bond->nest_level == vlan_get_encap_level(upper) - 1) {
+ bond->dev->lower_level == upper->lower_level - 1) {
if (upper->addr_assign_type == NET_ADDR_STOLEN) {
alb_send_lp_vid(slave, mac_addr,
vlan_dev_vlan_proto(upper),
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7f574e74ed78..69eb61466fbe 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1733,8 +1733,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
goto err_upper_unlink;
}
- bond->nest_level = dev_get_nest_level(bond_dev) + 1;
-
/* If the mode uses primary, then the following is handled by
* bond_change_active_slave().
*/
@@ -1983,9 +1981,6 @@ static int __bond_release_one(struct net_device *bond_dev,
if (!bond_has_slaves(bond)) {
bond_set_carrier(bond);
eth_hw_addr_random(bond_dev);
- bond->nest_level = SINGLE_DEPTH_NESTING;
- } else {
- bond->nest_level = dev_get_nest_level(bond_dev) + 1;
}
unblock_netpoll_tx();
@@ -3472,13 +3467,6 @@ static void bond_fold_stats(struct rtnl_link_stats64 *_res,
}
}
-static int bond_get_nest_level(struct net_device *bond_dev)
-{
- struct bonding *bond = netdev_priv(bond_dev);
-
- return bond->nest_level;
-}
-
static void bond_get_stats(struct net_device *bond_dev,
struct rtnl_link_stats64 *stats)
{
@@ -4298,7 +4286,6 @@ static const struct net_device_ops bond_netdev_ops = {
.ndo_neigh_setup = bond_neigh_setup,
.ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,
- .ndo_get_lock_subclass = bond_get_nest_level,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_netpoll_setup = bond_netpoll_setup,
.ndo_netpoll_cleanup = bond_netpoll_cleanup,
@@ -4822,7 +4809,6 @@ static int bond_init(struct net_device *bond_dev)
if (!bond->wq)
return -ENOMEM;
- bond->nest_level = SINGLE_DEPTH_NESTING;
bond_dev_set_lockdep_class(bond_dev);
list_add_tail(&bond->bond_list, &bn->dev_list);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 00b2d4a86159..e056f9aad8df 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2797,7 +2797,7 @@ static int add_vlan_pop_action(struct mlx5e_priv *priv,
struct mlx5_esw_flow_attr *attr,
u32 *action)
{
- int nest_level = vlan_get_encap_level(attr->parse_attr->filter_dev);
+ int nest_level = attr->parse_attr->filter_dev->lower_level;
struct flow_action_entry vlan_act = {
.id = FLOW_ACTION_VLAN_POP,
};
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 41ec1ed0d545..c0cb595f2bba 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -269,7 +269,6 @@ struct macsec_dev {
struct gro_cells gro_cells;
struct lock_class_key xmit_lock_key;
struct lock_class_key addr_lock_key;
- unsigned int nest_level;
};
/**
@@ -2988,11 +2987,6 @@ static int macsec_get_iflink(const struct net_device *dev)
return macsec_priv(dev)->real_dev->ifindex;
}
-static int macsec_get_nest_level(struct net_device *dev)
-{
- return macsec_priv(dev)->nest_level;
-}
-
static const struct net_device_ops macsec_netdev_ops = {
.ndo_init = macsec_dev_init,
.ndo_uninit = macsec_dev_uninit,
@@ -3006,7 +3000,6 @@ static const struct net_device_ops macsec_netdev_ops = {
.ndo_start_xmit = macsec_start_xmit,
.ndo_get_stats64 = macsec_get_stats64,
.ndo_get_iflink = macsec_get_iflink,
- .ndo_get_lock_subclass = macsec_get_nest_level,
};
static const struct device_type macsec_type = {
@@ -3289,8 +3282,6 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
if (err < 0)
return err;
- macsec->nest_level = dev_get_nest_level(real_dev) + 1;
-
err = netdev_upper_dev_link(real_dev, dev, extack);
if (err < 0)
goto unregister;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index dae368a2e8d1..2c14bc606514 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -867,11 +867,6 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
#define MACVLAN_STATE_MASK \
((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
-static int macvlan_get_nest_level(struct net_device *dev)
-{
- return ((struct macvlan_dev *)netdev_priv(dev))->nest_level;
-}
-
static void macvlan_dev_set_lockdep_one(struct net_device *dev,
struct netdev_queue *txq,
void *_unused)
@@ -1180,7 +1175,6 @@ static const struct net_device_ops macvlan_netdev_ops = {
.ndo_fdb_add = macvlan_fdb_add,
.ndo_fdb_del = macvlan_fdb_del,
.ndo_fdb_dump = ndo_dflt_fdb_dump,
- .ndo_get_lock_subclass = macvlan_get_nest_level,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = macvlan_dev_poll_controller,
.ndo_netpoll_setup = macvlan_dev_netpoll_setup,
@@ -1464,7 +1458,6 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
vlan->dev = dev;
vlan->port = port;
vlan->set_features = MACVLAN_FEATURES;
- vlan->nest_level = dev_get_nest_level(lowerdev) + 1;
vlan->mode = MACVLAN_MODE_VEPA;
if (data && data[IFLA_MACVLAN_MODE])
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index ea5b41823287..e9202edcf101 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -29,7 +29,6 @@ struct macvlan_dev {
netdev_features_t set_features;
enum macvlan_mode mode;
u16 flags;
- int nest_level;
unsigned int macaddr_count;
struct lock_class_key xmit_lock_key;
struct lock_class_key addr_lock_key;
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 1aed9f613e90..6f30284a58e5 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -182,8 +182,6 @@ struct vlan_dev_priv {
#ifdef CONFIG_NET_POLL_CONTROLLER
struct netpoll *netpoll;
#endif
- unsigned int nest_level;
-
struct lock_class_key xmit_lock_key;
struct lock_class_key addr_lock_key;
};
@@ -224,11 +222,6 @@ extern void vlan_vids_del_by_dev(struct net_device *dev,
extern bool vlan_uses_dev(const struct net_device *dev);
-static inline int vlan_get_encap_level(struct net_device *dev)
-{
- BUG_ON(!is_vlan_dev(dev));
- return vlan_dev_priv(dev)->nest_level;
-}
#else
static inline struct net_device *
__vlan_find_dev_deep_rcu(struct net_device *real_dev,
@@ -298,11 +291,6 @@ static inline bool vlan_uses_dev(const struct net_device *dev)
{
return false;
}
-static inline int vlan_get_encap_level(struct net_device *dev)
-{
- BUG();
- return 0;
-}
#endif
/**
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 309ae000bae7..e13db714ee85 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1408,7 +1408,6 @@ struct net_device_ops {
void (*ndo_dfwd_del_station)(struct net_device *pdev,
void *priv);
- int (*ndo_get_lock_subclass)(struct net_device *dev);
int (*ndo_set_tx_maxrate)(struct net_device *dev,
int queue_index,
u32 maxrate);
@@ -4047,16 +4046,6 @@ static inline void netif_addr_lock(struct net_device *dev)
spin_lock(&dev->addr_list_lock);
}
-static inline void netif_addr_lock_nested(struct net_device *dev)
-{
- int subclass = SINGLE_DEPTH_NESTING;
-
- if (dev->netdev_ops->ndo_get_lock_subclass)
- subclass = dev->netdev_ops->ndo_get_lock_subclass(dev);
-
- spin_lock_nested(&dev->addr_list_lock, subclass);
-}
-
static inline void netif_addr_lock_bh(struct net_device *dev)
{
spin_lock_bh(&dev->addr_list_lock);
@@ -4334,7 +4323,6 @@ void netdev_lower_state_changed(struct net_device *lower_dev,
extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly;
void netdev_rss_key_fill(void *buffer, size_t len);
-int dev_get_nest_level(struct net_device *dev);
int skb_checksum_help(struct sk_buff *skb);
int skb_crc32c_csum_help(struct sk_buff *skb);
int skb_csum_hwoffload_help(struct sk_buff *skb,
diff --git a/include/net/bonding.h b/include/net/bonding.h
index c39ac7061e41..74f41dd73866 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -203,7 +203,6 @@ struct bonding {
struct slave __rcu *primary_slave;
struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */
bool force_primary;
- u32 nest_level;
s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
int (*recv_probe)(const struct sk_buff *, struct bonding *,
struct slave *);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 54728d2eda18..d4bcfd8f95bf 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -172,7 +172,6 @@ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack)
if (err < 0)
goto out_uninit_mvrp;
- vlan->nest_level = dev_get_nest_level(real_dev) + 1;
err = register_netdevice(dev);
if (err < 0)
goto out_uninit_mvrp;
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 12bc80650087..e8707827540c 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -514,11 +514,6 @@ static void vlan_dev_set_lockdep_class(struct net_device *dev)
netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, NULL);
}
-static int vlan_dev_get_lock_subclass(struct net_device *dev)
-{
- return vlan_dev_priv(dev)->nest_level;
-}
-
static const struct header_ops vlan_header_ops = {
.create = vlan_dev_hard_header,
.parse = eth_header_parse,
@@ -814,7 +809,6 @@ static const struct net_device_ops vlan_netdev_ops = {
.ndo_netpoll_cleanup = vlan_dev_netpoll_cleanup,
#endif
.ndo_fix_features = vlan_dev_fix_features,
- .ndo_get_lock_subclass = vlan_dev_get_lock_subclass,
.ndo_get_iflink = vlan_dev_get_iflink,
};
diff --git a/net/core/dev.c b/net/core/dev.c
index ac055b531c96..73a69a7a3553 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7510,26 +7510,6 @@ void *netdev_lower_dev_get_private(struct net_device *dev,
}
EXPORT_SYMBOL(netdev_lower_dev_get_private);
-
-int dev_get_nest_level(struct net_device *dev)
-{
- struct net_device *lower = NULL;
- struct list_head *iter;
- int max_nest = -1;
- int nest;
-
- ASSERT_RTNL();
-
- netdev_for_each_lower_dev(dev, lower, iter) {
- nest = dev_get_nest_level(lower);
- if (max_nest < nest)
- max_nest = nest;
- }
-
- return max_nest + 1;
-}
-EXPORT_SYMBOL(dev_get_nest_level);
-
/**
* netdev_lower_change - Dispatch event about lower device state change
* @lower_dev: device
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index 6393ba930097..2f949b5a1eb9 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -637,7 +637,7 @@ int dev_uc_sync(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len)
return -EINVAL;
- netif_addr_lock_nested(to);
+ netif_addr_lock(to);
err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len);
if (!err)
__dev_set_rx_mode(to);
@@ -667,7 +667,7 @@ int dev_uc_sync_multiple(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len)
return -EINVAL;
- netif_addr_lock_nested(to);
+ netif_addr_lock(to);
err = __hw_addr_sync_multiple(&to->uc, &from->uc, to->addr_len);
if (!err)
__dev_set_rx_mode(to);
@@ -691,7 +691,7 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from)
return;
netif_addr_lock_bh(from);
- netif_addr_lock_nested(to);
+ netif_addr_lock(to);
__hw_addr_unsync(&to->uc, &from->uc, to->addr_len);
__dev_set_rx_mode(to);
netif_addr_unlock(to);
@@ -858,7 +858,7 @@ int dev_mc_sync(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len)
return -EINVAL;
- netif_addr_lock_nested(to);
+ netif_addr_lock(to);
err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len);
if (!err)
__dev_set_rx_mode(to);
@@ -888,7 +888,7 @@ int dev_mc_sync_multiple(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len)
return -EINVAL;
- netif_addr_lock_nested(to);
+ netif_addr_lock(to);
err = __hw_addr_sync_multiple(&to->mc, &from->mc, to->addr_len);
if (!err)
__dev_set_rx_mode(to);
@@ -912,7 +912,7 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
return;
netif_addr_lock_bh(from);
- netif_addr_lock_nested(to);
+ netif_addr_lock(to);
__hw_addr_unsync(&to->mc, &from->mc, to->addr_len);
__dev_set_rx_mode(to);
netif_addr_unlock(to);
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 4ca50ddf8d16..a2e91b8d04b3 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -558,7 +558,7 @@ int smc_vlan_by_tcpsk(struct socket *clcsock, struct smc_init_info *ini)
}
rtnl_lock();
- nest_lvl = dev_get_nest_level(ndev);
+ nest_lvl = ndev->lower_level;
for (i = 0; i < nest_lvl; i++) {
struct list_head *lower = &ndev->adj_list.lower;
diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c
index bab2da8cf17a..2920b006f65c 100644
--- a/net/smc/smc_pnet.c
+++ b/net/smc/smc_pnet.c
@@ -718,7 +718,7 @@ static struct net_device *pnet_find_base_ndev(struct net_device *ndev)
int i, nest_lvl;
rtnl_lock();
- nest_lvl = dev_get_nest_level(ndev);
+ nest_lvl = ndev->lower_level;
for (i = 0; i < nest_lvl; i++) {
struct list_head *lower = &ndev->adj_list.lower;
--
2.17.1
^ permalink raw reply related
* Re: [PATCH v3] ipv6: Not to probe neighbourless routes
From: David Miller @ 2019-09-07 13:54 UTC (permalink / raw)
To: wang.yi59
Cc: kuznet, yoshfuji, netdev, linux-kernel, xue.zhihong, wang.liang82,
cheng.lin130
In-Reply-To: <1567145476-33802-1-git-send-email-wang.yi59@zte.com.cn>
From: Cheng Lin <wang.yi59@zte.com.cn>
Date: Fri, 30 Aug 2019 14:11:16 +0800
> Originally, Router Reachability Probing require a neighbour entry
> existed. Commit 2152caea7196 ("ipv6: Do not depend on rt->n in
> rt6_probe().") removed the requirement for a neighbour entry. And
> commit f547fac624be ("ipv6: rate-limit probes for neighbourless
> routes") adds rate-limiting for neighbourless routes.
I am not going to apply this patch.
The reason we handle neighbourless routes is because due to the
disconnect between routes and neighbour entries, we would lose
information with your suggested change.
Originally, all routes held a reference to a neighbour entry.
Therefore we'd always have a neigh entry for any neigh message
matching a route.
But these two object pools (routes and neigh entries) are completely
disconnected. We only look up a neigh entry when sending a packet
on behalf of a route.
Therfore, neigh entries can be purged arbitrarily even if hundreds of
routes refer to them. And this means it is very important to accept
and process probes even for neighbourless routes.
I would also not recommend, in the future, reading RFC requirements
literally without taking into consideration the details of Linux's
specific implementation of ipv6 routing and neighbours.
Thank you.
^ permalink raw reply
* Re: [PATCH v1 net-next 00/15] tc-taprio offload for SJA1105 DSA
From: David Miller @ 2019-09-07 13:55 UTC (permalink / raw)
To: olteanv
Cc: f.fainelli, vivien.didelot, andrew, vinicius.gomes, vedang.patel,
richardcochran, weifeng.voon, jiri, m-karicheri2, Jose.Abreu,
ilias.apalodimas, jhs, xiyou.wangcong, kurt.kanzenbach, netdev
In-Reply-To: <20190902162544.24613-1-olteanv@gmail.com>
This is a warning that I will toss this patch series if it receives no series
review in the next couple of days.
Thank you.
^ 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