5.15.152-rc1 review
Subsystems (2)
Sasha Levin
maintainercover 5.15.152-rc1 review
This is the start of the stable review cycle for the 5.15.152 release. There are 76 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Mar 15 04:42:22 PM UTC 2024. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.151
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
and the diffstat can be found below.
Thanks,
Sasha
-------------
Pseudo-Shortlog of commits:
Ansuel Smith (1):
regmap: allow to define reg_update_bits for no bus configuration
Christophe Kerello (1):
mmc: mmci: stm32: fix DMA API overlapping mappings warning
Christos Skevis (1):
ALSA: usb-audio: Fix microphone sound on Nexigo webcam.
Cosmin Tanislav (3):
serial: max310x: use regmap methods for SPI batch operations
serial: max310x: use a separate regmap for each port
serial: max310x: make accessing revision id interface-agnostic
Edward Adam Davis (1):
net/rds: fix WARNING in rds_conn_connect_if_down
Eric Dumazet (2):
geneve: make sure to pull inner header in geneve_rx() net/ipv6: avoid possible UAF in ip6_route_mpath_notify()
Evan Quan (1):
drm/amd/pm: do not expose the API used internally only in kv_dpm.c
Florian Westphal (1):
netfilter: nft_ct: fix l3num expectations with inet pseudo family
Friedrich Vock (1):
drm/amdgpu: Reset IH OVERFLOW_CLEAR bit
Gao Xiang (1):
erofs: apply proper VMA alignment for memory mapped files on THP
Horatiu Vultur (1):
net: sparx5: Fix use after free inside sparx5_del_mact_entry
Hugo Villeneuve (1):
serial: max310x: prevent infinite while() loop in port startup
Hui Zhou (1):
nfp: flower: add hardware offload check for post ct entry
Ingo Molnar (1):
exit: Fix typo in comment: s/sub-theads/sub-threads
Isabella Basso (1):
drm/amd/display: move calcs folder into DML
Jan Kundrát (1):
serial: max310x: fix IO data corruption in batched operations
Jaroslav Kysela (2):
ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless
ALSA: usb-audio: Always initialize fixed_rate in
snd_usb_find_implicit_fb_sync_format()
Jason Xing (12):
netrom: Fix a data-race around sysctl_netrom_default_path_quality
netrom: Fix a data-race around
sysctl_netrom_obsolescence_count_initialiser
netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser
netrom: Fix a data-race around sysctl_netrom_transport_timeout
netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries
netrom: Fix a data-race around
sysctl_netrom_transport_acknowledge_delay
netrom: Fix a data-race around sysctl_netrom_transport_busy_delay
netrom: Fix a data-race around
sysctl_netrom_transport_requested_window_size
netrom: Fix a data-race around
sysctl_netrom_transport_no_activity_timeout
netrom: Fix a data-race around sysctl_netrom_routing_control
netrom: Fix a data-race around sysctl_netrom_link_fails_count
netrom: Fix data-races around sysctl_net_busy_read
John Keeping (1):
ALSA: usb-audio: Add quirk for Tascam Model 12
Juhee Kang (1):
hv_netvsc: use netif_is_bond_master() instead of open code
Kees Cook (1):
proc: Use task_is_running() for wchan in /proc/$pid/stat
Lena Wang (1):
netfilter: nf_conntrack_h323: Add protection for bmp length out of
range
Maciej Fijalkowski (2):
ixgbe: {dis, en}able irqs in ixgbe_txrx_ring_{dis, en}able
i40e: disable NAPI right after disabling irqs when handling xsk_pool
Magali Lemes (1):
drm/amd/display: remove DML Makefile duplicate lines
Marek Vasut (1):
regmap: Add bulk read/write callbacks into regmap_config
Mathias Nyman (1):
xhci: process isoc TD properly when there was a transaction error mid
TD.
Matthieu Baerts (NGI0) (1):
selftests: mptcp: decrease BW in simult flows
Michal Pecio (1):
xhci: handle isoc Babble and Buffer Overrun events properly
Muhammad Usama Anjum (1):
selftests/mm: switch to bash from sh
Nathan Chancellor (3):
modpost: Include '.text.*' in TEXT_SECTIONS
modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS drm/amd/display: Increase frame-larger-than for all display_mode_vba
files
Nico Pache (1):
selftests: mm: fix map_hugetlb failure on 64K page size systems
Oleg Nesterov (6):
getrusage: add the "signal_struct *sig" local variable
getrusage: move thread_group_cputime_adjusted() outside of
lock_task_sighand()
getrusage: use __for_each_thread()
getrusage: use sig->stats_lock rather than lock_task_sighand() fs/proc: do_task_stat: move thread_group_cputime_adjusted() outside of
lock_task_sighand()
exit: wait_task_zombie: kill the no longer necessary
spin_lock_irq(siglock)
Oleksij Rempel (1):
net: lan78xx: fix runtime PM count underflow on link stop
Qingqing Zhuo (1):
drm/amd/display: Re-arrange FPU code structure for dcn2x
Rand Deeb (1):
net: ice: Fix potential NULL pointer dereference in
ice_bridge_setlink()
Sasha Levin (1):
Linux 5.15.152-rc1
Sean Young (1):
ALSA: usb-audio: add quirk for RODE NT-USB+
Shradha Gupta (1):
hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed
Srinivasan Shanmugam (1):
drm/amd/display: Fix uninitialized variable usage in core_link_
'read_dpcd() & write_dpcd()' functions
Steven Rostedt (Google) (1):
tracing/net_sched: Fix tracepoints that save qdisc_dev() as a string
Takashi Iwai (9):
ALSA: usb-audio: Refcount multiple accesses on the single clock
ALSA: usb-audio: Clear fixed clock rate at closing EP
ALSA: usb-audio: Split endpoint setups for hw_params and prepare
(take#2)
ALSA: usb-audio: Properly refcounting clock rate
ALSA: usb-audio: Apply mutex around snd_usb_endpoint_set_params()
ALSA: usb-audio: Correct the return code from
snd_usb_endpoint_set_params()
ALSA: usb-audio: Avoid superfluous endpoint setup
ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum610 Wireless
ALSA: usb-audio: Sort quirk table entries
Toke Høiland-Jørgensen (1):
cpumap: Zero-initialise xdp_rxq_info struct before running XDP program
Wan Jiabing (1):
ALSA: usb-audio: Fix wrong kfree issue in snd_usb_endpoint_free_all
Wentao Jia (1):
nfp: flower: add goto_chain_index for ct entry
Yann Gautier (1):
mmc: mmci: stm32: use a buffer for unaligned DMA requests
Makefile | 4 +-
drivers/base/regmap/internal.h | 4 +
drivers/base/regmap/regmap.c | 77 ++++----
drivers/gpu/drm/amd/amdgpu/cik_ih.c | 6 +
drivers/gpu/drm/amd/amdgpu/cz_ih.c | 5 +
drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 5 +
drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 6 +
drivers/gpu/drm/amd/amdgpu/si_ih.c | 6 +
drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 6 +
drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 6 +
drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 6 +
.../gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 2 +-
drivers/gpu/drm/amd/display/dc/Makefile | 4 +-
drivers/gpu/drm/amd/display/dc/calcs/Makefile | 68 -------
.../drm/amd/display/dc/core/dc_link_dpcd.c | 4 +-
.../drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +-
.../drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +-
drivers/gpu/drm/amd/display/dc/dml/Makefile | 22 ++-
.../amd/display/dc/{ => dml}/calcs/bw_fixed.c | 0
.../display/dc/{ => dml}/calcs/calcs_logger.h | 0
.../display/dc/{ => dml}/calcs/custom_float.c | 0
.../display/dc/{ => dml}/calcs/dce_calcs.c | 0
.../dc/{ => dml}/calcs/dcn_calc_auto.c | 0
.../dc/{ => dml}/calcs/dcn_calc_auto.h | 0
.../dc/{ => dml}/calcs/dcn_calc_math.c | 0
.../display/dc/{ => dml}/calcs/dcn_calcs.c | 0
.../dml/{dcn2x/dcn2x.c => dcn20/dcn20_fpu.c} | 2 +-
.../dml/{dcn2x/dcn2x.h => dcn20/dcn20_fpu.h} | 6 +-
drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 23 ---
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 2 -
drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c | 25 ++-
drivers/mmc/host/mmci_stm32_sdmmc.c | 112 +++++++++--
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
drivers/net/ethernet/intel/ice/ice_main.c | 2 +
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 56 +++++-
.../microchip/sparx5/sparx5_mactable.c | 4 +-
.../ethernet/netronome/nfp/flower/conntrack.c | 28 ++-
.../ethernet/netronome/nfp/flower/conntrack.h | 2 +
drivers/net/geneve.c | 18 +-
drivers/net/hyperv/netvsc_drv.c | 83 +++++---
drivers/net/usb/lan78xx.c | 3 +-
drivers/tty/serial/max310x.c | 151 +++++++++------
drivers/usb/host/xhci-ring.c | 80 ++++++--
drivers/usb/host/xhci.h | 1 +
fs/erofs/data.c | 1 +
fs/proc/array.c | 17 +-
include/linux/regmap.h | 19 ++
include/trace/events/qdisc.h | 20 +-
kernel/bpf/cpumap.c | 2 +-
kernel/exit.c | 12 +-
kernel/sys.c | 91 +++++----
net/ipv6/route.c | 21 +--
net/netfilter/nf_conntrack_h323_asn1.c | 4 +
net/netfilter/nft_ct.c | 11 +-
net/netrom/af_netrom.c | 14 +-
net/netrom/nr_dev.c | 2 +-
net/netrom/nr_in.c | 6 +-
net/netrom/nr_out.c | 2 +-
net/netrom/nr_route.c | 8 +-
net/netrom/nr_subr.c | 5 +-
net/rds/rdma.c | 3 +
net/rds/send.c | 6 +-
scripts/mod/modpost.c | 7 +-
sound/usb/card.c | 1 +
sound/usb/card.h | 7 +-
sound/usb/endpoint.c | 177 +++++++++++++++---
sound/usb/endpoint.h | 9 +-
sound/usb/implicit.c | 9 +-
sound/usb/implicit.h | 2 +-
sound/usb/mixer.c | 7 +
sound/usb/pcm.c | 89 +++++----
sound/usb/pcm.h | 2 +
sound/usb/quirks.c | 30 ++-
sound/usb/usbaudio.h | 9 +
.../selftests/net/mptcp/simult_flows.sh | 8 +-
.../selftests/vm/charge_reserved_hugetlb.sh | 2 +-
tools/testing/selftests/vm/map_hugetlb.c | 7 +
.../selftests/vm/write_hugetlb_memory.sh | 2 +-
78 files changed, 966 insertions(+), 481 deletions(-)
delete mode 100644 drivers/gpu/drm/amd/display/dc/calcs/Makefile
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/bw_fixed.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/calcs_logger.h (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/custom_float.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dce_calcs.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dcn_calc_auto.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dcn_calc_auto.h (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dcn_calc_math.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dcn_calcs.c (100%)
rename drivers/gpu/drm/amd/display/dc/dml/{dcn2x/dcn2x.c => dcn20/dcn20_fpu.c} (99%)
rename drivers/gpu/drm/amd/display/dc/dml/{dcn2x/dcn2x.h => dcn20/dcn20_fpu.h} (94%)Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 1/76 mmc: mmci: stm32: use a buffer for unaligned DMA requests
From: Yann Gautier <[email protected]>
[ Upstream commit 970dc9c11a17994ab878016b536612ab00d1441d ]
In SDIO mode, the sg list for requests can be unaligned with what the STM32 SDMMC internal DMA can support. In that case, instead of failing, use a temporary bounce buffer to copy from/to the sg list. This buffer is limited to 1MB. But for that we need to also limit max_req_size to 1MB. It has not shown any throughput penalties for SD-cards or eMMC.
Stable-dep-of: 6b1ba3f9040b ("mmc: mmci: stm32: fix DMA API overlapping mappings warning")
--- drivers/mmc/host/mmci_stm32_sdmmc.c | 88 +++++++++++++++++++++++------ 1 file changed, 71 insertions(+), 17 deletions(-)
drivers/mmc/host/mmci_stm32_sdmmc.c +71 -17
@@ -43,6 +43,9 @@ struct sdmmc_lli_desc {struct sdmmc_idma {dma_addr_t sg_dma;void *sg_cpu; +dma_addr_t bounce_dma_addr; +void *bounce_buf; +bool use_bounce_buffer; };struct sdmmc_dlyb {
@@ -54,6 +57,8 @@ struct sdmmc_dlyb {static int sdmmc_idma_validate_data (struct mmci_host *host,struct mmc_data *data) { +struct sdmmc_idma *idma = host->dma_priv; +struct device *dev =mmc_dev (host->mmc);struct scatterlist *sg;int i;
@@ -61,41 +66,69 @@ static int sdmmc_idma_validate_data(struct mmci_host *host,* idma has constraints on idmabase & idmasize for each element * excepted the last element which has no constraint on idmasize */ + idma->use_bounce_buffer = false;for_each_sg (data->sg, sg, data->sg_len -1 , i) {if (!IS_ALIGNED (sg->offset,sizeof (u32)) || !IS_ALIGNED (sg->length,SDMMC_IDMA_BURST )) { -dev_err (mmc_dev (host->mmc), +dev_dbg (mmc_dev (host->mmc),"unaligned scatterlist: ofst:%x length:%d\n" , data->sg->offset, data->sg->length); -return -EINVAL ; + goto use_bounce_buffer; } }if (!IS_ALIGNED (sg->offset,sizeof (u32))) { -dev_err (mmc_dev (host->mmc), +dev_dbg (mmc_dev (host->mmc),"unaligned last scatterlist: ofst:%x length:%d\n" , data->sg->offset, data->sg->length); -return -EINVAL ; + goto use_bounce_buffer; } +return 0 ; + +use_bounce_buffer: +if (!idma->bounce_buf) { + idma->bounce_buf =dmam_alloc_coherent (dev, + host->mmc->max_req_size, + &idma->bounce_dma_addr, +GFP_KERNEL ); +if (!idma->bounce_buf) { +dev_err (dev,"Unable to map allocate DMA bounce buffer.\n" ); +return -ENOMEM ; + } + } + + idma->use_bounce_buffer = true; +return 0 ; }static int _sdmmc_idma_prep_data (struct mmci_host *host,struct mmc_data *data) { -int n_elem; +struct sdmmc_idma *idma = host->dma_priv; - n_elem =dma_map_sg (mmc_dev (host->mmc), - data->sg, - data->sg_len, -mmc_get_dma_dir (data)); +if (idma->use_bounce_buffer) { +if (data->flags &MMC_DATA_WRITE ) { +unsigned int xfer_bytes = data->blksz * data->blocks; -if (!n_elem) { -dev_err (mmc_dev (host->mmc),"dma_map_sg failed\n" ); -return -EINVAL ; - } +sg_copy_to_buffer (data->sg, data->sg_len, + idma->bounce_buf, xfer_bytes); +dma_wmb (); + } + }else { +int n_elem; + + n_elem =dma_map_sg (mmc_dev (host->mmc), + data->sg, + data->sg_len, +mmc_get_dma_dir (data)); +if (!n_elem) { +dev_err (mmc_dev (host->mmc),"dma_map_sg failed\n" ); +return -EINVAL ; + } + }return 0 ; }
@@ -112,8 +145,19 @@ static int sdmmc_idma_prep_data(struct mmci_host *host,static void sdmmc_idma_unprep_data (struct mmci_host *host,struct mmc_data *data,int err) { -dma_unmap_sg (mmc_dev (host->mmc), data->sg, data->sg_len, -mmc_get_dma_dir (data)); +struct sdmmc_idma *idma = host->dma_priv; + +if (idma->use_bounce_buffer) { +if (data->flags &MMC_DATA_READ ) { +unsigned int xfer_bytes = data->blksz * data->blocks; + +sg_copy_from_buffer (data->sg, data->sg_len, + idma->bounce_buf, xfer_bytes); + } + }else { +dma_unmap_sg (mmc_dev (host->mmc), data->sg, data->sg_len, +mmc_get_dma_dir (data)); + } }static int sdmmc_idma_setup (struct mmci_host *host)
@@ -137,6 +181,8 @@ static int sdmmc_idma_setup(struct mmci_host *host) host->mmc->max_segs =SDMMC_LLI_BUF_LEN /sizeof (struct sdmmc_lli_desc ); host->mmc->max_seg_size = host->variant->stm32_idmabsize_mask; + + host->mmc->max_req_size =SZ_1M ; }else { host->mmc->max_segs =1 ; host->mmc->max_seg_size = host->mmc->max_req_size;
@@ -154,8 +200,16 @@ static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)struct scatterlist *sg;int i; -if (!host->variant->dma_lli || data->sg_len ==1 ) { -writel_relaxed (sg_dma_address (data->sg), +if (!host->variant->dma_lli || data->sg_len ==1 || + idma->use_bounce_buffer) { +u32 dma_addr; + +if (idma->use_bounce_buffer) + dma_addr = idma->bounce_dma_addr; +else + dma_addr =sg_dma_address (data->sg); + +writel_relaxed (dma_addr, host->base +MMCI_STM32_IDMABASE0R );writel_relaxed (MMCI_STM32_IDMAEN , host->base +MMCI_STM32_IDMACTRLR );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/76 mmc: mmci: stm32: fix DMA API overlapping mappings warning
In reply to Sasha LevinFrom: Christophe Kerello <[email protected]>
[ Upstream commit 6b1ba3f9040be5efc4396d86c9752cdc564730be ]
Turning on CONFIG_DMA_API_DEBUG_SG results in the following warning:
DMA-API: mmci-pl18x 48220000.mmc: cacheline tracking EEXIST, overlapping mappings aren't supported
WARNING: CPU: 1 PID: 51 at kernel/dma/debug.c:568 add_dma_entry+0x234/0x2f4 Modules linked in: CPU: 1 PID: 51 Comm: kworker/1:2 Not tainted 6.1.28 #1 Hardware name: STMicroelectronics STM32MP257F-EV1 Evaluation Board (DT) Workqueue: events_freezable mmc_rescan Call trace: add_dma_entry+0x234/0x2f4 debug_dma_map_sg+0x198/0x350 __dma_map_sg_attrs+0xa0/0x110 dma_map_sg_attrs+0x10/0x2c sdmmc_idma_prep_data+0x80/0xc0 mmci_prep_data+0x38/0x84 mmci_start_data+0x108/0x2dc mmci_request+0xe4/0x190 __mmc_start_request+0x68/0x140 mmc_start_request+0x94/0xc0 mmc_wait_for_req+0x70/0x100 mmc_send_tuning+0x108/0x1ac sdmmc_execute_tuning+0x14c/0x210 mmc_execute_tuning+0x48/0xec mmc_sd_init_uhs_card.part.0+0x208/0x464 mmc_sd_init_card+0x318/0x89c mmc_attach_sd+0xe4/0x180 mmc_rescan+0x244/0x320
DMA API debug brings to light leaking dma-mappings as dma_map_sg and dma_unmap_sg are not correctly balanced.
If an error occurs in mmci_cmd_irq function, only mmci_dma_error function is called and as this API is not managed on stm32 variant, dma_unmap_sg is never called in this error path.
--- drivers/mmc/host/mmci_stm32_sdmmc.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/mmc/host/mmci_stm32_sdmmc.c +24 -0
@@ -200,6 +200,8 @@ static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)struct scatterlist *sg;int i; + host->dma_in_progress = true; +if (!host->variant->dma_lli || data->sg_len ==1 || idma->use_bounce_buffer) {u32 dma_addr;
@@ -238,9 +240,30 @@ static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)return 0 ; } +static void sdmmc_idma_error (struct mmci_host *host) +{ +struct mmc_data *data = host->data; +struct sdmmc_idma *idma = host->dma_priv; + +if (!dma_inprogress (host)) +return ; + +writel_relaxed (0 , host->base +MMCI_STM32_IDMACTRLR ); + host->dma_in_progress = false; + data->host_cookie =0 ; + +if (!idma->use_bounce_buffer) +dma_unmap_sg (mmc_dev (host->mmc), data->sg, data->sg_len, +mmc_get_dma_dir (data)); +} +static void sdmmc_idma_finalize (struct mmci_host *host,struct mmc_data *data) { +if (!dma_inprogress (host)) +return ; +writel_relaxed (0 , host->base +MMCI_STM32_IDMACTRLR ); + host->dma_in_progress = false;if (!data->host_cookie)sdmmc_idma_unprep_data (host, data,0 );
@@ -566,6 +589,7 @@ static struct mmci_host_ops sdmmc_variant_ops = { .dma_setup = sdmmc_idma_setup, .dma_start = sdmmc_idma_start, .dma_finalize = sdmmc_idma_finalize, + .dma_error = sdmmc_idma_error, .set_clkreg = mmci_sdmmc_set_clkreg, .set_pwrreg = mmci_sdmmc_set_pwrreg, .busy_complete = sdmmc_busy_complete,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/76 net: lan78xx: fix runtime PM count underflow on link stop
In reply to Sasha LevinFrom: Oleksij Rempel <[email protected]>
[ Upstream commit 1eecc7ab82c42133b748e1895275942a054a7f67 ]
Current driver has some asymmetry in the runtime PM calls. On lan78xx_open() it will call usb_autopm_get() and unconditionally usb_autopm_put(). And on lan78xx_stop() it will call only usb_autopm_put(). So far, it was working only because this driver do not activate autosuspend by default, so it was visible only by warning "Runtime PM usage count underflow!".
Since, with current driver, we can't use runtime PM with active link, execute lan78xx_open()->usb_autopm_put() only in error case. Otherwise, keep ref counting high as long as interface is open.
--- drivers/net/usb/lan78xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/usb/lan78xx.c +2 -1
@@ -2960,7 +2960,8 @@ static int lan78xx_open(struct net_device *net) done:mutex_unlock (&dev->dev_mutex); -usb_autopm_put_interface (dev->intf); +if (ret <0 ) +usb_autopm_put_interface (dev->intf);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/76 ixgbe: {dis, en}able irqs in ixgbe_txrx_ring_{dis, en}able
In reply to Sasha LevinFrom: Maciej Fijalkowski <[email protected]>
[ Upstream commit cbf996f52c4e658b3fb4349a869a62fd2d4c3c1c ]
Currently routines that are supposed to toggle state of ring pair do not take care of associated interrupt with queue vector that these rings belong to. This causes funky issues such as dead interface due to irq misconfiguration, as per Pavel's report from Closes: tag.
Add a function responsible for disabling single IRQ in EIMC register and call this as a very first thing when disabling ring pair during xsk_pool setup. For enable let's reuse ixgbe_irq_enable_queues(). Besides this, disable/enable NAPI as first/last thing when dealing with closing or opening ring pair that xsk_pool is being configured on.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 56 ++++++++++++++++--- 1 file changed, 49 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +49 -7
@@ -2941,8 +2941,8 @@ static void ixgbe_check_lsc(struct ixgbe_adapter *adapter)static inline void ixgbe_irq_enable_queues (struct ixgbe_adapter *adapter,u64 qmask) { -u32 mask;struct ixgbe_hw *hw = &adapter->hw; +u32 mask;switch (hw->mac.type) {case ixgbe_mac_82598EB:
@@ -10380,6 +10380,44 @@ static void ixgbe_reset_rxr_stats(struct ixgbe_ring *rx_ring)memset (&rx_ring->rx_stats,0 ,sizeof (rx_ring->rx_stats)); } +/** +* ixgbe_irq_disable_single - Disable single IRQ vector +* @adapter: adapter structure +* @ring: ring index +**/ +static void ixgbe_irq_disable_single (struct ixgbe_adapter *adapter,u32 ring) +{ +struct ixgbe_hw *hw = &adapter->hw; +u64 qmask =BIT_ULL (ring); +u32 mask; + +switch (adapter->hw.mac.type) { +case ixgbe_mac_82598EB: + mask = qmask &IXGBE_EIMC_RTX_QUEUE ; +IXGBE_WRITE_REG (&adapter->hw,IXGBE_EIMC , mask); +break ; +case ixgbe_mac_82599EB: +case ixgbe_mac_X540: +case ixgbe_mac_X550: +case ixgbe_mac_X550EM_x: +case ixgbe_mac_x550em_a: + mask = (qmask &0xFFFFFFFF ); +if (mask) +IXGBE_WRITE_REG (hw,IXGBE_EIMS_EX (0 ), mask); + mask = (qmask >>32 ); +if (mask) +IXGBE_WRITE_REG (hw,IXGBE_EIMS_EX (1 ), mask); +break ; +default : +break ; + } +IXGBE_WRITE_FLUSH (&adapter->hw); +if (adapter->flags &IXGBE_FLAG_MSIX_ENABLED ) +synchronize_irq (adapter->msix_entries[ring].vector); +else +synchronize_irq (adapter->pdev->irq); +} +/** * ixgbe_txrx_ring_disable - Disable Rx/Tx/XDP Tx rings * @adapter: adapter structure
@@ -10396,6 +10434,11 @@ void ixgbe_txrx_ring_disable(struct ixgbe_adapter *adapter, int ring) tx_ring = adapter->tx_ring[ring]; xdp_ring = adapter->xdp_ring[ring]; +ixgbe_irq_disable_single (adapter, ring); + +/* Rx/Tx/XDP Tx share the same napi context. */ +napi_disable (&rx_ring->q_vector->napi); +ixgbe_disable_txr (adapter, tx_ring);if (xdp_ring)ixgbe_disable_txr (adapter, xdp_ring);
@@ -10404,9 +10447,6 @@ void ixgbe_txrx_ring_disable(struct ixgbe_adapter *adapter, int ring)if (xdp_ring)synchronize_rcu (); -/* Rx/Tx/XDP Tx share the same napi context. */ -napi_disable (&rx_ring->q_vector->napi); -ixgbe_clean_tx_ring (tx_ring);if (xdp_ring)ixgbe_clean_tx_ring (xdp_ring);
@@ -10434,9 +10474,6 @@ void ixgbe_txrx_ring_enable(struct ixgbe_adapter *adapter, int ring) tx_ring = adapter->tx_ring[ring]; xdp_ring = adapter->xdp_ring[ring]; -/* Rx/Tx/XDP Tx share the same napi context. */ -napi_enable (&rx_ring->q_vector->napi); -ixgbe_configure_tx_ring (adapter, tx_ring);if (xdp_ring)ixgbe_configure_tx_ring (adapter, xdp_ring);
@@ -10445,6 +10482,11 @@ void ixgbe_txrx_ring_enable(struct ixgbe_adapter *adapter, int ring)clear_bit (__IXGBE_TX_DISABLED, &tx_ring->state);if (xdp_ring)clear_bit (__IXGBE_TX_DISABLED, &xdp_ring->state); + +/* Rx/Tx/XDP Tx share the same napi context. */ +napi_enable (&rx_ring->q_vector->napi); +ixgbe_irq_enable_queues (adapter,BIT_ULL (ring)); +IXGBE_WRITE_FLUSH (&adapter->hw); }/**
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/76 i40e: disable NAPI right after disabling irqs when handling xsk_pool
In reply to Sasha LevinFrom: Maciej Fijalkowski <[email protected]>
[ Upstream commit d562b11c1eac7d73f4c778b4cbe5468f86b1f20d ]
Disable NAPI before shutting down queues that this particular NAPI contains so that the order of actions in i40e_queue_pair_disable() mirrors what we do in i40e_queue_pair_enable().
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -13558,9 +13558,9 @@ int i40e_queue_pair_disable(struct i40e_vsi *vsi, int queue_pair)return err;i40e_queue_pair_disable_irq (vsi, queue_pair); +i40e_queue_pair_toggle_napi (vsi, queue_pair, false/* off */ ); err =i40e_queue_pair_toggle_rings (vsi, queue_pair, false/* off */ );i40e_clean_rx_ring (vsi->rx_rings[queue_pair]); -i40e_queue_pair_toggle_napi (vsi, queue_pair, false/* off */ );i40e_queue_pair_clean_rings (vsi, queue_pair);i40e_queue_pair_reset_stats (vsi, queue_pair);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/76 tracing/net_sched: Fix tracepoints that save qdisc_dev() as a string
In reply to Sasha LevinFrom: "Steven Rostedt (Google)" <[email protected]>
[ Upstream commit 51270d573a8d9dd5afdc7934de97d66c0e14b5fd ]
I'm updating __assign_str() and will be removing the second parameter. To make sure that it does not break anything, I make sure that it matches the __string() field, as that is where the string is actually going to be saved in. To make sure there's nothing that breaks, I added a WARN_ON() to make sure that what was used in __string() is the same that is used in __assign_str().
In doing this change, an error was triggered as __assign_str() now expects the string passed in to be a char * value. I instead had the following warning:
include/trace/events/qdisc.h: In function ‘trace_event_raw_event_qdisc_reset’:include/trace/events/qdisc.h:91:35: error: passing argument 1 of 'strcmp' from incompatible pointer type [-Werror=incompatible-pointer-types]
91 | __assign_str(dev, qdisc_dev(q));
That's because the qdisc_enqueue() and qdisc_reset() pass in qdisc_dev(q) to __assign_str() and to __string(). But that function returns a pointer to struct net_device and not a string.
It appears that these events are just saving the pointer as a string and then reading it as a string as well.
Use qdisc_dev(q)->name to save the device instead.
--- include/trace/events/qdisc.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
include/trace/events/qdisc.h +10 -10
@@ -81,14 +81,14 @@ TRACE_EVENT(qdisc_reset,TP_ARGS (q),TP_STRUCT__entry ( - __string( dev, qdisc_dev(q) ) - __string( kind, q->ops->id ) - __field( u32, parent ) -__field ( u32, handle ) + __string( dev, qdisc_dev(q)->name ) + __string( kind, q->ops->id ) + __field( u32, parent ) +__field ( u32, handle ) ),TP_fast_assign ( - __assign_str(dev, qdisc_dev(q)); + __assign_str(dev, qdisc_dev(q)->name);__assign_str (kind, q->ops->id); __entry->parent = q->parent; __entry->handle = q->handle;
@@ -106,14 +106,14 @@ TRACE_EVENT(qdisc_destroy,TP_ARGS (q),TP_STRUCT__entry ( - __string( dev, qdisc_dev(q) ) - __string( kind, q->ops->id ) - __field( u32, parent ) -__field ( u32, handle ) + __string( dev, qdisc_dev(q)->name ) + __string( kind, q->ops->id ) + __field( u32, parent ) +__field ( u32, handle ) ),TP_fast_assign ( - __assign_str(dev, qdisc_dev(q)); + __assign_str(dev, qdisc_dev(q)->name);__assign_str (kind, q->ops->id); __entry->parent = q->parent; __entry->handle = q->handle;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/76 geneve: make sure to pull inner header in geneve_rx()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 1ca1ba465e55b9460e4e75dec9fff31e708fec74 ]
syzbot triggered a bug in geneve_rx() [1]
Issue is similar to the one I fixed in commit 8d975c15c0cd ("ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv()")
We have to save skb->network_header in a temporary variable in order to be able to recompute the network_header pointer after a pskb_inet_may_pull() call.
pskb_inet_may_pull() makes sure the needed headers are in skb->head.
[1]
BUG: KMSAN: uninit-value in IP_ECN_decapsulate include/net/inet_ecn.h:302 [inline] BUG: KMSAN: uninit-value in geneve_rx drivers/net/geneve.c:279 [inline] BUG: KMSAN: uninit-value in geneve_udp_encap_recv+0x36f9/0x3c10 drivers/net/geneve.c:391 IP_ECN_decapsulate include/net/inet_ecn.h:302 [inline] geneve_rx drivers/net/geneve.c:279 [inline] geneve_udp_encap_recv+0x36f9/0x3c10 drivers/net/geneve.c:391 udp_queue_rcv_one_skb+0x1d39/0x1f20 net/ipv4/udp.c:2108 udp_queue_rcv_skb+0x6ae/0x6e0 net/ipv4/udp.c:2186 udp_unicast_rcv_skb+0x184/0x4b0 net/ipv4/udp.c:2346 __udp4_lib_rcv+0x1c6b/0x3010 net/ipv4/udp.c:2422 udp_rcv+0x7d/0xa0 net/ipv4/udp.c:2604 ip_protocol_deliver_rcu+0x264/0x1300 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x2b8/0x440 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] ip_local_deliver+0x21f/0x490 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:461 [inline] ip_rcv_finish net/ipv4/ip_input.c:449 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] ip_rcv+0x46f/0x760 net/ipv4/ip_input.c:569 __netif_receive_skb_one_core net/core/dev.c:5534 [inline] __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5648 process_backlog+0x480/0x8b0 net/core/dev.c:5976 __napi_poll+0xe3/0x980 net/core/dev.c:6576 napi_poll net/core/dev.c:6645 [inline] net_rx_action+0x8b8/0x1870 net/core/dev.c:6778 __do_softirq+0x1b7/0x7c5 kernel/softirq.c:553 do_softirq+0x9a/0xf0 kernel/softirq.c:454 __local_bh_enable_ip+0x9b/0xa0 kernel/softirq.c:381 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:820 [inline] __dev_queue_xmit+0x2768/0x51c0 net/core/dev.c:4378 dev_queue_xmit include/linux/netdevice.h:3171 [inline] packet_xmit+0x9c/0x6b0 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3081 [inline] packet_sendmsg+0x8aef/0x9f10 net/packet/af_packet.c:3113 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
slab_post_alloc_hook mm/slub.c:3819 [inline] slab_alloc_node mm/slub.c:3860 [inline] kmem_cache_alloc_node+0x5cb/0xbc0 mm/slub.c:3903 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560 __alloc_skb+0x352/0x790 net/core/skbuff.c:651 alloc_skb include/linux/skbuff.h:1296 [inline] alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6394 sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2783 packet_alloc_skb net/packet/af_packet.c:2930 [inline] packet_snd net/packet/af_packet.c:3024 [inline] packet_sendmsg+0x70c2/0x9f10 net/packet/af_packet.c:3113 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
--- drivers/net/geneve.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/net/geneve.c +16 -2
@@ -219,7 +219,7 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs,struct genevehdr *gnvh =geneve_hdr (skb);struct metadata_dst *tun_dst =NULL ;unsigned int len; -int err =0 ; +int nh, err =0 ;void *oiph;if (ip_tunnel_collect_metadata () || gs->collect_md) {
@@ -263,9 +263,23 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, goto drop; } - oiph =skb_network_header (skb); +/* Save offset of outer header relative to skb->head, +* because we are going to reset the network header to the inner header +* and might change skb->head. +*/ + nh =skb_network_header (skb) - skb->head; +skb_reset_network_header (skb); +if (!pskb_inet_may_pull (skb)) { +DEV_STATS_INC (geneve->dev, rx_length_errors); +DEV_STATS_INC (geneve->dev, rx_errors); + goto drop; + } + +/* Get the outer header. */ + oiph = skb->head + nh; +if (geneve_get_sk_family (gs) ==AF_INET ) err =IP_ECN_decapsulate (oiph, skb);#if IS_ENABLED (CONFIG_IPV6 )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/76 net: sparx5: Fix use after free inside sparx5_del_mact_entry
In reply to Sasha LevinFrom: Horatiu Vultur <[email protected]>
[ Upstream commit 89d72d4125e94aa3c2140fedd97ce07ba9e37674 ]
Based on the static analyzis of the code it looks like when an entry from the MAC table was removed, the entry was still used after being freed. More precise the vid of the mac_entry was used after calling devm_kfree on the mac_entry.
The fix consists in first using the vid of the mac_entry to delete the entry from the HW and after that to free it.
--- drivers/net/ethernet/microchip/sparx5/sparx5_mactable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_mactable.c +2 -2
@@ -344,10 +344,10 @@ int sparx5_del_mact_entry(struct sparx5 *sparx5, list) {if ((vid ==0 || mact_entry->vid == vid) &ðer_addr_equal (addr, mact_entry->mac)) { +sparx5_mact_forget (sparx5, addr, mact_entry->vid); +list_del (&mact_entry->list);devm_kfree (sparx5->dev, mact_entry); - -sparx5_mact_forget (sparx5, addr, mact_entry->vid); } }mutex_unlock (&sparx5->mact_lock);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/76 net: ice: Fix potential NULL pointer dereference in ice_bridge_setlink()
In reply to Sasha LevinFrom: Rand Deeb <[email protected]>
[ Upstream commit 06e456a05d669ca30b224b8ed962421770c1496c ]
The function ice_bridge_setlink() may encounter a NULL pointer dereference if nlmsg_find_attr() returns NULL and br_spec is dereferenced subsequently in nla_for_each_nested(). To address this issue, add a check to ensure that br_spec is not NULL before proceeding with the nested attribute iteration.
--- drivers/net/ethernet/intel/ice/ice_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/ice/ice_main.c +2 -0
@@ -6987,6 +6987,8 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, pf_sw = pf->first_sw;/* find the attribute in the netlink message */ br_spec =nlmsg_find_attr (nlh,sizeof (struct ifinfomsg ),IFLA_AF_SPEC ); +if (!br_spec) +return -EINVAL ;nla_for_each_nested (attr, br_spec, rem) {__u16 mode;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/76 net/ipv6: avoid possible UAF in ip6_route_mpath_notify()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 685f7d531264599b3f167f1e94bbd22f120e5fab ]
syzbot found another use-after-free in ip6_route_mpath_notify() [1]
Commit f7225172f25a ("net/ipv6: prevent use after free in ip6_route_mpath_notify") was not able to fix the root cause.
We need to defer the fib6_info_release() calls after ip6_route_mpath_notify(), in the cleanup phase.
[1]
BUG: KASAN: slab-use-after-free in rt6_fill_node+0x1460/0x1ac0 Read of size 4 at addr ffff88809a07fc64 by task syz-executor.2/23037 CPU: 0 PID: 23037 Comm: syz-executor.2 Not tainted 6.8.0-rc4-syzkaller-01035-gea7f3cfaa588 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x167/0x540 mm/kasan/report.c:488 kasan_report+0x142/0x180 mm/kasan/report.c:601 rt6_fill_node+0x1460/0x1ac0 inet6_rt_notify+0x13b/0x290 net/ipv6/route.c:6184 ip6_route_mpath_notify net/ipv6/route.c:5198 [inline] ip6_route_multipath_add net/ipv6/route.c:5404 [inline] inet6_rtm_newroute+0x1d0f/0x2300 net/ipv6/route.c:5517 rtnetlink_rcv_msg+0x885/0x1040 net/core/rtnetlink.c:6597 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543 netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline] netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367 netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7f73dd87dda9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f73de6550c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f73dd9ac050 RCX: 00007f73dd87dda9 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 RBP: 00007f73dd8ca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007f73dd9ac050 R15: 00007ffdbdeb7858 </TASK> Allocated by task 23037: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:372 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:389 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:3981 [inline] __kmalloc+0x22e/0x490 mm/slub.c:3994 kmalloc include/linux/slab.h:594 [inline] kzalloc include/linux/slab.h:711 [inline] fib6_info_alloc+0x2e/0xf0 net/ipv6/ip6_fib.c:155 ip6_route_info_create+0x445/0x12b0 net/ipv6/route.c:3758 ip6_route_multipath_add net/ipv6/route.c:5298 [inline] inet6_rtm_newroute+0x744/0x2300 net/ipv6/route.c:5517 rtnetlink_rcv_msg+0x885/0x1040 net/core/rtnetlink.c:6597 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543 netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline] netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367 netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 Freed by task 16: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x4e/0x60 mm/kasan/generic.c:640 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:241 __kasan_slab_free+0x34/0x70 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x14a/0x380 mm/slub.c:4409 rcu_do_batch kernel/rcu/tree.c:2190 [inline] rcu_core+0xd76/0x1810 kernel/rcu/tree.c:2465 __do_softirq+0x2bb/0x942 kernel/softirq.c:553 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xae/0x100 mm/kasan/generic.c:586 __call_rcu_common kernel/rcu/tree.c:2715 [inline] call_rcu+0x167/0xa80 kernel/rcu/tree.c:2829 fib6_info_release include/net/ip6_fib.h:341 [inline] ip6_route_multipath_add net/ipv6/route.c:5344 [inline] inet6_rtm_newroute+0x114d/0x2300 net/ipv6/route.c:5517 rtnetlink_rcv_msg+0x885/0x1040 net/core/rtnetlink.c:6597 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543 netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline] netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367 netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 The buggy address belongs to the object at ffff88809a07fc00 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 100 bytes inside of
freed 512-byte region [ffff88809a07fc00, ffff88809a07fe00)
The buggy address belongs to the physical page:
page:ffffea0002681f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9a07c head:ffffea0002681f00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)page_type: 0xffffffff()
raw: 00fff00000000840 ffff888014c41c80 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 23028, tgid 23027 (syz-executor.4), ts 2340253595219, free_ts 2339107097036
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533
prep_new_page mm/page_alloc.c:1540 [inline]
get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311
__alloc_pages+0x255/0x680 mm/page_alloc.c:4567
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
alloc_slab_page+0x5f/0x160 mm/slub.c:2190
allocate_slab mm/slub.c:2354 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2407
___slab_alloc+0xd17/0x13e0 mm/slub.c:3540
__slab_alloc mm/slub.c:3625 [inline]
__slab_alloc_node mm/slub.c:3678 [inline]
slab_alloc_node mm/slub.c:3850 [inline]
__do_kmalloc_node mm/slub.c:3980 [inline]
__kmalloc+0x2e0/0x490 mm/slub.c:3994
kmalloc include/linux/slab.h:594 [inline]
kzalloc include/linux/slab.h:711 [inline]
new_dir fs/proc/proc_sysctl.c:956 [inline]
get_subdir fs/proc/proc_sysctl.c:1000 [inline]
sysctl_mkdir_p fs/proc/proc_sysctl.c:1295 [inline]
__register_sysctl_table+0xb30/0x1440 fs/proc/proc_sysctl.c:1376
neigh_sysctl_register+0x416/0x500 net/core/neighbour.c:3859
devinet_sysctl_register+0xaf/0x1f0 net/ipv4/devinet.c:2644
inetdev_init+0x296/0x4d0 net/ipv4/devinet.c:286
inetdev_event+0x338/0x15c0 net/ipv4/devinet.c:1555
notifier_call_chain+0x18f/0x3b0 kernel/notifier.c:93
call_netdevice_notifiers_extack net/core/dev.c:1987 [inline]
call_netdevice_notifiers net/core/dev.c:2001 [inline]
register_netdevice+0x15b2/0x1a20 net/core/dev.c:10340
br_dev_newlink+0x27/0x100 net/bridge/br_netlink.c:1563
rtnl_newlink_create net/core/rtnetlink.c:3497 [inline]
__rtnl_newlink net/core/rtnetlink.c:3717 [inline]
rtnl_newlink+0x158f/0x20a0 net/core/rtnetlink.c:3730
page last free pid 11583 tgid 11583 stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1140 [inline]
free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2346
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486
kasan_depopulate_vmalloc_pte+0x74/0x90 mm/kasan/shadow.c:415
apply_to_pte_range mm/memory.c:2619 [inline]
apply_to_pmd_range mm/memory.c:2663 [inline]
apply_to_pud_range mm/memory.c:2699 [inline]
apply_to_p4d_range mm/memory.c:2735 [inline]
__apply_to_page_range+0x8ec/0xe40 mm/memory.c:2769
kasan_release_vmalloc+0x9a/0xb0 mm/kasan/shadow.c:532
__purge_vmap_area_lazy+0x163f/0x1a10 mm/vmalloc.c:1770
drain_vmap_area_work+0x40/0xd0 mm/vmalloc.c:1804
process_one_work kernel/workqueue.c:2633 [inline]
process_scheduled_works+0x913/0x1420 kernel/workqueue.c:2706
worker_thread+0xa5f/0x1000 kernel/workqueue.c:2787
kthread+0x2ef/0x390 kernel/kthread.c:388
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:242
Memory state around the buggy address:
ffff88809a07fb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809a07fb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88809a07fc00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88809a07fc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88809a07fd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb--- net/ipv6/route.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
net/ipv6/route.c +7 -14
@@ -5346,19 +5346,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, err_nh =NULL ;list_for_each_entry (nh, &rt6_nh_list, next) { err =__ip6_ins_rt (nh->fib6_info, info, extack); -fib6_info_release (nh->fib6_info); - -if (!err) { -/* save reference to last route successfully inserted */ - rt_last = nh->fib6_info; - -/* save reference to first route for notification */ -if (!rt_notif) - rt_notif = nh->fib6_info; - } -/* nh->fib6_info is used or freed at this point, reset to NULL*/ - nh->fib6_info =NULL ;if (err) {if (replace && nhn) NL_SET_ERR_MSG_MOD(extack,
@@ -5366,6 +5354,12 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, err_nh = nh; goto add_errout; } +/* save reference to last route successfully inserted */ + rt_last = nh->fib6_info; + +/* save reference to first route for notification */ +if (!rt_notif) + rt_notif = nh->fib6_info;/* Because each route is added like a single route we remove * these flags after the first nexthop: if there is a collision,
@@ -5426,8 +5420,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, cleanup:list_for_each_entry_safe (nh, nh_safe, &rt6_nh_list, next) { -if (nh->fib6_info) -fib6_info_release (nh->fib6_info); +fib6_info_release (nh->fib6_info);list_del (&nh->next);kfree (nh); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/76 cpumap: Zero-initialise xdp_rxq_info struct before running XDP program
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 2487007aa3b9fafbd2cb14068f49791ce1d7ede5 ]
When running an XDP program that is attached to a cpumap entry, we don't initialise the xdp_rxq_info data structure being used in the xdp_buff that backs the XDP program invocation. Tobias noticed that this leads to random values being returned as the xdp_md->rx_queue_index value for XDP programs running in a cpumap.
This means we're basically returning the contents of the uninitialised memory, which is bad. Fix this by zero-initialising the rxq data structure before running the XDP program.
--- kernel/bpf/cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/cpumap.c +1 -1
@@ -221,7 +221,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu, void **frames, int n, struct xdp_cpumap_stats *stats) { - struct xdp_rxq_info rxq; + struct xdp_rxq_info rxq = {};struct xdp_buff xdp;int i, nframes =0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/76 net/rds: fix WARNING in rds_conn_connect_if_down
In reply to Sasha LevinFrom: Edward Adam Davis <[email protected]>
[ Upstream commit c055fc00c07be1f0df7375ab0036cebd1106ed38 ]
If connection isn't established yet, get_mr() will fail, trigger connection after get_mr().
--- net/rds/rdma.c | 3 +++ net/rds/send.c | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-)
net/rds/rdma.c +3 -0
@@ -301,6 +301,9 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,kfree (sg); } ret =PTR_ERR (trans_private); +/* Trigger connection so that its ready for the next retry */ +if (ret == -ENODEV ) +rds_conn_connect_if_down (cp->cp_conn); goto out; }
net/rds/send.c +1 -5
@@ -1314,12 +1314,8 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)/* Parse any control messages the user may have included. */ ret =rds_cmsg_send (rs, rm, msg, &allocated_mr, &vct); -if (ret) { -/* Trigger connection so that its ready for the next retry */ -if (ret == -EAGAIN ) -rds_conn_connect_if_down (conn); +if (ret) goto out; - }if (rm->rdma.op_active && !conn->c_trans->xmit_rdma) { printk_ratelimited(KERN_NOTICE "rdma_op %p conn xmit_rdma %p\n",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/76 netfilter: nft_ct: fix l3num expectations with inet pseudo family
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 99993789966a6eb4f1295193dc543686899892d3 ]
Following is rejected but should be allowed:
table inet t {
ct expectation exp1 {
[..]
l3proto ipValid combos are:
table ip t, l3proto ip
table ip6 t, l3proto ip6
table inet t, l3proto ip OR l3proto ip6
Disallow inet pseudeo family, the l3num must be a on-wire protocol known to conntrack.
Retain NFPROTO_INET case to make it clear its rejected intentionally rather as oversight.
--- net/netfilter/nft_ct.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/netfilter/nft_ct.c +5 -6
@@ -1192,14 +1192,13 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,switch (priv->l3num) {case NFPROTO_IPV4 :case NFPROTO_IPV6 : -if (priv->l3num != ctx->family) -return -EINVAL ; +if (priv->l3num == ctx->family || ctx->family ==NFPROTO_INET ) +break ; - fallthrough; -case NFPROTO_INET : -break ; +return -EINVAL ; +case NFPROTO_INET :/* tuple.src.l3num supports NFPROTO_IPV4/6 only */ default : -return -EOPNOTSUPP ; +return -EAFNOSUPPORT ; } priv->l4proto =nla_get_u8 (tb[NFTA_CT_EXPECT_L4PROTO ]);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/76 netfilter: nf_conntrack_h323: Add protection for bmp length out of range
In reply to Sasha LevinFrom: Lena Wang <[email protected]>
[ Upstream commit 767146637efc528b5e3d31297df115e85a2fd362 ]
UBSAN load reports an exception of BRK#5515 SHIFT_ISSUE:Bitwise shifts that are out of bounds for their data type.
vmlinux get_bitmap(b=75) + 712
<net/netfilter/nf_conntrack_h323_asn1.c:0>
vmlinux decode_seq(bs=0xFFFFFFD008037000, f=0xFFFFFFD008037018, level=134443100) + 1956
<net/netfilter/nf_conntrack_h323_asn1.c:592>
vmlinux decode_choice(base=0xFFFFFFD0080370F0, level=23843636) + 1216
<net/netfilter/nf_conntrack_h323_asn1.c:814>
vmlinux decode_seq(f=0xFFFFFFD0080371A8, level=134443500) + 812
<net/netfilter/nf_conntrack_h323_asn1.c:576>
vmlinux decode_choice(base=0xFFFFFFD008037280, level=0) + 1216
<net/netfilter/nf_conntrack_h323_asn1.c:814>
vmlinux DecodeRasMessage() + 304
<net/netfilter/nf_conntrack_h323_asn1.c:833>
vmlinux ras_help() + 684
<net/netfilter/nf_conntrack_h323_main.c:1728>
vmlinux nf_confirm() + 188
<net/netfilter/nf_conntrack_proto.c:137>
Due to abnormal data in skb->data, the extension bitmap length exceeds 32 when decoding ras message then uses the length to make a shift operation. It will change into negative after several loop. UBSAN load could detect a negative shift as an undefined behaviour and reports exception.
So we add the protection to avoid the length exceeding 32. Or else it will return out of range error and stop decoding.
--- net/netfilter/nf_conntrack_h323_asn1.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/nf_conntrack_h323_asn1.c +4 -0
@@ -533,6 +533,8 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,/* Get fields bitmap */ if (nf_h323_error_boundary (bs,0 , f->sz))return H323_ERROR_BOUND ; +if (f->sz >32 ) +return H323_ERROR_RANGE ; bmp =get_bitmap (bs, f->sz);if (base) *(unsigned int *)base = bmp;
@@ -589,6 +591,8 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f, bmp2_len =get_bits (bs,7 ) +1 ;if (nf_h323_error_boundary (bs,0 , bmp2_len))return H323_ERROR_BOUND ; +if (bmp2_len >32 ) +return H323_ERROR_RANGE ; bmp2 =get_bitmap (bs, bmp2_len); bmp |= bmp2 >> f->sz;if (base)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/76 erofs: apply proper VMA alignment for memory mapped files on THP
In reply to Sasha LevinFrom: Gao Xiang <[email protected]>
[ Upstream commit 4127caee89612a84adedd78c9453089138cd5afe ]
There are mainly two reasons that thp_get_unmapped_area() should be used for EROFS as other filesystems:
- It's needed to enable PMD mappings as a FSDAX filesystem, see commit 74d2fad1334d ("thp, dax: add thp_get_unmapped_area for pmd mappings");
- It's useful together with large folios and CONFIG_READ_ONLY_THP_FOR_FS which enable THPs for mmapped files (e.g. shared libraries) even without FSDAX. See commit 1854bc6e2420 ("mm/readahead: Align file mappings for non-DAX").
--- fs/erofs/data.c | 1 + 1 file changed, 1 insertion(+)
fs/erofs/data.c +1 -0
@@ -340,4 +340,5 @@ const struct file_operations erofs_file_fops = { .read_iter = erofs_file_read_iter, .mmap = erofs_file_mmap, .splice_read = generic_file_splice_read, + .get_unmapped_area = thp_get_unmapped_area, };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/76 netrom: Fix a data-race around sysctl_netrom_default_path_quality
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit 958d6145a6d9ba9e075c921aead8753fb91c9101 ]
We need to protect the reader reading sysctl_netrom_default_path_quality because the value can be changed concurrently.
--- net/netrom/nr_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/nr_route.c +1 -1
@@ -153,7 +153,7 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic, nr_neigh->digipeat =NULL ; nr_neigh->ax25 =NULL ; nr_neigh->dev = dev; - nr_neigh->quality = sysctl_netrom_default_path_quality; + nr_neigh->quality =READ_ONCE (sysctl_netrom_default_path_quality); nr_neigh->locked =0 ; nr_neigh->count =0 ; nr_neigh->number = nr_neigh_no++;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/76 netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit cfd9f4a740f772298308b2e6070d2c744fb5cf79 ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/nr_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/nr_route.c +1 -1
@@ -766,7 +766,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)if (ax25 !=NULL ) { ret =nr_add_node (nr_src,"" , &ax25->dest_addr, ax25->digipeat, ax25->ax25_dev->dev,0 , - sysctl_netrom_obsolescence_count_initialiser); +READ_ONCE (sysctl_netrom_obsolescence_count_initialiser));if (ret)return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/76 netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit 119cae5ea3f9e35cdada8e572cc067f072fa825a ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/nr_dev.c | 2 +- net/netrom/nr_out.c | 2 +- net/netrom/nr_subr.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-)
net/netrom/nr_dev.c +1 -1
@@ -81,7 +81,7 @@ static int nr_header(struct sk_buff *skb, struct net_device *dev, buff[6 ] |=AX25_SSSID_SPARE ; buff +=AX25_ADDR_LEN ; - *buff++ = sysctl_netrom_network_ttl_initialiser; + *buff++ =READ_ONCE (sysctl_netrom_network_ttl_initialiser); *buff++ =NR_PROTO_IP ; *buff++ =NR_PROTO_IP ;
net/netrom/nr_out.c +1 -1
@@ -204,7 +204,7 @@ void nr_transmit_buffer(struct sock *sk, struct sk_buff *skb) dptr[6 ] |=AX25_SSSID_SPARE ; dptr +=AX25_ADDR_LEN ; - *dptr++ = sysctl_netrom_network_ttl_initialiser; + *dptr++ =READ_ONCE (sysctl_netrom_network_ttl_initialiser);if (!nr_route_frame (skb,NULL )) {kfree_skb (skb);
net/netrom/nr_subr.c +3 -2
@@ -182,7 +182,8 @@ void nr_write_internal(struct sock *sk, int frametype) *dptr++ = nr->my_id; *dptr++ = frametype; *dptr++ = nr->window; -if (nr->bpqext) *dptr++ = sysctl_netrom_network_ttl_initialiser; +if (nr->bpqext) + *dptr++ =READ_ONCE (sysctl_netrom_network_ttl_initialiser);break ;case NR_DISCREQ :
@@ -236,7 +237,7 @@ void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags) dptr[6 ] |=AX25_SSSID_SPARE ; dptr +=AX25_ADDR_LEN ; - *dptr++ = sysctl_netrom_network_ttl_initialiser; + *dptr++ =READ_ONCE (sysctl_netrom_network_ttl_initialiser);if (mine) { *dptr++ =0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 19/76 netrom: Fix a data-race around sysctl_netrom_transport_timeout
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit 60a7a152abd494ed4f69098cf0f322e6bb140612 ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/af_netrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/af_netrom.c +1 -1
@@ -453,7 +453,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,nr_init_timers (sk); nr->t1 = -msecs_to_jiffies (sysctl_netrom_transport_timeout); +msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_timeout)); nr->t2 =msecs_to_jiffies (sysctl_netrom_transport_acknowledge_delay); nr->n2 =
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 20/76 netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit e799299aafed417cc1f32adccb2a0e5268b3f6d5 ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/af_netrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/af_netrom.c +1 -1
@@ -457,7 +457,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol, nr->t2 =msecs_to_jiffies (sysctl_netrom_transport_acknowledge_delay); nr->n2 = -msecs_to_jiffies (sysctl_netrom_transport_maximum_tries); +msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_maximum_tries)); nr->t4 =msecs_to_jiffies (sysctl_netrom_transport_busy_delay); nr->idle =
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 21/76 netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit 806f462ba9029d41aadf8ec93f2f99c5305deada ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/af_netrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/af_netrom.c +1 -1
@@ -455,7 +455,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol, nr->t1 =msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_timeout)); nr->t2 = -msecs_to_jiffies (sysctl_netrom_transport_acknowledge_delay); +msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_acknowledge_delay)); nr->n2 =msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_maximum_tries)); nr->t4 =
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 22/76 netrom: Fix a data-race around sysctl_netrom_transport_busy_delay
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit 43547d8699439a67b78d6bb39015113f7aa360fd ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/af_netrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/af_netrom.c +1 -1
@@ -459,7 +459,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol, nr->n2 =msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_maximum_tries)); nr->t4 = -msecs_to_jiffies (sysctl_netrom_transport_busy_delay); +msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_busy_delay)); nr->idle =msecs_to_jiffies (sysctl_netrom_transport_no_activity_timeout); nr->window = sysctl_netrom_transport_requested_window_size;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 23/76 netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit a2e706841488f474c06e9b33f71afc947fb3bf56 ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/af_netrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/af_netrom.c +1 -1
@@ -462,7 +462,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_busy_delay)); nr->idle =msecs_to_jiffies (sysctl_netrom_transport_no_activity_timeout); - nr->window = sysctl_netrom_transport_requested_window_size; + nr->window =READ_ONCE (sysctl_netrom_transport_requested_window_size); nr->bpqext =1 ; nr->state =NR_STATE_0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 24/76 netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit f99b494b40431f0ca416859f2345746199398e2b ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/af_netrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/af_netrom.c +1 -1
@@ -461,7 +461,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol, nr->t4 =msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_busy_delay)); nr->idle = -msecs_to_jiffies (sysctl_netrom_transport_no_activity_timeout); +msecs_to_jiffies (READ_ONCE (sysctl_netrom_transport_no_activity_timeout)); nr->window =READ_ONCE (sysctl_netrom_transport_requested_window_size); nr->bpqext =1 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 25/76 netrom: Fix a data-race around sysctl_netrom_routing_control
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit b5dffcb8f71bdd02a4e5799985b51b12f4eeaf76 ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/nr_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/nr_route.c +1 -1
@@ -780,7 +780,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)return ret; } -if (!sysctl_netrom_routing_control && ax25 !=NULL ) +if (!READ_ONCE (sysctl_netrom_routing_control) && ax25 !=NULL )return 0 ;/* Its Time-To-Live has expired */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 26/76 netrom: Fix a data-race around sysctl_netrom_link_fails_count
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit bc76645ebdd01be9b9994dac39685a3d0f6f7985 ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/nr_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netrom/nr_route.c +1 -1
@@ -728,7 +728,7 @@ void nr_link_failed(ax25_cb *ax25, int reason) nr_neigh->ax25 =NULL ;ax25_cb_put (ax25); -if (++nr_neigh->failed < sysctl_netrom_link_fails_count) { +if (++nr_neigh->failed <READ_ONCE (sysctl_netrom_link_fails_count)) {nr_neigh_put (nr_neigh);return ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 27/76 netrom: Fix data-races around sysctl_net_busy_read
In reply to Sasha LevinFrom: Jason Xing <[email protected]>
[ Upstream commit d380ce70058a4ccddc3e5f5c2063165dc07672c6 ]
We need to protect the reader reading the sysctl value because the value can be changed concurrently.
--- net/netrom/af_netrom.c | 2 +- net/netrom/nr_in.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
net/netrom/af_netrom.c +1 -1
@@ -954,7 +954,7 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)* G8PZT's Xrouter which is sending packets with command type 7 * as an extension of the protocol. */ -if (sysctl_netrom_reset_circuit && +if (READ_ONCE (sysctl_netrom_reset_circuit) && (frametype !=NR_RESET || flags !=0 ))nr_transmit_reset (skb,1 );
net/netrom/nr_in.c +3 -3
@@ -97,7 +97,7 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,break ;case NR_RESET : -if (sysctl_netrom_reset_circuit) +if (READ_ONCE (sysctl_netrom_reset_circuit))nr_disconnect (sk,ECONNRESET );break ;
@@ -128,7 +128,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,break ;case NR_RESET : -if (sysctl_netrom_reset_circuit) +if (READ_ONCE (sysctl_netrom_reset_circuit))nr_disconnect (sk,ECONNRESET );break ;
@@ -262,7 +262,7 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametypebreak ;case NR_RESET : -if (sysctl_netrom_reset_circuit) +if (READ_ONCE (sysctl_netrom_reset_circuit))nr_disconnect (sk,ECONNRESET );break ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 28/76 ALSA: usb-audio: Refcount multiple accesses on the single clock
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit c11117b634f4f832c4420d3cf41c44227f140ce1 ]
When a clock source is connected to multiple nodes / endpoints, the current USB-audio driver tries to set up at each time one of them is configured. Although it reads the current rate and updates only if it differs, some devices seem unhappy with this behavior and spew the errors when reading/updating the rate unnecessarily.
This patch tries to reduce the redundant clock setup by introducing a refcount for each clock source. When the stream is actually running, a clock rate is "locked", and it bypasses the clock and/or refuse to change any longer.
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/card.c | 1 + sound/usb/card.h | 3 +- sound/usb/endpoint.c | 90 +++++++++++++++++++++++++++++++++++++++----- sound/usb/usbaudio.h | 1 + 4 files changed, 85 insertions(+), 10 deletions(-)
sound/usb/card.c +1 -0
@@ -643,6 +643,7 @@ static int snd_usb_audio_create(struct usb_interface *intf,INIT_LIST_HEAD (&chip->pcm_list);INIT_LIST_HEAD (&chip->ep_list);INIT_LIST_HEAD (&chip->iface_ref_list); +INIT_LIST_HEAD (&chip->clock_ref_list);INIT_LIST_HEAD (&chip->midi_list);INIT_LIST_HEAD (&chip->mixer_list);
sound/usb/card.h +2 -1
@@ -44,6 +44,7 @@ struct audioformat {struct snd_usb_substream ;struct snd_usb_iface_ref ; +struct snd_usb_clock_ref ;struct snd_usb_endpoint ;struct snd_usb_power_domain ;
@@ -62,6 +63,7 @@ struct snd_urb_ctx {struct snd_usb_endpoint {struct snd_usb_audio *chip;struct snd_usb_iface_ref *iface_ref; +struct snd_usb_clock_ref *clock_ref;int opened;/* open refcount; protect with chip->mutex */ atomic_t running;/* running status */
@@ -138,7 +140,6 @@ struct snd_usb_endpoint {unsigned int cur_period_frames;unsigned int cur_period_bytes;unsigned int cur_buffer_periods; -unsigned char cur_clock;spinlock_t lock;struct list_head list;
sound/usb/endpoint.c +81 -9
180 lines not on this page · raw message
sound/usb/usbaudio.h +1 -0
@@ -46,6 +46,7 @@ struct snd_usb_audio {struct list_head pcm_list;/* list of pcm streams */ struct list_head ep_list;/* list of audio-related endpoints */ struct list_head iface_ref_list;/* list of interface refcounts */ +struct list_head clock_ref_list;/* list of clock refcounts */ int pcm_devs;struct list_head midi_list;/* list of midi interfaces */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 29/76 ALSA: usb-audio: Clear fixed clock rate at closing EP
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 809f44a0cc5ad4b1209467a6287f8ac0eb49d393 ]
The recent commit c11117b634f4 ("ALSA: usb-audio: Refcount multiple accesses on the single clock") tries to manage the clock rate shared by several endpoints. This was intended for avoiding the unmatched rate by a different endpoint, but unfortunately, it introduced a regression for PulseAudio and pipewire, too; those applications try to probe the multiple possible rates (44.1k and 48kHz) and setting up the normal rate fails but only the last rate is applied.
The cause is that the last sample rate is still left to the clock reference even after closing the endpoint, and this value is still used at the next open. It happens only when applications set up via PCM prepare but don't start/stop the stream; the rate is reset when the stream is stopped, but it's not cleared at close.
This patch addresses the issue above, simply by clearing the rate set in the clock reference at the last close of each endpoint.
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/endpoint.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/endpoint.c +2 -0
@@ -932,6 +932,8 @@ void snd_usb_endpoint_close(struct snd_usb_audio *chip,endpoint_set_interface (chip, ep, false);if (!--ep->opened) { +if (ep->clock_ref && !atomic_read (&ep->clock_ref->locked)) + ep->clock_ref->rate =0 ; ep->iface =0 ; ep->altsetting =0 ; ep->cur_audiofmt =NULL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 30/76 ALSA: usb-audio: Split endpoint setups for hw_params and prepare (take#2)
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 2be79d58645465351af5320eb14c70a94724c5ef ]
This is a second attempt to fix the bug appearing on Android with the recent kernel; the first try was ff878b408a03 and reverted at commit 79764ec772bc.
The details taken from the v1 patch:
One of the former changes for the endpoint management was the more consistent setup of endpoints at hw_params. snd_usb_endpoint_configure() is a single function that does the full setup, and it's called from both PCM hw_params and prepare callbacks. Although the EP setup at the prepare phase is usually skipped (by checking need_setup flag), it may be still effective in some cases like suspend/resume that requires the interface setup again.
As it's a full and single setup, the invocation of snd_usb_endpoint_configure() includes not only the USB interface setup but also the buffer release and allocation. OTOH, doing the buffer release and re-allocation at PCM prepare phase is rather superfluous, and better to be done only in the hw_params phase.
For those optimizations, this patch splits the endpoint setup to two
phases: snd_usb_endpoint_set_params() and snd_usb_endpoint_prepare(), to be called from hw_params and from prepare, respectively.
Note that this patch changes the driver operation slightly, effectively moving the USB interface setup again to PCM prepare stage instead of hw_params stage, while the buffer allocation and such initializations are still done at hw_params stage.
And, the change of the USB interface setup timing (moving to prepare) gave an interesting "fix", too: it was reported that the recent kernels caused silent output at the beginning on playbacks on some devices on Android, and this change casually fixed the regression. It seems that those devices are picky about the sample rate change (or the interface change?), and don't follow the too immediate rate changes.
Meanwhile, Android operates the PCM in the following order:
- open, then hw_params with the possibly highest sample rate
- close without prepare
- re-open, hw_params with the normal sample rate
- prepare, and start streaming
This procedure ended up the hw_params twice with different rates, and because the recent kernel did set up the sample rate twice one and after, it screwed up the device. OTOH, the earlier kernels didn't set up the USB interface at hw_params, hence this problem didn't appear.
Now, with this patch, the USB interface setup is again back to the prepare phase, and it works around the problem automagically. Although we should address the sample rate problem in a more solid way in future, let's keep things working as before for now.
***
What's new in the take#2 patch:
- The regression caused by the v1 patch (bko#216500) was due to the missing check of need_setup flag at hw_params. Now the check is added, and the snd_usb_endpoint_set_params() call is skipped when the running EP is re-opened.
- There was another bug in v1 where the clock reference rate wasn't updated at hw_params phase, which may lead to a lack of the proper hw constraints when an application doesn't issue the prepare but only the hw_params call. This patch fixes it as well by tracking the clock rate change in the prepare callback with a new flag "need_update" for the clock reference object, just like others.
- The configure_endpoints() are simplified and folded back into snd_usb_pcm_prepare().
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/endpoint.c | 76 +++++++++++++++++++++++++++----------------- sound/usb/endpoint.h | 6 ++-- sound/usb/pcm.c | 51 ++++++++++++----------------- 3 files changed, 70 insertions(+), 63 deletions(-)
sound/usb/endpoint.c +46 -30
@@ -40,6 +40,7 @@ struct snd_usb_clock_ref {unsigned char clock;atomic_t locked;int rate; +bool need_setup;struct list_head list; };
@@ -765,7 +766,8 @@ bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,* The endpoint needs to be closed via snd_usb_endpoint_close() later. * * Note that this function doesn't configure the endpoint. The substream -* needs to set it up later via snd_usb_endpoint_configure(). +* needs to set it up later via snd_usb_endpoint_set_params() and +* snd_usb_endpoint_prepare(). */ struct snd_usb_endpoint * snd_usb_endpoint_open(struct snd_usb_audio *chip,
@@ -1296,15 +1298,39 @@ static int sync_ep_set_params(struct snd_usb_endpoint *ep)return -ENOMEM ; } +/* update the rate of the referred clock; return the actual rate */ +static int update_clock_ref_rate (struct snd_usb_audio *chip, +struct snd_usb_endpoint *ep) +{ +struct snd_usb_clock_ref *clock = ep->clock_ref; +int rate = ep->cur_rate; + +if (!clock || clock->rate == rate) +return rate; +if (clock->rate) { +if (atomic_read (&clock->locked)) +return clock->rate; +if (clock->rate != rate) { +usb_audio_err (chip,"Mismatched sample rate %d vs %d for EP 0x%x\n" , + clock->rate, rate, ep->ep_num); +return clock->rate; + } + } + clock->rate = rate; + clock->need_setup = true; +return rate; +} +/* * snd_usb_endpoint_set_params: configure an snd_usb_endpoint * +* It's called either from hw_params callback. * Determine the number of URBs to be used on this endpoint. * An endpoint must be configured before it can be started. * An endpoint that is already running can not be reconfigured. */ -static int snd_usb_endpoint_set_params (struct snd_usb_audio *chip, -struct snd_usb_endpoint *ep) +int snd_usb_endpoint_set_params (struct snd_usb_audio *chip, +struct snd_usb_endpoint *ep) {const struct audioformat *fmt = ep->cur_audiofmt;int err;
@@ -1356,49 +1382,46 @@ static int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, ep->maxframesize = ep->maxpacksize / ep->cur_frame_bytes; ep->curframesize = ep->curpacksize / ep->cur_frame_bytes; -return 0 ; +return update_clock_ref_rate (chip, ep); }static int init_sample_rate (struct snd_usb_audio *chip,struct snd_usb_endpoint *ep) {struct snd_usb_clock_ref *clock = ep->clock_ref; -int err; +int rate, err; -if (clock) { -if (atomic_read (&clock->locked)) -return 0 ; -if (clock->rate == ep->cur_rate) -return 0 ; -if (clock->rate && clock->rate != ep->cur_rate) { -usb_audio_dbg (chip,"Mismatched sample rate %d vs %d for EP 0x%x\n" , - clock->rate, ep->cur_rate, ep->ep_num); -return -EINVAL ; - } - } + rate =update_clock_ref_rate (chip, ep); +if (rate <0 ) +return rate; +if (clock && !clock->need_setup) +return 0 ; - err =snd_usb_init_sample_rate (chip, ep->cur_audiofmt, ep->cur_rate); -if (err <0 ) + err =snd_usb_init_sample_rate (chip, ep->cur_audiofmt, rate); +if (err <0 ) { +if (clock) + clock->rate =0 ;/* reset rate */ return err; + }if (clock) - clock->rate = ep->cur_rate; + clock->need_setup = false;return 0 ; }/* -* snd_usb_endpoint_configure: Configure the endpoint +* snd_usb_endpoint_prepare: Prepare the endpoint * * This function sets up the EP to be fully usable state. -* It's called either from hw_params or prepare callback. +* It's called either from prepare callback. * The function checks need_setup flag, and performs nothing unless needed, * so it's safe to call this multiple times. * * This returns zero if unchanged, 1 if the configuration has changed, * or a negative error code. */ -int snd_usb_endpoint_configure (struct snd_usb_audio *chip, -struct snd_usb_endpoint *ep) +int snd_usb_endpoint_prepare (struct snd_usb_audio *chip, +struct snd_usb_endpoint *ep) {bool iface_first;int err =0 ;
@@ -1419,9 +1442,6 @@ int snd_usb_endpoint_configure(struct snd_usb_audio *chip,if (err <0 ) goto unlock; } - err =snd_usb_endpoint_set_params (chip, ep); -if (err <0 ) - goto unlock; goto done; }
@@ -1449,10 +1469,6 @@ int snd_usb_endpoint_configure(struct snd_usb_audio *chip,if (err <0 ) goto unlock; - err =snd_usb_endpoint_set_params (chip, ep); -if (err <0 ) - goto unlock; - err =snd_usb_select_mode_quirk (chip, ep->cur_audiofmt);if (err <0 ) goto unlock;
sound/usb/endpoint.h +4 -2
@@ -17,8 +17,10 @@ snd_usb_endpoint_open(struct snd_usb_audio *chip, bool is_sync_ep);void snd_usb_endpoint_close (struct snd_usb_audio *chip,struct snd_usb_endpoint *ep); -int snd_usb_endpoint_configure (struct snd_usb_audio *chip, -struct snd_usb_endpoint *ep); +int snd_usb_endpoint_set_params (struct snd_usb_audio *chip, +struct snd_usb_endpoint *ep); +int snd_usb_endpoint_prepare (struct snd_usb_audio *chip, +struct snd_usb_endpoint *ep);int snd_usb_endpoint_get_clock_rate (struct snd_usb_audio *chip,int clock); bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
sound/usb/pcm.c +20 -31
71 lines not on this page · raw message
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 31/76 ALSA: usb-audio: Properly refcounting clock rate
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 9a737e7f8b371e97eb649904276407cee2c9cf30 ]
We fixed the bug introduced by the patch for managing the shared clocks at the commit 809f44a0cc5a ("ALSA: usb-audio: Clear fixed clock rate at closing EP"), but it was merely a workaround. By this change, the clock reference rate is cleared at each EP close, hence the still remaining EP may need a re-setup of rate unnecessarily.
This patch introduces the proper refcounting for the clock reference object so that the clock setup is done only when needed.
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/endpoint.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
sound/usb/endpoint.c +7 -4
@@ -39,6 +39,7 @@ struct snd_usb_iface_ref {struct snd_usb_clock_ref {unsigned char clock;atomic_t locked; +int opened;int rate;bool need_setup;struct list_head list;
@@ -810,6 +811,7 @@ snd_usb_endpoint_open(struct snd_usb_audio *chip, ep =NULL ; goto unlock; } + ep->clock_ref->opened++; } ep->cur_audiofmt = fp;
@@ -934,8 +936,10 @@ void snd_usb_endpoint_close(struct snd_usb_audio *chip,endpoint_set_interface (chip, ep, false);if (!--ep->opened) { -if (ep->clock_ref && !atomic_read (&ep->clock_ref->locked)) - ep->clock_ref->rate =0 ; +if (ep->clock_ref) { +if (!--ep->clock_ref->opened) + ep->clock_ref->rate =0 ; + } ep->iface =0 ; ep->altsetting =0 ; ep->cur_audiofmt =NULL ;
@@ -1656,8 +1660,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool keep_pending)WRITE_ONCE (ep->sync_source->sync_sink,NULL );stop_urbs (ep, false, keep_pending);if (ep->clock_ref) -if (!atomic_dec_return (&ep->clock_ref->locked)) - ep->clock_ref->rate =0 ; +atomic_dec (&ep->clock_ref->locked); } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 32/76 ALSA: usb-audio: Apply mutex around snd_usb_endpoint_set_params()
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit a74f8d0aa902ca494676b79226e0b5a1747b81d4 ]
The protection with chip->mutex was lost after splitting snd_usb_endpoint_set_params() and snd_usb_endpoint_prepare(). Apply the same mutex again to the former function.
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/endpoint.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
sound/usb/endpoint.c +7 -3
@@ -1339,10 +1339,11 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,const struct audioformat *fmt = ep->cur_audiofmt;int err; +mutex_lock (&chip->mutex);/* release old buffers, if any */ err =release_urbs (ep, false);if (err <0 ) -return err; + goto unlock; ep->datainterval = fmt->datainterval; ep->maxpacksize = fmt->maxpacksize;
@@ -1380,13 +1381,16 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,usb_audio_dbg (chip,"Set up %d URBS, ret=%d\n" , ep->nurbs, err);if (err <0 ) -return err; + goto unlock;/* some unit conversions in runtime */ ep->maxframesize = ep->maxpacksize / ep->cur_frame_bytes; ep->curframesize = ep->curpacksize / ep->cur_frame_bytes; -return update_clock_ref_rate (chip, ep); + err =update_clock_ref_rate (chip, ep); + unlock: +mutex_unlock (&chip->mutex); +return err; } static int init_sample_rate(struct snd_usb_audio *chip,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 33/76 ALSA: usb-audio: Correct the return code from snd_usb_endpoint_set_params()
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 9355b60e401d825590d37f04ea873c58efe9b7bf ]
snd_usb_endpoint_set_params() should return zero for a success, but currently it returns the sample rate. Correct it.
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/endpoint.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/endpoint.c +2 -0
@@ -1388,6 +1388,8 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, ep->curframesize = ep->curpacksize / ep->cur_frame_bytes; err =update_clock_ref_rate (chip, ep); +if (err >=0 ) + err =0 ; unlock:mutex_unlock (&chip->mutex);return err;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 34/76 ALSA: usb-audio: Avoid superfluous endpoint setup
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 1045f5f1ff0751423aeb65648e5e1abd7a7a8672 ]
After splitting to snd_usb_endpoint_set_params() and *_prepare(), the skip of each function should be checked with different flags, while we still use ep->need_setup as the single one. Introduce ep->need_prepare for indicating the need of prepare, and also add the missing check of ep->need_setup at the set_params.
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/card.h | 3 ++- sound/usb/endpoint.c | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-)
sound/usb/card.h +2 -1
@@ -129,7 +129,8 @@ struct snd_usb_endpoint {in a stream */ bool implicit_fb_sync;/* syncs with implicit feedback */ bool lowlatency_playback;/* low-latency playback mode */ -bool need_setup;/* (re-)need for configure? */ +bool need_setup;/* (re-)need for hw_params? */ +bool need_prepare;/* (re-)need for prepare? */ /* for hw constraints */ const struct audioformat *cur_audiofmt;
sound/usb/endpoint.c +12 -5
@@ -829,6 +829,7 @@ snd_usb_endpoint_open(struct snd_usb_audio *chip, ep->implicit_fb_sync = fp->implicit_fb; ep->need_setup = true; + ep->need_prepare = true; usb_audio_dbg(chip, " channels=%d, rate=%d, format=%s, period_bytes=%d, periods=%d, implicit_fb=%d\n", ep->cur_channels, ep->cur_rate,
@@ -954,7 +955,7 @@ void snd_usb_endpoint_close(struct snd_usb_audio *chip,/* Prepare for suspening EP, called from the main suspend handler */ void snd_usb_endpoint_suspend (struct snd_usb_endpoint *ep) { - ep->need_setup = true; + ep->need_prepare = true;if (ep->iface_ref) ep->iface_ref->need_setup = true;if (ep->clock_ref)
@@ -1337,9 +1338,12 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, struct snd_usb_endpoint *ep) {const struct audioformat *fmt = ep->cur_audiofmt; -int err; +int err =0 ;mutex_lock (&chip->mutex); +if (!ep->need_setup) + goto unlock; +/* release old buffers, if any */ err =release_urbs (ep, false);if (err <0 )
@@ -1388,8 +1392,11 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, ep->curframesize = ep->curpacksize / ep->cur_frame_bytes; err =update_clock_ref_rate (chip, ep); -if (err >=0 ) +if (err >=0 ) { + ep->need_setup = false; err =0 ; + } + unlock:mutex_unlock (&chip->mutex);return err;
@@ -1439,7 +1446,7 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,mutex_lock (&chip->mutex);if (WARN_ON (!ep->iface_ref)) goto unlock; -if (!ep->need_setup) +if (!ep->need_prepare) goto unlock;/* If the interface has been already set up, just set EP parameters */
@@ -1493,7 +1500,7 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip, ep->iface_ref->need_setup = false; done: - ep->need_setup = false; + ep->need_prepare = false; err =1 ; unlock:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 35/76 ALSA: usb-audio: Add quirk for Tascam Model 12
In reply to Sasha LevinFrom: John Keeping <[email protected]>
[ Upstream commit 67df411db3f0209e4bb5227d4dd9d41b21368b9d ]
Tascam's Model 12 is a mixer which can also operate as a USB audio interface. The audio interface uses explicit feedback but it seems that it does not correctly handle missing isochronous frames.
When injecting an xrun (or doing anything else that pauses the playback stream) the feedback rate climbs (for example, at 44,100Hz nominal, I see a stable rate around 44,099 but xrun injection sees this peak at around 44,135 in most cases) and glitches are heard in the audio stream for several seconds - this is significantly worse than the single glitch expected for an underrun.
While the stream does normally recover and the feedback rate returns to a stable value, I have seen some occurrences where this does not happen and the rate continues to increase while no audio is heard from the output. I have not found a solid reproduction for this.
This misbehaviour can be avoided by totally resetting the stream state by switching the interface to alt 0 and back before restarting the playback stream.
Add a new quirk flag which forces the endpoint and interface to be reconfigured whenever the stream is stopped, and use this for the Tascam Model 12.
Separate interfaces are used for the playback and capture endpoints, so resetting the playback interface here will not affect the capture stream if it is running. While there are two endpoints on the interface, these are the OUT data endpoint and the IN explicit feedback endpoint corresponding to it and these are always stopped and started together.
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/endpoint.c | 7 +++++++ sound/usb/quirks.c | 2 ++ sound/usb/usbaudio.h | 4 ++++ 3 files changed, 13 insertions(+)
sound/usb/endpoint.c +7 -0
@@ -1674,6 +1674,13 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool keep_pending)stop_urbs (ep, false, keep_pending);if (ep->clock_ref)atomic_dec (&ep->clock_ref->locked); + +if (ep->chip->quirk_flags &QUIRK_FLAG_FORCE_IFACE_RESET && +usb_pipeout (ep->pipe)) { + ep->need_prepare = true; +if (ep->iface_ref) + ep->iface_ref->need_setup = true; + } } }
sound/usb/quirks.c +2 -0
@@ -1786,6 +1786,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x0644 ,0x804a ,/* TEAC UD-301 */ QUIRK_FLAG_ITF_USB_DSD_DAC |QUIRK_FLAG_CTL_MSG_DELAY |QUIRK_FLAG_IFACE_DELAY ), +DEVICE_FLG (0x0644 ,0x805f ,/* TEAC Model 12 */ +QUIRK_FLAG_FORCE_IFACE_RESET ),DEVICE_FLG (0x06f8 ,0xb000 ,/* Hercules DJ Console (Windows Edition) */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x06f8, 0xd002, /* Hercules DJ Console (Macintosh Edition) */
sound/usb/usbaudio.h +4 -0
@@ -172,6 +172,9 @@ extern bool snd_usb_skip_validation;* Don't apply implicit feedback sync mode * QUIRK_FLAG_IFACE_SKIP_CLOSE * Don't closed interface during setting sample rate +* QUIRK_FLAG_FORCE_IFACE_RESET +* Force an interface reset whenever stopping & restarting a stream +* (e.g. after xrun) */ #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
@@ -194,5 +197,6 @@ extern bool snd_usb_skip_validation;#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17)#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18)#define QUIRK_FLAG_IFACE_SKIP_CLOSE (1U << 19) +#define QUIRK_FLAG_FORCE_IFACE_RESET (1U << 20)#endif /* __USBAUDIO_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 36/76 ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless
In reply to Sasha LevinFrom: Jaroslav Kysela <[email protected]>
[ Upstream commit fd28941cff1cd9d8ffa59fe11eb64148e09b6ed6 ]
It seems that the firmware is broken and does not accept the UAC_EP_CS_ATTR_SAMPLE_RATE URB. There is only one rate (48000Hz) available in the descriptors for the output endpoint.
Create a new quirk QUIRK_FLAG_FIXED_RATE to skip the rate setup when only one rate is available (fixed).
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/card.h | 1 + sound/usb/endpoint.c | 16 ++++++++++------ sound/usb/endpoint.h | 3 ++- sound/usb/implicit.c | 6 +++++- sound/usb/implicit.h | 2 +- sound/usb/pcm.c | 36 +++++++++++++++++++++++++++++++++--- sound/usb/pcm.h | 2 ++ sound/usb/quirks.c | 2 ++ sound/usb/usbaudio.h | 4 ++++ 9 files changed, 60 insertions(+), 12 deletions(-)
sound/usb/card.h +1 -0
@@ -131,6 +131,7 @@ struct snd_usb_endpoint {bool lowlatency_playback;/* low-latency playback mode */ bool need_setup;/* (re-)need for hw_params? */ bool need_prepare;/* (re-)need for prepare? */ +bool fixed_rate;/* skip rate setup */ /* for hw constraints */ const struct audioformat *cur_audiofmt;
sound/usb/endpoint.c +10 -6
@@ -774,7 +774,8 @@ struct snd_usb_endpoint * snd_usb_endpoint_open(struct snd_usb_audio *chip, const struct audioformat *fp, const struct snd_pcm_hw_params *params, - bool is_sync_ep) + bool is_sync_ep, + bool fixed_rate) { struct snd_usb_endpoint *ep;int ep_num = is_sync_ep ? fp->sync_ep : fp->endpoint;
@@ -830,6 +831,7 @@ snd_usb_endpoint_open(struct snd_usb_audio *chip, ep->implicit_fb_sync = fp->implicit_fb; ep->need_setup = true; ep->need_prepare = true; + ep->fixed_rate = fixed_rate; usb_audio_dbg(chip, " channels=%d, rate=%d, format=%s, period_bytes=%d, periods=%d, implicit_fb=%d\n", ep->cur_channels, ep->cur_rate,
@@ -1414,11 +1416,13 @@ static int init_sample_rate(struct snd_usb_audio *chip,if (clock && !clock->need_setup)return 0 ; - err =snd_usb_init_sample_rate (chip, ep->cur_audiofmt, rate); -if (err <0 ) { -if (clock) - clock->rate =0 ;/* reset rate */ -return err; +if (!ep->fixed_rate) { + err =snd_usb_init_sample_rate (chip, ep->cur_audiofmt, rate); +if (err <0 ) { +if (clock) + clock->rate =0 ;/* reset rate */ +return err; + } }if (clock)
sound/usb/endpoint.h +2 -1
@@ -14,7 +14,8 @@ struct snd_usb_endpoint * snd_usb_endpoint_open(struct snd_usb_audio *chip, const struct audioformat *fp, const struct snd_pcm_hw_params *params, - bool is_sync_ep); + bool is_sync_ep, + bool fixed_rate);void snd_usb_endpoint_close (struct snd_usb_audio *chip,struct snd_usb_endpoint *ep); int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
sound/usb/implicit.c +5 -1
@@ -15,6 +15,7 @@#include "usbaudio.h" #include "card.h" #include "helper.h" +#include "pcm.h" #include "implicit.h" enum {
@@ -455,7 +456,8 @@ const struct audioformat * snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip, const struct audioformat *target, const struct snd_pcm_hw_params *params, - int stream) + int stream, + bool *fixed_rate) { struct snd_usb_substream *subs;const struct audioformat *fp, *sync_fmt =NULL ;
@@ -483,6 +485,8 @@ snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip, } } +if (fixed_rate) + *fixed_rate =snd_usb_pcm_has_fixed_rate (subs);return sync_fmt; }
sound/usb/implicit.h +1 -1
@@ -9,6 +9,6 @@ const struct audioformat * snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip, const struct audioformat *target, const struct snd_pcm_hw_params *params, - int stream); + int stream, bool *fixed_rate);#endif /* __USBAUDIO_IMPLICIT_H */
sound/usb/pcm.c +33 -3
@@ -157,6 +157,31 @@ find_substream_format(struct snd_usb_substream *subs, true, subs); } +bool snd_usb_pcm_has_fixed_rate (struct snd_usb_substream *subs) +{ +const struct audioformat *fp; +struct snd_usb_audio *chip = subs->stream->chip; +int rate =-1 ; + +if (!(chip->quirk_flags &QUIRK_FLAG_FIXED_RATE )) +return false; +list_for_each_entry (fp, &subs->fmt_list, list) { +if (fp->rates &SNDRV_PCM_RATE_CONTINUOUS ) +return false; +if (fp->nr_rates <1 ) +continue ; +if (fp->nr_rates >1 ) +return false; +if (rate <0 ) { + rate = fp->rate_table[0 ]; +continue ; + } +if (rate != fp->rate_table[0 ]) +return false; + } +return true; +} +static int init_pitch_v1 (struct snd_usb_audio *chip,int ep) {struct usb_device *dev = chip->dev;
@@ -450,12 +475,14 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,struct snd_usb_audio *chip = subs->stream->chip;const struct audioformat *fmt;const struct audioformat *sync_fmt; +bool fixed_rate, sync_fixed_rate;int ret; ret =snd_media_start_pipeline (subs);if (ret)return ret; + fixed_rate =snd_usb_pcm_has_fixed_rate (subs); fmt =find_substream_format (subs, hw_params);if (!fmt) { usb_audio_dbg(chip,
@@ -469,7 +496,8 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,if (fmt->implicit_fb) { sync_fmt =snd_usb_find_implicit_fb_sync_format (chip, fmt, hw_params, - !substream->stream); + !substream->stream, + &sync_fixed_rate);if (!sync_fmt) { usb_audio_dbg(chip, "cannot find sync format: ep=0x%x, iface=%d:%d, format=%s, rate=%d, channels=%d\n",
@@ -482,6 +510,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, } }else { sync_fmt = fmt; + sync_fixed_rate = fixed_rate; } ret =snd_usb_lock_shutdown (chip);
@@ -501,7 +530,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,close_endpoints (chip, subs); } - subs->data_endpoint =snd_usb_endpoint_open (chip, fmt, hw_params, false); + subs->data_endpoint =snd_usb_endpoint_open (chip, fmt, hw_params, false, fixed_rate);if (!subs->data_endpoint) { ret = -EINVAL ; goto unlock;
@@ -510,7 +539,8 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,if (fmt->sync_ep) { subs->sync_endpoint =snd_usb_endpoint_open (chip, sync_fmt, hw_params, - fmt == sync_fmt); + fmt == sync_fmt, + sync_fixed_rate);if (!subs->sync_endpoint) { ret = -EINVAL ; goto unlock;
sound/usb/pcm.h +2 -0
@@ -6,6 +6,8 @@ void snd_usb_set_pcm_ops(struct snd_pcm *pcm, int stream);int snd_usb_pcm_suspend (struct snd_usb_stream *as);int snd_usb_pcm_resume (struct snd_usb_stream *as); +bool snd_usb_pcm_has_fixed_rate (struct snd_usb_substream *as); +int snd_usb_init_pitch (struct snd_usb_audio *chip,const struct audioformat *fmt);void snd_usb_preallocate_buffer (struct snd_usb_substream *subs);
sound/usb/quirks.c +2 -0
@@ -1896,6 +1896,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GENERIC_IMPLICIT_FB),DEVICE_FLG (0x0525 ,0xa4ad ,/* Hamedal C20 usb camero */ QUIRK_FLAG_IFACE_SKIP_CLOSE ), +DEVICE_FLG (0x0ecb ,0x2069 ,/* JBL Quantum810 Wireless */ +QUIRK_FLAG_FIXED_RATE ),/* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */
sound/usb/usbaudio.h +4 -0
@@ -175,6 +175,9 @@ extern bool snd_usb_skip_validation;* QUIRK_FLAG_FORCE_IFACE_RESET * Force an interface reset whenever stopping & restarting a stream * (e.g. after xrun) +* QUIRK_FLAG_FIXED_RATE +* Do not set PCM rate (frequency) when only one rate is available +* for the given endpoint. */ #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
@@ -198,5 +201,6 @@ extern bool snd_usb_skip_validation;#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18)#define QUIRK_FLAG_IFACE_SKIP_CLOSE (1U << 19)#define QUIRK_FLAG_FORCE_IFACE_RESET (1U << 20) +#define QUIRK_FLAG_FIXED_RATE (1U << 21)#endif /* __USBAUDIO_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 37/76 ALSA: usb-audio: Fix microphone sound on Nexigo webcam.
In reply to Sasha LevinFrom: Christos Skevis <[email protected]>
[ Upstream commit 4a63e68a295187ae3c1cb3fa0c583c96a959714f ]
I own an external usb Webcam, model NexiGo N930AF, which had low mic volume and inconsistent sound quality. Video works as expected.
(snip)
[ +0.047857] usb 5-1: new high-speed USB device number 2 using xhci_hcd [ +0.003406] usb 5-1: New USB device found, idVendor=1bcf, idProduct=2283, bcdDevice=12.17 [ +0.000007] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ +0.000004] usb 5-1: Product: NexiGo N930AF FHD Webcam [ +0.000003] usb 5-1: Manufacturer: SHENZHEN AONI ELECTRONIC CO., LTD [ +0.000004] usb 5-1: SerialNumber: 20201217011 [ +0.003900] usb 5-1: Found UVC 1.00 device NexiGo N930AF FHD Webcam (1bcf:2283) [ +0.025726] usb 5-1: 3:1: cannot get usb sound sample rate freq at ep 0x86 [ +0.071482] usb 5-1: 3:2: cannot get usb sound sample rate freq at ep 0x86 [ +0.004679] usb 5-1: 3:3: cannot get usb sound sample rate freq at ep 0x86 [ +0.051607] usb 5-1: Warning! Unlikely big volume range (=4096), cval->res is probably wrong. [ +0.000005] usb 5-1: [7] FU [Mic Capture Volume] ch = 1, val = 0/4096/1
Set up quirk cval->res to 16 for 256 levels,
Set GET_SAMPLE_RATE quirk flag to stop trying to get the sample rate. Confirmed that happened anyway later due to the backoff mechanism, after 3 failures
All audio stream on device interfaces share the same values, apart from wMaxPacketSize and tSamFreq :
(snip)
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 3
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0 AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 8
bDelay 1 frames
wFormatTag 0x0001 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 44100
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x005c 1x 92 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioStreaming Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0x0000
(snip)
Based on the usb data about manufacturer, SPCA2281B3 is the most likely controller IC Manufacturer does not provide link for datasheet nor detailed specs.
No way to confirm if the firmware supports any other way of getting the sample rate.
Testing patch provides consistent good sound recording quality and volume range.
(snip)
[ +0.045764] usb 5-1: new high-speed USB device number 2 using xhci_hcd [ +0.106290] usb 5-1: New USB device found, idVendor=1bcf, idProduct=2283, bcdDevice=12.17 [ +0.000006] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ +0.000004] usb 5-1: Product: NexiGo N930AF FHD Webcam [ +0.000003] usb 5-1: Manufacturer: SHENZHEN AONI ELECTRONIC CO., LTD [ +0.000004] usb 5-1: SerialNumber: 20201217011 [ +0.043700] usb 5-1: set resolution quirk: cval->res = 16 [ +0.002585] usb 5-1: Found UVC 1.00 device NexiGo N930AF FHD Webcam (1bcf:2283)
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
--- sound/usb/mixer.c | 7 +++++++ sound/usb/quirks.c | 2 ++ 2 files changed, 9 insertions(+)
sound/usb/mixer.c +7 -0
@@ -1205,6 +1205,13 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, cval->res =16 ; }break ; +case USB_ID (0x1bcf ,0x2283 ):/* NexiGo N930AF FHD Webcam */ +if (!strcmp (kctl->id.name,"Mic Capture Volume" )) { +usb_audio_info (chip, +"set resolution quirk: cval->res = 16\n" ); + cval->res =16 ; + } +break ; } }
sound/usb/quirks.c +2 -0
@@ -1898,6 +1898,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_IFACE_SKIP_CLOSE),DEVICE_FLG (0x0ecb ,0x2069 ,/* JBL Quantum810 Wireless */ QUIRK_FLAG_FIXED_RATE ), +DEVICE_FLG (0x1bcf ,0x2283 ,/* NexiGo N930AF FHD Webcam */ +QUIRK_FLAG_GET_SAMPLE_RATE ),/* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 38/76 ALSA: usb-audio: add quirk for RODE NT-USB+
In reply to Sasha LevinFrom: Sean Young <[email protected]>
[ Upstream commit 7822baa844a87cbb93308c1032c3d47d4079bb8a ]
The RODE NT-USB+ is marketed as a professional usb microphone, however the usb audio interface is a mess:
[ 1.130977] usb 1-5: new full-speed USB device number 2 using xhci_hcd [ 1.503906] usb 1-5: config 1 has an invalid interface number: 5 but max is 4 [ 1.503912] usb 1-5: config 1 has no interface number 4 [ 1.519689] usb 1-5: New USB device found, idVendor=19f7, idProduct=0035, bcdDevice= 1.09 [ 1.519695] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 1.519697] usb 1-5: Product: RØDE NT-USB+ [ 1.519699] usb 1-5: Manufacturer: RØDE [ 1.519700] usb 1-5: SerialNumber: 1D773A1A [ 8.327495] usb 1-5: 1:1: cannot get freq at ep 0x82 [ 8.344500] usb 1-5: 1:2: cannot get freq at ep 0x82 [ 8.365499] usb 1-5: 2:1: cannot get freq at ep 0x2
Add QUIRK_FLAG_GET_SAMPLE_RATE to work around the broken sample rate get. I have asked Rode support to fix it, but they show no interest.
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -1900,6 +1900,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_FIXED_RATE),DEVICE_FLG (0x1bcf ,0x2283 ,/* NexiGo N930AF FHD Webcam */ QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x19f7 ,0x0035 ,/* RODE NT-USB+ */ +QUIRK_FLAG_GET_SAMPLE_RATE ),/* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 39/76 drm/amd/display: Fix uninitialized variable usage in core_link_ 'read_dpcd() & write_dpcd()' functions
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit a58371d632ebab9ea63f10893a6b6731196b6f8d ]
The 'status' variable in 'core_link_read_dpcd()' & 'core_link_write_dpcd()' was uninitialized.
Thus, initializing 'status' variable to 'DC_ERROR_UNEXPECTED' by default.
Fixes the below:drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dpcd.c:226 core_link_read_dpcd() error: uninitialized symbol 'status'. drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dpcd.c:248 core_link_write_dpcd() error: uninitialized symbol 'status'.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dpcd.c +2 -2
@@ -199,7 +199,7 @@ enum dc_status core_link_read_dpcd(uint32_t extended_size;/* size of the remaining partitioned address space */ uint32_t size_left_to_read; -enum dc_status status; +enum dc_status status =DC_ERROR_UNEXPECTED ;/* size of the next partition to be read from */ uint32_t partition_size;uint32_t data_index =0 ;
@@ -228,7 +228,7 @@ enum dc_status core_link_write_dpcd( {uint32_t partition_size;uint32_t data_index =0 ; -enum dc_status status; +enum dc_status status =DC_ERROR_UNEXPECTED ;while (size) { partition_size =dpcd_get_next_partition_size (address, size);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 40/76 nfp: flower: add goto_chain_index for ct entry
In reply to Sasha LevinFrom: Wentao Jia <[email protected]>
[ Upstream commit 3e44d19934b92398785b3ffc2353b9eba264140e ]
The chain_index has different means in pre ct entry and post ct entry. In pre ct entry, it means chain index, but in post ct entry, it means goto chain index, it is confused.
chain_index and goto_chain_index may be present in one flow rule, It cannot be distinguished by one field chain_index, both chain_index and goto_chain_index are required in the follow-up patch to support multiple ct zones
Another field goto_chain_index is added to record the goto chain index. If no goto action in post ct entry, goto_chain_index is 0.
Stable-dep-of: cefa98e806fd ("nfp: flower: add hardware offload check for post ct entry")
--- drivers/net/ethernet/netronome/nfp/flower/conntrack.c | 8 ++++++-- drivers/net/ethernet/netronome/nfp/flower/conntrack.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/netronome/nfp/flower/conntrack.c +6 -2
@@ -1004,7 +1004,7 @@ static int nfp_ct_do_tc_merge(struct nfp_fl_ct_zone_entry *zt,/* Checks that the chain_index of the filter matches the * chain_index of the GOTO action. */ -if (post_ct_entry->chain_index != pre_ct_entry->chain_index) +if (post_ct_entry->chain_index != pre_ct_entry->goto_chain_index)return -EINVAL ; err =nfp_ct_merge_check (post_ct_entry, pre_ct_entry);
@@ -1450,7 +1450,8 @@ int nfp_fl_ct_handle_pre_ct(struct nfp_flower_priv *priv,if (IS_ERR (ct_entry))return PTR_ERR (ct_entry); ct_entry->type =CT_TYPE_PRE_CT ; - ct_entry->chain_index = ct_goto->chain_index; + ct_entry->chain_index = flow->common.chain_index; + ct_entry->goto_chain_index = ct_goto->chain_index;list_add (&ct_entry->list_node, &zt->pre_ct_list); zt->pre_ct_count++;
@@ -1473,6 +1474,7 @@ int nfp_fl_ct_handle_post_ct(struct nfp_flower_priv *priv,struct nfp_fl_ct_zone_entry *zt;bool wildcarded = false;struct flow_match_ct ct; +struct flow_action_entry *ct_goto;flow_rule_match_ct (rule, &ct);if (!ct.mask->ct_zone) {
@@ -1497,6 +1499,8 @@ int nfp_fl_ct_handle_post_ct(struct nfp_flower_priv *priv, ct_entry->type =CT_TYPE_POST_CT ; ct_entry->chain_index = flow->common.chain_index; + ct_goto =get_flow_act (flow->rule,FLOW_ACTION_GOTO ); + ct_entry->goto_chain_index = ct_goto ? ct_goto->chain_index :0 ;list_add (&ct_entry->list_node, &zt->post_ct_list); zt->post_ct_count++;
drivers/net/ethernet/netronome/nfp/flower/conntrack.h +2 -0
@@ -108,6 +108,7 @@ enum nfp_nfp_layer_name {* @cookie: Flow cookie, same as original TC flow, used as key * @list_node: Used by the list * @chain_index: Chain index of the original flow +* @goto_chain_index: goto chain index of the flow * @netdev: netdev structure. * @type: Type of pre-entry from enum ct_entry_type * @zt: Reference to the zone table this belongs to
@@ -120,6 +121,7 @@ struct nfp_fl_ct_flow_entry {unsigned long cookie;struct list_head list_node;u32 chain_index; +u32 goto_chain_index;enum ct_entry_type type;struct net_device *netdev;struct nfp_fl_ct_zone_entry *zt;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 41/76 nfp: flower: add hardware offload check for post ct entry
In reply to Sasha LevinFrom: Hui Zhou <[email protected]>
[ Upstream commit cefa98e806fd4e2a5e2047457a11ae5f17b8f621 ]
The nfp offload flow pay will not allocate a mask id when the out port is openvswitch internal port. This is because these flows are used to configure the pre_tun table and are never actually send to the firmware as an add-flow message. When a tc rule which action contains ct and the post ct entry's out port is openvswitch internal port, the merge offload flow pay with the wrong mask id of 0 will be send to the firmware. Actually, the nfp can not support hardware offload for this situation, so return EOPNOTSUPP.
--- .../ethernet/netronome/nfp/flower/conntrack.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/flower/conntrack.c +21 -1
@@ -1471,10 +1471,30 @@ int nfp_fl_ct_handle_post_ct(struct nfp_flower_priv *priv, {struct flow_rule *rule =flow_cls_offload_flow_rule (flow);struct nfp_fl_ct_flow_entry *ct_entry; +struct flow_action_entry *ct_goto;struct nfp_fl_ct_zone_entry *zt; +struct flow_action_entry *act;bool wildcarded = false;struct flow_match_ct ct; -struct flow_action_entry *ct_goto; +int i; + +flow_action_for_each (i, act, &rule->action) { +switch (act->id) { +case FLOW_ACTION_REDIRECT : +case FLOW_ACTION_REDIRECT_INGRESS : +case FLOW_ACTION_MIRRED : +case FLOW_ACTION_MIRRED_INGRESS : +if (act->dev->rtnl_link_ops && + !strcmp (act->dev->rtnl_link_ops->kind,"openvswitch" )) { +NL_SET_ERR_MSG_MOD (extack, +"unsupported offload: out port is openvswitch internal port" ); +return -EOPNOTSUPP ; + } +break ; +default : +break ; + } + }flow_rule_match_ct (rule, &ct);if (!ct.mask->ct_zone) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 42/76 selftests/mm: switch to bash from sh
In reply to Sasha LevinFrom: Muhammad Usama Anjum <[email protected]>
[ Upstream commit bc29036e1da1cf66e5f8312649aeec2d51ea3d86 ]
Running charge_reserved_hugetlb.sh generates errors if sh is set to dash:
./charge_reserved_hugetlb.sh: 9: [[: not found ./charge_reserved_hugetlb.sh: 19: [[: not found ./charge_reserved_hugetlb.sh: 27: [[: not found ./charge_reserved_hugetlb.sh: 37: [[: not found ./charge_reserved_hugetlb.sh: 45: Syntax error: "(" unexpected
Switch to using /bin/bash instead of /bin/sh. Make the switch for write_hugetlb_memory.sh as well which is called from charge_reserved_hugetlb.sh.
--- tools/testing/selftests/vm/charge_reserved_hugetlb.sh | 2 +- tools/testing/selftests/vm/write_hugetlb_memory.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/vm/charge_reserved_hugetlb.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # Kselftest framework requirement - SKIP code is 4.
tools/testing/selftests/vm/write_hugetlb_memory.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 set -e
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 43/76 selftests: mm: fix map_hugetlb failure on 64K page size systems
In reply to Sasha LevinFrom: Nico Pache <[email protected]>
[ Upstream commit 91b80cc5b39f00399e8e2d17527cad2c7fa535e2 ]
On systems with 64k page size and 512M huge page sizes, the allocation and test succeeds but errors out at the munmap. As the comment states, munmap will failure if its not HUGEPAGE aligned. This is due to the length of the mapping being 1/2 the size of the hugepage causing the munmap to not be hugepage aligned. Fix this by making the mapping length the full hugepage if the hugepage is larger than the length of the mapping.
--- tools/testing/selftests/vm/map_hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/testing/selftests/vm/map_hugetlb.c +7 -0
@@ -15,6 +15,7 @@#include <unistd.h> #include <sys/mman.h> #include <fcntl.h> +#include "vm_util.h" #define LENGTH (256UL*1024*1024)#define PROTECTION (PROT_READ | PROT_WRITE)
@@ -70,10 +71,16 @@ int main(int argc, char **argv) {void *addr;int ret; +size_t hugepage_size;size_t length =LENGTH ;int flags =FLAGS ;int shift =0 ; + hugepage_size =default_huge_page_size (); +/* munmap with fail if the length is not page aligned */ +if (hugepage_size > length) + length = hugepage_size; +if (argc >1 ) length =atol (argv[1 ]) <<20 ;if (argc >2 ) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 44/76 modpost: Include '.text.*' in TEXT_SECTIONS
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 19331e84c3873256537d446afec1f6c507f8c4ef ]
Commit 6c730bfc894f ("modpost: handle -ffunction-sections") added ".text.*" to the OTHER_TEXT_SECTIONS macro to fix certain section mismatch warnings. Unfortunately, this makes it impossible for modpost to warn about section mismatches with LTO, which implies '-ffunction-sections', as all functions are put in their own '.text.<func_name>' sections, which may still reference functions in sections they are not supposed to, such as __init.
Fix this by moving ".text.*" into TEXT_SECTIONS, so that configurations with '-ffunction-sections' will see warnings about mismatched sections.
Stable-dep-of: 397586506c3d ("modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS")
--- scripts/mod/modpost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/mod/modpost.c +2 -2
@@ -936,10 +936,10 @@ static void check_section(const char *modname, struct elf_info *elf,#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS#define DATA_SECTIONS ".data", ".data.rel" -#define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \ +#define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \ ".kprobes.text", ".cpuidle.text", ".noinstr.text"#define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ - ".fixup", ".entry.text", ".exception.text", ".text.*", \ + ".fixup", ".entry.text", ".exception.text", \ ".coldtext", ".softirqentry.text"#define INIT_SECTIONS ".init.*"
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 45/76 modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 397586506c3da005b9333ce5947ad01e8018a3be ]
After the linked LLVM change, building ARCH=um defconfig results in a segmentation fault in modpost. Prior to commit a23e7584ecf3 ("modpost:
unify 'sym' and 'to' in default_mismatch_handler()"), there was a warning:
WARNING: modpost: vmlinux.o(__ex_table+0x88): Section mismatch in reference to the .ltext:(unknown)
WARNING: modpost: The relocation at __ex_table+0x88 references
section ".ltext" which is not in the list of
authorized sections. If you're adding a new section
and/or if this reference is valid, add ".ltext" to the
list of authorized sections to jump to on fault.
This can be achieved by adding ".ltext" to
OTHER_TEXT_SECTIONS in scripts/mod/modpost.c.
The linked LLVM change moves global objects to the '.ltext' (and '.ltext.*' with '-ffunction-sections') sections with '-mcmodel=large', which ARCH=um uses. These sections should be handled just as '.text' and '.text.*' are, so add them to TEXT_SECTIONS.
--- scripts/mod/modpost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/mod/modpost.c +2 -1
@@ -937,7 +937,8 @@ static void check_section(const char *modname, struct elf_info *elf,#define DATA_SECTIONS ".data", ".data.rel"#define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \ - ".kprobes.text", ".cpuidle.text", ".noinstr.text" + ".kprobes.text", ".cpuidle.text", ".noinstr.text", \ + ".ltext", ".ltext.*"#define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \ ".fixup", ".entry.text", ".exception.text", \ ".coldtext", ".softirqentry.text"
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 46/76 xhci: process isoc TD properly when there was a transaction error mid TD.
In reply to Sasha LevinFrom: Mathias Nyman <[email protected]>
[ Upstream commit 5372c65e1311a16351ef03dd096ff576e6477674 ]
The last TRB of a isoc TD might not trigger an event if there was an error event for a TRB mid TD. This is seen on a NEC Corporation uPD720200 USB 3.0 Host
After an error mid a multi-TRB TD the xHC should according to xhci 4.9.1 generate events for passed TRBs with IOC flag set if it proceeds to the next TD. This event is either a copy of the original error, or a "success" transfer event.
If that event is missing then the driver and xHC host get out of sync as the driver is still expecting a transfer event for that first TD, while xHC host is already sending events for the next TD in the list. This leads to
"Transfer event TRB DMA ptr not part of current TD" messages.
As a solution we tag the isoc TDs that get error events mid TD. If an event doesn't match the first TD, then check if the tag is set, and event points to the next TD.
In that case give back the fist TD and process the next TD normally
Make sure TD status and transferred length stay valid in both cases with and without final TD completion event.
--- drivers/usb/host/xhci-ring.c | 74 +++++++++++++++++++++++++++++------- drivers/usb/host/xhci.h | 1 + 2 files changed, 61 insertions(+), 14 deletions(-)
drivers/usb/host/xhci-ring.c +60 -14
@@ -2428,6 +2428,9 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep,/* handle completion code */ switch (trb_comp_code) {case COMP_SUCCESS : +/* Don't overwrite status if TD had an error, see xHCI 4.9.1 */ +if (td->error_mid_td) +break ;if (remaining) { frame->status = short_framestatus;if (xhci->quirks &XHCI_TRUST_TX_LENGTH )
@@ -2453,8 +2456,9 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep,break ;case COMP_USB_TRANSACTION_ERROR : frame->status = -EPROTO ; + sum_trbs_for_length = true;if (ep_trb != td->last_trb) -return 0 ; + td->error_mid_td = true;break ;case COMP_STOPPED : sum_trbs_for_length = true;
@@ -2474,6 +2478,9 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep,break ; } +if (td->urb_length_set) + goto finish_td; +if (sum_trbs_for_length) frame->actual_length =sum_trb_lengths (xhci, ep->ring, ep_trb) + ep_trb_len - remaining;
@@ -2482,6 +2489,14 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, td->urb->actual_length += frame->actual_length; +finish_td: +/* Don't give back TD yet if we encountered an error mid TD */ +if (td->error_mid_td && ep_trb != td->last_trb) { +xhci_dbg (xhci,"Error mid isoc TD, wait for final completion event\n" ); + td->urb_length_set = true; +return 0 ; + } +return finish_td (xhci, ep, ep_ring, td, trb_comp_code); }
@@ -2866,17 +2881,51 @@ static int handle_tx_event(struct xhci_hcd *xhci, }if (!ep_seg) { -if (!ep->skip || - !usb_endpoint_xfer_isoc (&td->urb->ep->desc)) { -/* Some host controllers give a spurious -* successful event after a short transfer. -* Ignore it. -*/ -if ((xhci->quirks &XHCI_SPURIOUS_SUCCESS ) && - ep_ring->last_td_was_short) { - ep_ring->last_td_was_short = false; - goto cleanup; + +if (ep->skip &&usb_endpoint_xfer_isoc (&td->urb->ep->desc)) { +skip_isoc_td (xhci, td, ep, status); + goto cleanup; + } + +/* +* Some hosts give a spurious success event after a short +* transfer. Ignore it. +*/ +if ((xhci->quirks &XHCI_SPURIOUS_SUCCESS ) && + ep_ring->last_td_was_short) { + ep_ring->last_td_was_short = false; + goto cleanup; + } + +/* +* xhci 4.10.2 states isoc endpoints should continue +* processing the next TD if there was an error mid TD. +* So host like NEC don't generate an event for the last +* isoc TRB even if the IOC flag is set. +* xhci 4.9.1 states that if there are errors in mult-TRB +* TDs xHC should generate an error for that TRB, and if xHC +* proceeds to the next TD it should genete an event for +* any TRB with IOC flag on the way. Other host follow this. +* So this event might be for the next TD. +*/ +if (td->error_mid_td && + !list_is_last (&td->td_list, &ep_ring->td_list)) { +struct xhci_td *td_next =list_next_entry (td, td_list); + + ep_seg =trb_in_td (xhci, td_next->start_seg, td_next->first_trb, + td_next->last_trb, ep_trb_dma, false); +if (ep_seg) { +/* give back previous TD, start handling new */ +xhci_dbg (xhci,"Missing TD completion event after mid TD error\n" ); + ep_ring->dequeue = td->last_trb; + ep_ring->deq_seg = td->last_trb_seg; +inc_deq (xhci, ep_ring); +xhci_td_cleanup (xhci, td, ep_ring, td->status); + td = td_next; } + } + +if (!ep_seg) {/* HC is busted, give up! */ xhci_err (xhci, "ERROR Transfer event TRB DMA ptr not "
@@ -2888,9 +2937,6 @@ static int handle_tx_event(struct xhci_hcd *xhci, ep_trb_dma, true);return -ESHUTDOWN ; } - -skip_isoc_td (xhci, td, ep, status); - goto cleanup; }if (trb_comp_code ==COMP_SHORT_PACKET ) ep_ring->last_td_was_short = true;
drivers/usb/host/xhci.h +1 -0
@@ -1572,6 +1572,7 @@ struct xhci_td {struct xhci_segment *bounce_seg;/* actual_length of the URB has already been set */ bool urb_length_set; +bool error_mid_td;unsigned int num_trbs; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 47/76 xhci: handle isoc Babble and Buffer Overrun events properly
In reply to Sasha LevinFrom: Michal Pecio <[email protected]>
[ Upstream commit 7c4650ded49e5b88929ecbbb631efb8b0838e811 ]
xHCI 4.9 explicitly forbids assuming that the xHC has released its ownership of a multi-TRB TD when it reports an error on one of the early TRBs. Yet the driver makes such assumption and releases the TD, allowing the remaining TRBs to be freed or overwritten by new TDs.
The xHC should also report completion of the final TRB due to its IOC flag being set by us, regardless of prior errors. This event cannot be recognized if the TD has already been freed earlier, resulting in "Transfer event TRB DMA ptr not part of current TD" error message.
Fix this by reusing the logic for processing isoc Transaction Errors. This also handles hosts which fail to report the final completion.
Fix transfer length reporting on Babble errors. They may be caused by device malfunction, no guarantee that the buffer has been filled.
--- drivers/usb/host/xhci-ring.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +5 -1
@@ -2446,9 +2446,13 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep,case COMP_BANDWIDTH_OVERRUN_ERROR : frame->status = -ECOMM ;break ; -case COMP_ISOCH_BUFFER_OVERRUN :case COMP_BABBLE_DETECTED_ERROR : + sum_trbs_for_length = true; + fallthrough; +case COMP_ISOCH_BUFFER_OVERRUN : frame->status = -EOVERFLOW ; +if (ep_trb != td->last_trb) + td->error_mid_td = true;break ;case COMP_INCOMPATIBLE_DEVICE_ERROR :case COMP_STALL_ERROR :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 48/76 serial: max310x: use regmap methods for SPI batch operations
In reply to Sasha LevinFrom: Cosmin Tanislav <[email protected]>
[ Upstream commit 285e76fc049c4d32c772eea9460a7ef28a193802 ]
The SPI batch read/write operations can be implemented as simple regmap raw read and write, which will also try to do a gather write just as it is done here.
Use the regmap raw read and write methods.
Stable-dep-of: b35f8dbbce81 ("serial: max310x: prevent infinite while() loop in port startup")
--- drivers/tty/serial/max310x.c | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-)
drivers/tty/serial/max310x.c +8 -28
@@ -263,8 +263,6 @@ struct max310x_one {struct work_struct md_work;struct work_struct rs_work; -u8 wr_header; -u8 rd_header;u8 rx_buf[MAX310X_FIFO_SIZE ]; };#define to_max310x_port (_port) \
@@ -635,32 +633,18 @@ static s32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s,static void max310x_batch_write (struct uart_port *port,u8 *txbuf,unsigned int len) { -struct max310x_one *one =to_max310x_port (port); -struct spi_transfer xfer[] = { - { - .tx_buf = &one->wr_header, - .len =sizeof (one->wr_header), - }, { - .tx_buf = txbuf, - .len = len, - } - }; -spi_sync_transfer (to_spi_device (port->dev), xfer,ARRAY_SIZE (xfer)); +struct max310x_port *s =dev_get_drvdata (port->dev); +u8 reg = port->iobase +MAX310X_THR_REG ; + +regmap_raw_write (s->regmap, reg, txbuf, len); }static void max310x_batch_read (struct uart_port *port,u8 *rxbuf,unsigned int len) { -struct max310x_one *one =to_max310x_port (port); -struct spi_transfer xfer[] = { - { - .tx_buf = &one->rd_header, - .len =sizeof (one->rd_header), - }, { - .rx_buf = rxbuf, - .len = len, - } - }; -spi_sync_transfer (to_spi_device (port->dev), xfer,ARRAY_SIZE (xfer)); +struct max310x_port *s =dev_get_drvdata (port->dev); +u8 reg = port->iobase +MAX310X_RHR_REG ; + +regmap_raw_read (s->regmap, reg, rxbuf, len); }static void max310x_handle_rx (struct uart_port *port,unsigned int rxlen)
@@ -1386,10 +1370,6 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devtyINIT_WORK (&s->p[i].md_work, max310x_md_proc);/* Initialize queue for changing RS485 mode */ INIT_WORK (&s->p[i].rs_work, max310x_rs_proc); -/* Initialize SPI-transfer buffers */ - s->p[i].wr_header = (s->p[i].port.iobase +MAX310X_THR_REG ) | -MAX310X_WRITE_BIT ; - s->p[i].rd_header = (s->p[i].port.iobase +MAX310X_RHR_REG );/* Register port */ ret =uart_add_one_port (&max310x_uart, &s->p[i].port);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 49/76 serial: max310x: use a separate regmap for each port
In reply to Sasha LevinFrom: Cosmin Tanislav <[email protected]>
[ Upstream commit 6ef281daf020592c219fa91780abc381c6c20db5 ]
The driver currently does manual register manipulation in multiple places to talk to a specific UART port.
In order to talk to a specific UART port over SPI, the bits U1 and U0 of the register address can be set, as explained in the Command byte configuration section of the datasheet.
Make this more elegant by creating regmaps for each UART port and setting the read_flag_mask and write_flag_mask accordingly.
All communcations regarding global registers are done on UART port 0, so replace the global regmap entirely with the port 0 regmap.
Also, remove the 0x1f masks from reg_writeable(), reg_volatile() and reg_precious() methods, since setting the U1 and U0 bits of the register address happens inside the regmap core now.
Stable-dep-of: b35f8dbbce81 ("serial: max310x: prevent infinite while() loop in port startup")
--- drivers/tty/serial/max310x.c | 68 +++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 32 deletions(-)
drivers/tty/serial/max310x.c +36 -32
@@ -262,6 +262,7 @@ struct max310x_one {struct work_struct tx_work;struct work_struct md_work;struct work_struct rs_work; +struct regmap *regmap;u8 rx_buf[MAX310X_FIFO_SIZE ]; };
@@ -291,26 +292,26 @@ static DECLARE_BITMAP(max310x_lines, MAX310X_UART_NRMAX);static u8 max310x_port_read (struct uart_port *port,u8 reg) { -struct max310x_port *s =dev_get_drvdata (port->dev); +struct max310x_one *one =to_max310x_port (port);unsigned int val =0 ; -regmap_read (s->regmap, port->iobase + reg, &val); +regmap_read (one->regmap, reg, &val);return val; }static void max310x_port_write (struct uart_port *port,u8 reg,u8 val) { -struct max310x_port *s =dev_get_drvdata (port->dev); +struct max310x_one *one =to_max310x_port (port); -regmap_write (s->regmap, port->iobase + reg, val); +regmap_write (one->regmap, reg, val); }static void max310x_port_update (struct uart_port *port,u8 reg,u8 mask,u8 val) { -struct max310x_port *s =dev_get_drvdata (port->dev); +struct max310x_one *one =to_max310x_port (port); -regmap_update_bits (s->regmap, port->iobase + reg, mask, val); +regmap_update_bits (one->regmap, reg, mask, val); }static int max3107_detect (struct device *dev)
@@ -449,7 +450,7 @@ static const struct max310x_devtype max14830_devtype = {static bool max310x_reg_writeable (struct device *dev,unsigned int reg) { -switch (reg &0x1f ) { +switch (reg) {case MAX310X_IRQSTS_REG :case MAX310X_LSR_IRQSTS_REG :case MAX310X_SPCHR_IRQSTS_REG :
@@ -466,7 +467,7 @@ static bool max310x_reg_writeable(struct device *dev, unsigned int reg)static bool max310x_reg_volatile (struct device *dev,unsigned int reg) { -switch (reg &0x1f ) { +switch (reg) {case MAX310X_RHR_REG :case MAX310X_IRQSTS_REG :case MAX310X_LSR_IRQSTS_REG :
@@ -488,7 +489,7 @@ static bool max310x_reg_volatile(struct device *dev, unsigned int reg)static bool max310x_reg_precious (struct device *dev,unsigned int reg) { -switch (reg &0x1f ) { +switch (reg) {case MAX310X_RHR_REG :case MAX310X_IRQSTS_REG :case MAX310X_SPCHR_IRQSTS_REG :
@@ -633,18 +634,16 @@ static s32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s,static void max310x_batch_write (struct uart_port *port,u8 *txbuf,unsigned int len) { -struct max310x_port *s =dev_get_drvdata (port->dev); -u8 reg = port->iobase +MAX310X_THR_REG ; +struct max310x_one *one =to_max310x_port (port); -regmap_raw_write (s->regmap, reg, txbuf, len); +regmap_raw_write (one->regmap,MAX310X_THR_REG , txbuf, len); }static void max310x_batch_read (struct uart_port *port,u8 *rxbuf,unsigned int len) { -struct max310x_port *s =dev_get_drvdata (port->dev); -u8 reg = port->iobase +MAX310X_RHR_REG ; +struct max310x_one *one =to_max310x_port (port); -regmap_raw_read (s->regmap, reg, rxbuf, len); +regmap_raw_read (one->regmap,MAX310X_RHR_REG , rxbuf, len); }static void max310x_handle_rx (struct uart_port *port,unsigned int rxlen)
@@ -1247,15 +1246,16 @@ static int max310x_gpio_set_config(struct gpio_chip *chip, unsigned int offset,#endif static int max310x_probe (struct device *dev,const struct max310x_devtype *devtype, -struct regmap *regmap,int irq) +struct regmap *regmaps[],int irq) {int i, ret, fmin, fmax, freq;struct max310x_port *s;s32 uartclk =0 ;bool xtal; -if (IS_ERR (regmap)) -return PTR_ERR (regmap); +for (i =0 ; i < devtype->nr; i++) +if (IS_ERR (regmaps[i])) +return PTR_ERR (regmaps[i]);/* Alloc port structure */ s =devm_kzalloc (dev,struct_size (s, p, devtype->nr),GFP_KERNEL );
@@ -1302,7 +1302,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty goto out_clk; } - s->regmap = regmap; + s->regmap = regmaps[0 ]; s->devtype = devtype;dev_set_drvdata (dev, s);
@@ -1312,22 +1312,18 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty goto out_clk;for (i =0 ; i < devtype->nr; i++) { -unsigned int offs = i <<5 ; -/* Reset port */ -regmap_write (s->regmap,MAX310X_MODE2_REG + offs, +regmap_write (regmaps[i],MAX310X_MODE2_REG ,MAX310X_MODE2_RST_BIT );/* Clear port reset */ -regmap_write (s->regmap,MAX310X_MODE2_REG + offs,0 ); +regmap_write (regmaps[i],MAX310X_MODE2_REG ,0 );/* Wait for port startup */ do { -regmap_read (s->regmap, -MAX310X_BRGDIVLSB_REG + offs, &ret); +regmap_read (regmaps[i],MAX310X_BRGDIVLSB_REG , &ret); }while (ret !=0x01 ); -regmap_write (s->regmap,MAX310X_MODE1_REG + offs, - devtype->mode1); +regmap_write (regmaps[i],MAX310X_MODE1_REG , devtype->mode1); } uartclk =max310x_set_ref_clk (dev, s, freq, xtal);
@@ -1355,11 +1351,13 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty s->p[i].port.fifosize =MAX310X_FIFO_SIZE ; s->p[i].port.flags =UPF_FIXED_TYPE |UPF_LOW_LATENCY ; s->p[i].port.iotype =UPIO_PORT ; - s->p[i].port.iobase = i *0x20 ; + s->p[i].port.iobase = i; s->p[i].port.membase = (void __iomem *)~0 ; s->p[i].port.uartclk = uartclk; s->p[i].port.rs485_config = max310x_rs485_config; s->p[i].port.ops = &max310x_ops; + s->p[i].regmap = regmaps[i]; +/* Disable all interrupts */ max310x_port_write (&s->p[i].port,MAX310X_IRQEN_REG ,0 );/* Clear IRQ status register */
@@ -1456,6 +1454,7 @@ static struct regmap_config regcfg = { .val_bits = 8, .write_flag_mask = MAX310X_WRITE_BIT, .cache_type = REGCACHE_RBTREE, + .max_register = MAX310X_REG_1F, .writeable_reg = max310x_reg_writeable, .volatile_reg = max310x_reg_volatile, .precious_reg = max310x_reg_precious,
@@ -1465,7 +1464,8 @@ static struct regmap_config regcfg = {static int max310x_spi_probe (struct spi_device *spi) {const struct max310x_devtype *devtype; -struct regmap *regmap; +struct regmap *regmaps[4 ]; +unsigned int i;int ret;/* Setup SPI bus */
@@ -1480,10 +1480,14 @@ static int max310x_spi_probe(struct spi_device *spi)if (!devtype) devtype = (struct max310x_devtype *)spi_get_device_id (spi)->driver_data; - regcfg.max_register = devtype->nr *0x20 -1 ; - regmap =devm_regmap_init_spi (spi, ®cfg); +for (i =0 ; i < devtype->nr; i++) { +u8 port_mask = i *0x20 ; + regcfg.read_flag_mask = port_mask; + regcfg.write_flag_mask = port_mask |MAX310X_WRITE_BIT ; + regmaps[i] =devm_regmap_init_spi (spi, ®cfg); + } -return max310x_probe (&spi->dev, devtype, regmap, spi->irq); +return max310x_probe (&spi->dev, devtype, regmaps, spi->irq); }static int max310x_spi_remove (struct spi_device *spi)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 50/76 serial: max310x: prevent infinite while() loop in port startup
In reply to Sasha LevinFrom: Hugo Villeneuve <[email protected]>
[ Upstream commit b35f8dbbce818b02c730dc85133dc7754266e084 ]
If there is a problem after resetting a port, the do/while() loop that checks the default value of DIVLSB register may run forever and spam the I2C bus.
Add a delay before each read of DIVLSB, and a maximum number of tries to prevent that situation from happening.
Also fail probe if port reset is unsuccessful.
--- drivers/tty/serial/max310x.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/tty/serial/max310x.c +18 -2
@@ -235,6 +235,10 @@#define MAX310x_REV_MASK (0xf8)#define MAX310X_WRITE_BIT 0x80 +/* Port startup definitions */ +#define MAX310X_PORT_STARTUP_WAIT_RETRIES 20/* Number of retries */ +#define MAX310X_PORT_STARTUP_WAIT_DELAY_MS 10/* Delay between retries */ +/* Crystal-related definitions */ #define MAX310X_XTAL_WAIT_RETRIES 20/* Number of retries */ #define MAX310X_XTAL_WAIT_DELAY_MS 10/* Delay between retries */
@@ -1312,6 +1316,9 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty goto out_clk;for (i =0 ; i < devtype->nr; i++) { +bool started = false; +unsigned int try =0 , val =0 ; +/* Reset port */ regmap_write (regmaps[i],MAX310X_MODE2_REG ,MAX310X_MODE2_RST_BIT );
@@ -1320,8 +1327,17 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty/* Wait for port startup */ do { -regmap_read (regmaps[i],MAX310X_BRGDIVLSB_REG , &ret); - }while (ret !=0x01 ); +msleep (MAX310X_PORT_STARTUP_WAIT_DELAY_MS ); +regmap_read (regmaps[i],MAX310X_BRGDIVLSB_REG , &val); + +if (val ==0x01 ) + started = true; + }while (!started && (++try <MAX310X_PORT_STARTUP_WAIT_RETRIES )); + +if (!started) { + ret =dev_err_probe (dev, -EAGAIN ,"port reset failed\n" ); + goto out_uart; + }regmap_write (regmaps[i],MAX310X_MODE1_REG , devtype->mode1); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 51/76 drm/amd/pm: do not expose the API used internally only in kv_dpm.c
In reply to Sasha LevinFrom: Evan Quan <[email protected]>
[ Upstream commit 28a31774b050261371953401e8072ae15200c91e ]
Move it to kv_dpm.c instead.
Stable-dep-of: 733025626866 ("drm/amdgpu: Reset IH OVERFLOW_CLEAR bit")
--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 23 --------------------- drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 2 -- drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c | 25 ++++++++++++++++++++++- 3 files changed, 24 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +0 -23
@@ -188,29 +188,6 @@ u32 amdgpu_dpm_get_vrefresh(struct amdgpu_device *adev)return vrefresh; } -bool amdgpu_is_internal_thermal_sensor (enum amdgpu_int_thermal_type sensor) -{ -switch (sensor) { -case THERMAL_TYPE_RV6XX : -case THERMAL_TYPE_RV770 : -case THERMAL_TYPE_EVERGREEN : -case THERMAL_TYPE_SUMO : -case THERMAL_TYPE_NI : -case THERMAL_TYPE_SI : -case THERMAL_TYPE_CI : -case THERMAL_TYPE_KV : -return true; -case THERMAL_TYPE_ADT7473_WITH_INTERNAL : -case THERMAL_TYPE_EMC2103_WITH_INTERNAL : -return false;/* need special handling */ -case THERMAL_TYPE_NONE : -case THERMAL_TYPE_EXTERNAL : -case THERMAL_TYPE_EXTERNAL_GPIO : -default : -return false; - } -} -union power_info {struct _ATOM_POWERPLAY_INFO info;struct _ATOM_POWERPLAY_INFO_V2 info_2;
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +0 -2
@@ -501,8 +501,6 @@ void amdgpu_dpm_get_active_displays(struct amdgpu_device *adev);int amdgpu_dpm_read_sensor (struct amdgpu_device *adev,enum amd_pp_sensors sensor,void *data,uint32_t *size); -bool amdgpu_is_internal_thermal_sensor (enum amdgpu_int_thermal_type sensor); -int amdgpu_get_platform_caps (struct amdgpu_device *adev);int amdgpu_parse_extended_power_table (struct amdgpu_device *adev);
drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c +24 -1
@@ -1256,6 +1256,29 @@ static void kv_dpm_enable_bapm(void *handle, bool enable) } } +static bool kv_is_internal_thermal_sensor (enum amdgpu_int_thermal_type sensor) +{ +switch (sensor) { +case THERMAL_TYPE_RV6XX : +case THERMAL_TYPE_RV770 : +case THERMAL_TYPE_EVERGREEN : +case THERMAL_TYPE_SUMO : +case THERMAL_TYPE_NI : +case THERMAL_TYPE_SI : +case THERMAL_TYPE_CI : +case THERMAL_TYPE_KV : +return true; +case THERMAL_TYPE_ADT7473_WITH_INTERNAL : +case THERMAL_TYPE_EMC2103_WITH_INTERNAL : +return false;/* need special handling */ +case THERMAL_TYPE_NONE : +case THERMAL_TYPE_EXTERNAL : +case THERMAL_TYPE_EXTERNAL_GPIO : +default : +return false; + } +} +static int kv_dpm_enable (struct amdgpu_device *adev) {struct kv_power_info *pi =kv_get_pi (adev);
@@ -1352,7 +1375,7 @@ static int kv_dpm_enable(struct amdgpu_device *adev) }if (adev->irq.installed && -amdgpu_is_internal_thermal_sensor (adev->pm.int_thermal_type)) { +kv_is_internal_thermal_sensor (adev->pm.int_thermal_type)) { ret =kv_set_thermal_temperature_range (adev,KV_TEMP_RANGE_MIN ,KV_TEMP_RANGE_MAX );if (ret) {DRM_ERROR ("kv_set_thermal_temperature_range failed\n" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 52/76 drm/amdgpu: Reset IH OVERFLOW_CLEAR bit
In reply to Sasha LevinFrom: Friedrich Vock <[email protected]>
[ Upstream commit 7330256268664ea0a7dd5b07a3fed363093477dd ]
Allows us to detect subsequent IH ring buffer overflows as well.
--- drivers/gpu/drm/amd/amdgpu/cik_ih.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/cz_ih.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/si_ih.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 6 ++++++ 8 files changed, 46 insertions(+)
drivers/gpu/drm/amd/amdgpu/cik_ih.c +6 -0
@@ -204,6 +204,12 @@ static u32 cik_ih_get_wptr(struct amdgpu_device *adev, tmp =RREG32 (mmIH_RB_CNTL); tmp |=IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK ;WREG32 (mmIH_RB_CNTL, tmp); + +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp &= ~IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK ; +WREG32 (mmIH_RB_CNTL, tmp); }return (wptr & ih->ptr_mask); }
drivers/gpu/drm/amd/amdgpu/cz_ih.c +5 -0
@@ -216,6 +216,11 @@ static u32 cz_ih_get_wptr(struct amdgpu_device *adev, tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 );WREG32 (mmIH_RB_CNTL, tmp); +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); +WREG32 (mmIH_RB_CNTL, tmp); out:return (wptr & ih->ptr_mask);
drivers/gpu/drm/amd/amdgpu/iceland_ih.c +5 -0
@@ -215,6 +215,11 @@ static u32 iceland_ih_get_wptr(struct amdgpu_device *adev, tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 );WREG32 (mmIH_RB_CNTL, tmp); +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); +WREG32 (mmIH_RB_CNTL, tmp); out:return (wptr & ih->ptr_mask);
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +6 -0
@@ -447,6 +447,12 @@ static u32 navi10_ih_get_wptr(struct amdgpu_device *adev, tmp =RREG32_NO_KIQ (ih_regs->ih_rb_cntl); tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 );WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); + +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); +WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); out:return (wptr & ih->ptr_mask); }
drivers/gpu/drm/amd/amdgpu/si_ih.c +6 -0
@@ -119,6 +119,12 @@ static u32 si_ih_get_wptr(struct amdgpu_device *adev, tmp =RREG32 (IH_RB_CNTL ); tmp |=IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK ;WREG32 (IH_RB_CNTL , tmp); + +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp &= ~IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK ; +WREG32 (IH_RB_CNTL , tmp); }return (wptr & ih->ptr_mask); }
drivers/gpu/drm/amd/amdgpu/tonga_ih.c +6 -0
@@ -219,6 +219,12 @@ static u32 tonga_ih_get_wptr(struct amdgpu_device *adev, tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 );WREG32 (mmIH_RB_CNTL, tmp); +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); +WREG32 (mmIH_RB_CNTL, tmp); + out:return (wptr & ih->ptr_mask); }
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +6 -0
@@ -371,6 +371,12 @@ static u32 vega10_ih_get_wptr(struct amdgpu_device *adev, tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 );WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); +WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); + out:return (wptr & ih->ptr_mask); }
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +6 -0
@@ -422,6 +422,12 @@ static u32 vega20_ih_get_wptr(struct amdgpu_device *adev, tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 );WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); +WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); + out:return (wptr & ih->ptr_mask); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 53/76 selftests: mptcp: decrease BW in simult flows
In reply to Sasha LevinFrom: "Matthieu Baerts (NGI0)" <[email protected]>
[ Upstream commit 5e2f3c65af47e527ccac54060cf909e3306652ff ]
When running the simult_flow selftest in slow environments -- e.g. QEmu without KVM support --, the results can be unstable. This selftest checks if the aggregated bandwidth is (almost) fully used as expected.
To help improving the stability while still keeping the same validation in place, the BW and the delay are reduced to lower the pressure on the CPU.
--- tools/testing/selftests/net/mptcp/simult_flows.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/simult_flows.sh +4 -4
@@ -289,10 +289,10 @@ done setup run_test 10 10 0 0 "balanced bwidth" -run_test 10 10 1 50 "balanced bwidth with unbalanced delay" +run_test 10 10 1 25 "balanced bwidth with unbalanced delay" # we still need some additional infrastructure to pass the following test-cases -run_test 30 10 0 0 "unbalanced bwidth" -run_test 30 10 1 50 "unbalanced bwidth with unbalanced delay" -run_test 30 10 50 1 "unbalanced bwidth with opposed, unbalanced delay" +run_test 10 3 0 0 "unbalanced bwidth" +run_test 10 3 1 25 "unbalanced bwidth with unbalanced delay" +run_test 10 3 25 1 "unbalanced bwidth with opposed, unbalanced delay" exit $ret
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 54/76 hv_netvsc: use netif_is_bond_master() instead of open code
In reply to Sasha LevinFrom: Juhee Kang <[email protected]>
[ Upstream commit c60882a4566a0a62dc3a40c85131103aad83dcb3 ]
Use netif_is_bond_master() function instead of open code, which is ((event_dev->priv_flags & IFF_BONDING) && (event_dev->flags & IFF_MASTER)). This patch doesn't change logic.
Stable-dep-of: 9cae43da9867 ("hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed")
--- drivers/net/hyperv/netvsc_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/hyperv/netvsc_drv.c +1 -2
@@ -2784,8 +2784,7 @@ static int netvsc_netdev_event(struct notifier_block *this,return NOTIFY_DONE ;/* Avoid Bonding master dev with same MAC registering as VF */ -if ((event_dev->priv_flags &IFF_BONDING ) && - (event_dev->flags &IFF_MASTER )) +if (netif_is_bond_master (event_dev))return NOTIFY_DONE ;switch (event) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 55/76 hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed
In reply to Sasha LevinFrom: Shradha Gupta <[email protected]>
[ Upstream commit 9cae43da9867412f8bd09aee5c8a8dc5e8dc3dc2 ]
If hv_netvsc driver is unloaded and reloaded, the NET_DEVICE_REGISTER handler cannot perform VF register successfully as the register call is received before netvsc_probe is finished. This is because we register register_netdevice_notifier() very early( even before vmbus_driver_register()).
To fix this, we try to register each such matching VF( if it is visible as a netdevice) at the end of netvsc_probe.
--- drivers/net/hyperv/netvsc_drv.c | 82 +++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 20 deletions(-)
drivers/net/hyperv/netvsc_drv.c +62 -20
@@ -42,6 +42,10 @@#define LINKCHANGE_INT (2 * HZ)#define VF_TAKEOVER_INT (HZ / 10) +/* Macros to define the context of vf registration */ +#define VF_REG_IN_PROBE 1 +#define VF_REG_IN_NOTIFIER 2 +static unsigned int ring_size__ro_after_init =128 ;module_param (ring_size, uint,0444 );MODULE_PARM_DESC (ring_size,"Ring buffer size (# of 4K pages)" );
@@ -2204,7 +2208,7 @@ static rx_handler_result_t netvsc_vf_handle_frame(struct sk_buff **pskb) }static int netvsc_vf_join (struct net_device *vf_netdev, -struct net_device *ndev) +struct net_device *ndev,int context) {struct net_device_context *ndev_ctx =netdev_priv (ndev);int ret;
@@ -2227,7 +2231,11 @@ static int netvsc_vf_join(struct net_device *vf_netdev, goto upper_link_failed; } -schedule_delayed_work (&ndev_ctx->vf_takeover,VF_TAKEOVER_INT ); +/* If this registration is called from probe context vf_takeover +* is taken care of later in probe itself. +*/ +if (context ==VF_REG_IN_NOTIFIER ) +schedule_delayed_work (&ndev_ctx->vf_takeover,VF_TAKEOVER_INT );call_netdevice_notifiers (NETDEV_JOIN , vf_netdev);
@@ -2365,7 +2373,7 @@ static int netvsc_prepare_bonding(struct net_device *vf_netdev)return NOTIFY_DONE ; } -static int netvsc_register_vf (struct net_device *vf_netdev) +static int netvsc_register_vf (struct net_device *vf_netdev,int context) {struct net_device_context *net_device_ctx;struct netvsc_device *netvsc_dev;
@@ -2405,7 +2413,7 @@ static int netvsc_register_vf(struct net_device *vf_netdev)netdev_info (ndev,"VF registering: %s\n" , vf_netdev->name); -if (netvsc_vf_join (vf_netdev, ndev) !=0 ) +if (netvsc_vf_join (vf_netdev, ndev, context) !=0 )return NOTIFY_DONE ;dev_hold (vf_netdev);
@@ -2503,10 +2511,31 @@ static int netvsc_unregister_vf(struct net_device *vf_netdev)return NOTIFY_OK ; } +static int check_dev_is_matching_vf (struct net_device *event_ndev) +{ +/* Skip NetVSC interfaces */ +if (event_ndev->netdev_ops == &device_ops) +return -ENODEV ; + +/* Avoid non-Ethernet type devices */ +if (event_ndev->type !=ARPHRD_ETHER ) +return -ENODEV ; + +/* Avoid Vlan dev with same MAC registering as VF */ +if (is_vlan_dev (event_ndev)) +return -ENODEV ; + +/* Avoid Bonding master dev with same MAC registering as VF */ +if (netif_is_bond_master (event_ndev)) +return -ENODEV ; + +return 0 ; +} +static int netvsc_probe (struct hv_device *dev,const struct hv_vmbus_device_id *dev_id) { -struct net_device *net =NULL ; +struct net_device *net =NULL , *vf_netdev;struct net_device_context *net_device_ctx;struct netvsc_device_info *device_info =NULL ;struct netvsc_device *nvdev;
@@ -2614,6 +2643,30 @@ static int netvsc_probe(struct hv_device *dev, }list_add (&net_device_ctx->list, &netvsc_dev_list); + +/* When the hv_netvsc driver is unloaded and reloaded, the +* NET_DEVICE_REGISTER for the vf device is replayed before probe +* is complete. This is because register_netdevice_notifier() gets +* registered before vmbus_driver_register() so that callback func +* is set before probe and we don't miss events like NETDEV_POST_INIT +* So, in this section we try to register the matching vf device that +* is present as a netdevice, knowing that its register call is not +* processed in the netvsc_netdev_notifier(as probing is progress and +* get_netvsc_byslot fails). +*/ +for_each_netdev (dev_net (net), vf_netdev) { + ret =check_dev_is_matching_vf (vf_netdev); +if (ret !=0 ) +continue ; + +if (net !=get_netvsc_byslot (vf_netdev)) +continue ; + +netvsc_prepare_bonding (vf_netdev); +netvsc_register_vf (vf_netdev,VF_REG_IN_PROBE ); +__netvsc_vf_setup (net, vf_netdev); +break ; + }rtnl_unlock ();netvsc_devinfo_put (device_info);
@@ -2770,28 +2823,17 @@ static int netvsc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); +int ret =0 ; -/* Skip our own events */ -if (event_dev->netdev_ops == &device_ops) -return NOTIFY_DONE ; - -/* Avoid non-Ethernet type devices */ -if (event_dev->type !=ARPHRD_ETHER ) -return NOTIFY_DONE ; - -/* Avoid Vlan dev with same MAC registering as VF */ -if (is_vlan_dev (event_dev)) -return NOTIFY_DONE ; - -/* Avoid Bonding master dev with same MAC registering as VF */ -if (netif_is_bond_master (event_dev)) + ret =check_dev_is_matching_vf (event_dev); +if (ret !=0 )return NOTIFY_DONE ;switch (event) {case NETDEV_POST_INIT :return netvsc_prepare_bonding (event_dev);case NETDEV_REGISTER : -return netvsc_register_vf (event_dev); +return netvsc_register_vf (event_dev,VF_REG_IN_NOTIFIER );case NETDEV_UNREGISTER :return netvsc_unregister_vf (event_dev);case NETDEV_UP :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 56/76 drm/amd/display: Re-arrange FPU code structure for dcn2x
In reply to Sasha LevinFrom: Qingqing Zhuo <[email protected]>
[ Upstream commit ee37341199c61558b73113659695c90bf4736eb2 ]
[Why]
Current FPU code for DCN2x is located under dml/dcn2x. This is not aligned with DC's general source tree structure.
[How]
Move FPU code for DCN2x to dml/dcn20.
Stable-dep-of: e63e35f0164c ("drm/amd/display: Increase frame-larger-than for all display_mode_vba files")
---
drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 2 +-
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +-
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +-
drivers/gpu/drm/amd/display/dc/dml/Makefile | 4 ++--
.../amd/display/dc/dml/{dcn2x/dcn2x.c => dcn20/dcn20_fpu.c} | 2 +-
.../amd/display/dc/dml/{dcn2x/dcn2x.h => dcn20/dcn20_fpu.h} | 6 +++---
6 files changed, 9 insertions(+), 9 deletions(-)
rename drivers/gpu/drm/amd/display/dc/dml/{dcn2x/dcn2x.c => dcn20/dcn20_fpu.c} (99%)
rename drivers/gpu/drm/amd/display/dc/dml/{dcn2x/dcn2x.h => dcn20/dcn20_fpu.h} (94%)drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c +1 -1
@@ -52,7 +52,7 @@ static DEFINE_PER_CPU(int, fpu_recursion_depth);* This function tells if the code is already under FPU protection or not. A * function that works as an API for a set of FPU operations can use this * function for checking if the caller invoked it after DC_FP_START(). For -* example, take a look at dcn2x.c file. +* example, take a look at dcn20_fpu.c file. */ inline void dc_assert_fp_enabled (void ) {
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 -1
@@ -35,7 +35,7 @@#include "include/irq_service_interface.h" #include "dcn20/dcn20_resource.h" -#include "dml/dcn2x/dcn2x.h" +#include "dml/dcn20/dcn20_fpu.h" #include "dcn10/dcn10_hubp.h" #include "dcn10/dcn10_ipp.h"
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +1 -1
@@ -35,7 +35,7 @@#include "include/irq_service_interface.h" #include "dcn20/dcn20_resource.h" -#include "dml/dcn2x/dcn2x.h" +#include "dml/dcn20/dcn20_fpu.h" #include "clk_mgr.h" #include "dcn10/dcn10_hubp.h"
drivers/gpu/drm/amd/display/dc/dml/Makefile +2 -2
@@ -58,7 +58,7 @@ CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags) ifdef CONFIG_DRM_AMD_DC_DCN CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_vba.o := $(dml_ccflags) -CFLAGS_$(AMDDALPATH)/dc/dml/dcn2x/dcn2x.o := $(dml_ccflags) +CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/dcn20_fpu.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20.o := $(dml_ccflags)
@@ -95,8 +95,8 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/display_rq_dlg_helpers.o := $(dml_rcflags) DML = display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \ ifdef CONFIG_DRM_AMD_DC_DCN +DML += dcn20/dcn20_fpu.o DML += display_mode_vba.o dcn20/display_rq_dlg_calc_20.o dcn20/display_mode_vba_20.o -DML += dcn2x/dcn2x.o DML += dcn20/display_rq_dlg_calc_20v2.o dcn20/display_mode_vba_20v2.o DML += dcn21/display_rq_dlg_calc_21.o dcn21/display_mode_vba_21.o DML += dcn30/display_mode_vba_30.o dcn30/display_rq_dlg_calc_30.o
drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c renamed from drivers/gpu/drm/amd/display/dc/dml/dcn2x/dcn2x.c +1 -1
@@ -26,7 +26,7 @@#include "resource.h" -#include "dcn2x.h" +#include "dcn20_fpu.h" /** * DOC: DCN2x FPU manipulation Overview
drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h renamed from drivers/gpu/drm/amd/display/dc/dml/dcn2x/dcn2x.h +3 -3
@@ -24,11 +24,11 @@* */ -#ifndef __DCN2X_H__ -#define __DCN2X_H__ +#ifndef __DCN20_FPU_H__ +#define __DCN20_FPU_H__void dcn20_populate_dml_writeback_from_context (struct dc *dc,struct resource_context *res_ctx,display_e2e_pipe_params_st *pipes); -#endif /* __DCN2X_H__ */ +#endif /* __DCN20_FPU_H__ */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 57/76 drm/amd/display: move calcs folder into DML
In reply to Sasha LevinFrom: Isabella Basso <[email protected]>
[ Upstream commit 552b7cb0eed12c184b3bdfcc262e96a954a2bc86 ]
The calcs folder has FPU code on it, which should be isolated inside the DML folder as per https://patchwork.freedesktop.org/series/93042/.
This commit aims single-handedly to correct the location of such FPU code and does not refactor any functions.
Changes since v2:
- Corrected problems to compile when DCN was disabled.
Stable-dep-of: e63e35f0164c ("drm/amd/display: Increase frame-larger-than for all display_mode_vba files")
---
drivers/gpu/drm/amd/display/dc/Makefile | 4 +-
drivers/gpu/drm/amd/display/dc/calcs/Makefile | 68 -------------------
drivers/gpu/drm/amd/display/dc/dml/Makefile | 10 ++-
.../amd/display/dc/{ => dml}/calcs/bw_fixed.c | 0
.../display/dc/{ => dml}/calcs/calcs_logger.h | 0
.../display/dc/{ => dml}/calcs/custom_float.c | 0
.../display/dc/{ => dml}/calcs/dce_calcs.c | 0
.../dc/{ => dml}/calcs/dcn_calc_auto.c | 0
.../dc/{ => dml}/calcs/dcn_calc_auto.h | 0
.../dc/{ => dml}/calcs/dcn_calc_math.c | 0
.../display/dc/{ => dml}/calcs/dcn_calcs.c | 0
11 files changed, 11 insertions(+), 71 deletions(-)
delete mode 100644 drivers/gpu/drm/amd/display/dc/calcs/Makefile
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/bw_fixed.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/calcs_logger.h (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/custom_float.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dce_calcs.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dcn_calc_auto.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dcn_calc_auto.h (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dcn_calc_math.c (100%)
rename drivers/gpu/drm/amd/display/dc/{ => dml}/calcs/dcn_calcs.c (100%)drivers/gpu/drm/amd/display/dc/Makefile +2 -2
@@ -23,12 +23,12 @@ # Makefile for Display Core (dc) component. # -DC_LIBS = basics bios calcs clk_mgr dce gpio irq virtual +DC_LIBS = basics bios clk_mgr dce dml gpio irq virtual ifdef CONFIG_DRM_AMD_DC_DCN DC_LIBS += dcn20 DC_LIBS += dsc -DC_LIBS += dcn10 dml +DC_LIBS += dcn10 DC_LIBS += dcn21 DC_LIBS += dcn30 DC_LIBS += dcn301
drivers/gpu/drm/amd/display/dc/calcs/Makefile deleted +0 -68
68 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/Makefile +9 -1
@@ -72,6 +72,9 @@ CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_mode_vba_31.o := $(dml_ccflags) $(fram CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_rq_dlg_calc_31.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dsc/rc_calc_fpu.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags) +CFLAGS_$(AMDDALPATH)/dc/dml/calcs/dcn_calcs.o := $(dml_ccflags) +CFLAGS_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_auto.o := $(dml_ccflags) +CFLAGS_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_math.o := $(dml_ccflags) -Wno-tautological-compare CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/display_mode_vba.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn2x/dcn2x.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_rcflags)
@@ -91,10 +94,14 @@ CFLAGS_$(AMDDALPATH)/dc/dml/dml1_display_rq_dlg_calc.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/display_rq_dlg_helpers.o := $(dml_ccflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dml1_display_rq_dlg_calc.o := $(dml_rcflags) CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/display_rq_dlg_helpers.o := $(dml_rcflags) +CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calcs.o := $(dml_rcflags) +CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_auto.o := $(dml_rcflags) +CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_math.o := $(dml_rcflags) -DML = display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \ +DML = calcs/dce_calcs.o calcs/custom_float.o calcs/bw_fixed.o ifdef CONFIG_DRM_AMD_DC_DCN +DML += display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o DML += dcn20/dcn20_fpu.o DML += display_mode_vba.o dcn20/display_rq_dlg_calc_20.o dcn20/display_mode_vba_20.o DML += dcn20/display_rq_dlg_calc_20v2.o dcn20/display_mode_vba_20v2.o
@@ -102,6 +109,7 @@ DML += dcn21/display_rq_dlg_calc_21.o dcn21/display_mode_vba_21.o DML += dcn30/display_mode_vba_30.o dcn30/display_rq_dlg_calc_30.o DML += dcn31/display_mode_vba_31.o dcn31/display_rq_dlg_calc_31.o DML += dsc/rc_calc_fpu.o +DML += calcs/dcn_calcs.o calcs/dcn_calc_math.o calcs/dcn_calc_auto.o endif AMD_DAL_DML = $(addprefix $(AMDDALPATH)/dc/dml/,$(DML))
drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c renamed from drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c +0 -0
drivers/gpu/drm/amd/display/dc/dml/calcs/calcs_logger.h renamed from drivers/gpu/drm/amd/display/dc/calcs/calcs_logger.h +0 -0
drivers/gpu/drm/amd/display/dc/dml/calcs/custom_float.c renamed from drivers/gpu/drm/amd/display/dc/calcs/custom_float.c +0 -0
drivers/gpu/drm/amd/display/dc/dml/calcs/dce_calcs.c renamed from drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +0 -0
drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_auto.c renamed from drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c +0 -0
drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_auto.h renamed from drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.h +0 -0
drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c renamed from drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.c +0 -0
drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c renamed from drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +0 -0
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 58/76 drm/amd/display: remove DML Makefile duplicate lines
In reply to Sasha LevinFrom: Magali Lemes <[email protected]>
[ Upstream commit 41ead3e0cdc03d64b7da2dcb1fd70ebb7164228b ]
There are two identical CFLAGS entries for "display_mode_vba_20.o", so remove one of them. Also, as there's already an entry for "display_mode_lib.o" CFLAGS, regardless of CONFIG_DRM_AMD_DC_DCN being defined or not, remove the one entry between CONFIG_DRM_AMD_DC_DCN ifdef guards.
Stable-dep-of: e63e35f0164c ("drm/amd/display: Increase frame-larger-than for all display_mode_vba files")
--- drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -2
@@ -60,7 +60,6 @@ ifdef CONFIG_DRM_AMD_DC_DCN CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_vba.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/dcn20_fpu.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags) -CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20v2.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20v2.o := $(dml_ccflags)
@@ -71,7 +70,6 @@ CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_rq_dlg_calc_30.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_mode_vba_31.o := $(dml_ccflags) $(frame_warn_flag) CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_rq_dlg_calc_31.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dsc/rc_calc_fpu.o := $(dml_ccflags) -CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/calcs/dcn_calcs.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_auto.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_math.o := $(dml_ccflags) -Wno-tautological-compare
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 59/76 drm/amd/display: Increase frame-larger-than for all display_mode_vba files
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit e63e35f0164c43fbc1adb481d6604f253b9f9667 ]
After a recent change in LLVM, allmodconfig (which has CONFIG_KCSAN=y and CONFIG_WERROR=y enabled) has a few new instances of -Wframe-larger-than for the mode support and system configuration functions:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn20/display_mode_vba_20v2.c:3393:6: error: stack frame size (2144) exceeds limit (2048) in 'dml20v2_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
3393 | void dml20v2_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
| ^
1 error generated.
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:3520:6: error: stack frame size (2192) exceeds limit (2048) in 'dml21_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
3520 | void dml21_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
| ^
1 error generated.
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn20/display_mode_vba_20.c:3286:6: error: stack frame size (2128) exceeds limit (2048) in 'dml20_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
3286 | void dml20_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
| ^
1 error generated.
Without the sanitizers enabled, there are no warnings.
This was the catalyst for commit 6740ec97bcdb ("drm/amd/display:
Increase frame warning limit with KASAN or KCSAN in dml2") and that same change was made to dml in commit 5b750b22530f ("drm/amd/display:
Increase frame warning limit with KASAN or KCSAN in dml") but the frame_warn_flag variable was not applied to all files. Do so now to clear up the warnings and make all these files consistent.
--- drivers/gpu/drm/amd/display/dc/dml/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/Makefile +3 -3
@@ -59,11 +59,11 @@ CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags) ifdef CONFIG_DRM_AMD_DC_DCN CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_vba.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/dcn20_fpu.o := $(dml_ccflags) -CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags) +CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags) $(frame_warn_flag) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20.o := $(dml_ccflags) -CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20v2.o := $(dml_ccflags) +CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20v2.o := $(dml_ccflags) $(frame_warn_flag) CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20v2.o := $(dml_ccflags) -CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_mode_vba_21.o := $(dml_ccflags) +CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_mode_vba_21.o := $(dml_ccflags) $(frame_warn_flag) CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_rq_dlg_calc_21.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_mode_vba_30.o := $(dml_ccflags) $(frame_warn_flag) CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_rq_dlg_calc_30.o := $(dml_ccflags)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 60/76 getrusage: add the "signal_struct *sig" local variable
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit c7ac8231ace9b07306d0299969e42073b189c70a ]
No functional changes, cleanup/preparation.
Stable-dep-of: daa694e41375 ("getrusage: move thread_group_cputime_adjusted() outside of lock_task_sighand()")
--- kernel/sys.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-)
kernel/sys.c +19 -18
@@ -1764,6 +1764,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)unsigned long flags;u64 tgutime, tgstime, utime, stime;unsigned long maxrss =0 ; +struct signal_struct *sig = p->signal;memset ((char *)r,0 ,sizeof (*r)); utime = stime =0 ;
@@ -1771,7 +1772,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)if (who ==RUSAGE_THREAD ) {task_cputime_adjusted (current, &utime, &stime);accumulate_thread_rusage (p, r); - maxrss = p->signal->maxrss; + maxrss = sig->maxrss; goto out; }
@@ -1781,15 +1782,15 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)switch (who) {case RUSAGE_BOTH :case RUSAGE_CHILDREN : - utime = p->signal->cutime; - stime = p->signal->cstime; - r->ru_nvcsw = p->signal->cnvcsw; - r->ru_nivcsw = p->signal->cnivcsw; - r->ru_minflt = p->signal->cmin_flt; - r->ru_majflt = p->signal->cmaj_flt; - r->ru_inblock = p->signal->cinblock; - r->ru_oublock = p->signal->coublock; - maxrss = p->signal->cmaxrss; + utime = sig->cutime; + stime = sig->cstime; + r->ru_nvcsw = sig->cnvcsw; + r->ru_nivcsw = sig->cnivcsw; + r->ru_minflt = sig->cmin_flt; + r->ru_majflt = sig->cmaj_flt; + r->ru_inblock = sig->cinblock; + r->ru_oublock = sig->coublock; + maxrss = sig->cmaxrss;if (who ==RUSAGE_CHILDREN )break ;
@@ -1799,14 +1800,14 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)thread_group_cputime_adjusted (p, &tgutime, &tgstime); utime += tgutime; stime += tgstime; - r->ru_nvcsw += p->signal->nvcsw; - r->ru_nivcsw += p->signal->nivcsw; - r->ru_minflt += p->signal->min_flt; - r->ru_majflt += p->signal->maj_flt; - r->ru_inblock += p->signal->inblock; - r->ru_oublock += p->signal->oublock; -if (maxrss < p->signal->maxrss) - maxrss = p->signal->maxrss; + r->ru_nvcsw += sig->nvcsw; + r->ru_nivcsw += sig->nivcsw; + r->ru_minflt += sig->min_flt; + r->ru_majflt += sig->maj_flt; + r->ru_inblock += sig->inblock; + r->ru_oublock += sig->oublock; +if (maxrss < sig->maxrss) + maxrss = sig->maxrss; t = p; do { accumulate_thread_rusage(t, r);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 61/76 getrusage: move thread_group_cputime_adjusted() outside of lock_task_sighand()
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit daa694e4137571b4ebec330f9a9b4d54aa8b8089 ]
Patch series "getrusage: use sig->stats_lock", v2.
This patch (of 2):
thread_group_cputime() does its own locking, we can safely shift thread_group_cputime_adjusted() which does another for_each_thread loop outside of ->siglock protected section.
This is also preparation for the next patch which changes getrusage() to use stats_lock instead of siglock, thread_group_cputime() takes the same lock. With the current implementation recursive read_seqbegin_or_lock() is fine, thread_group_cputime() can't enter the slow mode if the caller holds stats_lock, yet this looks more safe and better performance-wise.
--- kernel/sys.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
kernel/sys.c +19 -15
@@ -1763,17 +1763,19 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)struct task_struct *t;unsigned long flags;u64 tgutime, tgstime, utime, stime; -unsigned long maxrss =0 ; +unsigned long maxrss; +struct mm_struct *mm;struct signal_struct *sig = p->signal; -memset ((char *)r,0 ,sizeof (*r)); +memset (r,0 ,sizeof (*r)); utime = stime =0 ; + maxrss =0 ;if (who ==RUSAGE_THREAD ) {task_cputime_adjusted (current, &utime, &stime);accumulate_thread_rusage (p, r); maxrss = sig->maxrss; - goto out; + goto out_thread; }if (!lock_task_sighand (p, &flags))
@@ -1797,9 +1799,6 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) fallthrough;case RUSAGE_SELF : -thread_group_cputime_adjusted (p, &tgutime, &tgstime); - utime += tgutime; - stime += tgstime; r->ru_nvcsw += sig->nvcsw; r->ru_nivcsw += sig->nivcsw; r->ru_minflt += sig->min_flt;
@@ -1819,19 +1818,24 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) }unlock_task_sighand (p, &flags); -out: - r->ru_utime =ns_to_kernel_old_timeval (utime); - r->ru_stime =ns_to_kernel_old_timeval (stime); +if (who ==RUSAGE_CHILDREN ) + goto out_children; -if (who !=RUSAGE_CHILDREN ) { -struct mm_struct *mm =get_task_mm (p); +thread_group_cputime_adjusted (p, &tgutime, &tgstime); + utime += tgutime; + stime += tgstime; -if (mm) { -setmax_mm_hiwater_rss (&maxrss, mm); -mmput (mm); - } +out_thread: + mm =get_task_mm (p); +if (mm) { +setmax_mm_hiwater_rss (&maxrss, mm); +mmput (mm); } + +out_children: r->ru_maxrss = maxrss * (PAGE_SIZE /1024 );/* convert pages to KBs */ + r->ru_utime =ns_to_kernel_old_timeval (utime); + r->ru_stime =ns_to_kernel_old_timeval (stime); } SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 62/76 getrusage: use __for_each_thread()
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit 13b7bc60b5353371460a203df6c38ccd38ad7a3a ]
do/while_each_thread should be avoided when possible.
Plus this change allows to avoid lock_task_sighand(), we can use rcu and/or sig->stats_lock instead.
Stable-dep-of: f7ec1cd5cc7e ("getrusage: use sig->stats_lock rather than lock_task_sighand()")
--- kernel/sys.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/sys.c +1 -3
@@ -1807,10 +1807,8 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) r->ru_oublock += sig->oublock;if (maxrss < sig->maxrss) maxrss = sig->maxrss; - t = p; - do { +__for_each_thread (sig, t)accumulate_thread_rusage (t, r); - } while_each_thread(p, t);break ;default :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 63/76 getrusage: use sig->stats_lock rather than lock_task_sighand()
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit f7ec1cd5cc7ef3ad964b677ba82b8b77f1c93009 ]
lock_task_sighand() can trigger a hard lockup. If NR_CPUS threads call getrusage() at the same time and the process has NR_THREADS, spin_lock_irq will spin with irqs disabled O(NR_CPUS * NR_THREADS) time.
Change getrusage() to use sig->stats_lock, it was specifically designed for this type of use. This way it runs lockless in the likely case.
TODO:
- Change do_task_stat() to use sig->stats_lock too, then we can remove spin_lock_irq(siglock) in wait_task_zombie().
- Turn sig->stats_lock into seqcount_rwlock_t, this way the readers in the slow mode won't exclude each other. See
https://lore.kernel.org/all/[email protected]/
- stats_lock has to disable irqs because ->siglock can be taken in irq context, it would be very nice to change __exit_signal() to avoid the siglock->stats_lock dependency.
--- kernel/sys.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
kernel/sys.c +13 -3
@@ -1766,7 +1766,9 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)unsigned long maxrss;struct mm_struct *mm;struct signal_struct *sig = p->signal; +unsigned int seq =0 ; +retry:memset (r,0 ,sizeof (*r)); utime = stime =0 ; maxrss =0 ;
@@ -1778,8 +1780,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) goto out_thread; } -if (!lock_task_sighand (p, &flags)) -return ; + flags =read_seqbegin_or_lock_irqsave (&sig->stats_lock, &seq);switch (who) {case RUSAGE_BOTH :
@@ -1807,14 +1808,23 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) r->ru_oublock += sig->oublock;if (maxrss < sig->maxrss) maxrss = sig->maxrss; + +rcu_read_lock ();__for_each_thread (sig, t)accumulate_thread_rusage (t, r); +rcu_read_unlock (); +break ;default :BUG (); } -unlock_task_sighand (p, &flags); + +if (need_seqretry (&sig->stats_lock, seq)) { + seq =1 ; + goto retry; + } +done_seqretry_irqrestore (&sig->stats_lock, seq, flags);if (who ==RUSAGE_CHILDREN ) goto out_children;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 64/76 proc: Use task_is_running() for wchan in /proc/$pid/stat
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 4e046156792c26bef8a4e30be711777fc8578257 ]
The implementations of get_wchan() can be expensive. The only information imparted here is whether or not a process is currently blocked in the scheduler (and even this doesn't need to be exact). Avoid doing the heavy lifting of stack walking and just report that information by using task_is_running().
Stable-dep-of: 60f92acb60a9 ("fs/proc: do_task_stat: move thread_group_cputime_adjusted() outside of lock_task_sighand()")
--- fs/proc/array.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/proc/array.c +2 -5
@@ -541,7 +541,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, }if (permitted && (!whole || num_threads <2 )) - wchan =get_wchan (task); + wchan = !task_is_running (task);if (!whole) { min_flt = task->min_flt; maj_flt = task->maj_flt;
@@ -606,10 +606,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,* * This works with older implementations of procps as well. */ -if (wchan) -seq_puts (m," 1" ); -else -seq_puts (m," 0" ); +seq_put_decimal_ull (m," " , wchan);seq_put_decimal_ull (m," " ,0 );seq_put_decimal_ull (m," " ,0 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 65/76 fs/proc: do_task_stat: move thread_group_cputime_adjusted() outside of lock_task_sighand()
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit 60f92acb60a989b14e4b744501a0df0f82ef30a3 ]
Patch series "fs/proc: do_task_stat: use sig->stats_".
do_task_stat() has the same problem as getrusage() had before "getrusage:
use sig->stats_lock rather than lock_task_sighand()": a hard lockup. If NR_CPUS threads call lock_task_sighand() at the same time and the process has NR_THREADS, spin_lock_irq will spin with irqs disabled O(NR_CPUS * NR_THREADS) time.
This patch (of 3):
thread_group_cputime() does its own locking, we can safely shift thread_group_cputime_adjusted() which does another for_each_thread loop outside of ->siglock protected section.
Not only this removes for_each_thread() from the critical section with irqs disabled, this removes another case when stats_lock is taken with siglock held. We want to remove this dependency, then we can change the users of stats_lock to not disable irqs.
--- fs/proc/array.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/proc/array.c +6 -4
@@ -495,7 +495,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,sigemptyset (&sigign);sigemptyset (&sigcatch); - cutime = cstime = utime = stime =0 ; + cutime = cstime =0 ; cgtime = gtime =0 ;if (lock_task_sighand (task, &flags)) {
@@ -529,7 +529,6 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, min_flt += sig->min_flt; maj_flt += sig->maj_flt; -thread_group_cputime_adjusted (task, &utime, &stime); gtime += sig->gtime; }
@@ -542,10 +541,13 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,if (permitted && (!whole || num_threads <2 )) wchan = !task_is_running (task); -if (!whole) { + +if (whole) { +thread_group_cputime_adjusted (task, &utime, &stime); + }else { +task_cputime_adjusted (task, &utime, &stime); min_flt = task->min_flt; maj_flt = task->maj_flt; -task_cputime_adjusted (task, &utime, &stime); gtime =task_gtime (task); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 66/76 exit: Fix typo in comment: s/sub-theads/sub-threads
In reply to Sasha LevinFrom: Ingo Molnar <[email protected]>
[ Upstream commit dcca34754a3f5290406403b8066e3b15dda9f4bf ]
Stable-dep-of: c1be35a16b2f ("exit: wait_task_zombie: kill the no longer necessary spin_lock_irq(siglock)")
--- kernel/exit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/exit.c +1 -1
@@ -1119,7 +1119,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)* p->signal fields because the whole thread group is dead * and nobody can change them. * -* psig->stats_lock also protects us from our sub-theads +* psig->stats_lock also protects us from our sub-threads * which can reap other children at the same time. Until * we change k_getrusage()-like users to rely on this lock * we have to take ->siglock as well.
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 67/76 exit: wait_task_zombie: kill the no longer necessary spin_lock_irq(siglock)
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit c1be35a16b2f1fe21f4f26f9de030ad6eaaf6a25 ]
After the recent changes nobody use siglock to read the values protected by stats_lock, we can kill spin_lock_irq(¤t->sighand->siglock) and update the comment.
With this patch only __exit_signal() and thread_group_start_cputime() take stats_lock under siglock.
--- kernel/exit.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
kernel/exit.c +3 -7
@@ -1120,17 +1120,14 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)* and nobody can change them. * * psig->stats_lock also protects us from our sub-threads -* which can reap other children at the same time. Until -* we change k_getrusage()-like users to rely on this lock -* we have to take ->siglock as well. +* which can reap other children at the same time. * * We use thread_group_cputime_adjusted() to get times for * the thread group, which consolidates times for all threads * in the group including the group leader. */ thread_group_cputime_adjusted (p, &tgutime, &tgstime); -spin_lock_irq (¤t->sighand->siglock); -write_seqlock (&psig->stats_lock); +write_seqlock_irq (&psig->stats_lock); psig->cutime += tgutime + sig->cutime; psig->cstime += tgstime + sig->cstime; psig->cgtime +=task_gtime (p) + sig->gtime + sig->cgtime;
@@ -1153,8 +1150,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) psig->cmaxrss = maxrss;task_io_accounting_add (&psig->ioac, &p->ioac);task_io_accounting_add (&psig->ioac, &sig->ioac); -write_sequnlock (&psig->stats_lock); -spin_unlock_irq (¤t->sighand->siglock); +write_sequnlock_irq (&psig->stats_lock); }if (wo->wo_rusage)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 68/76 ALSA: usb-audio: Fix wrong kfree issue in snd_usb_endpoint_free_all
In reply to Sasha LevinFrom: Wan Jiabing <[email protected]>
[ Upstream commit 03a8b0df757f1beb21ba1626e23ca7412e48b525 ]
Fix following coccicheck error:
./sound/usb/endpoint.c:1671:8-10: ERROR: reference preceded by free on line 1671.
Here should be 'cp' rather than 'ip'.
--- sound/usb/endpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/endpoint.c +1 -1
@@ -1720,7 +1720,7 @@ void snd_usb_endpoint_free_all(struct snd_usb_audio *chip)kfree (ip);list_for_each_entry_safe (cp, cn, &chip->clock_ref_list, list) -kfree (ip); +kfree (cp); }/*
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 69/76 ALSA: usb-audio: Always initialize fixed_rate in snd_usb_find_implicit_fb_sync_format()
In reply to Sasha LevinFrom: Jaroslav Kysela <[email protected]>
[ Upstream commit 291e9da91403e0e628d7692b5ed505100e7b7706 ]
Handle the fallback code path, too.
--- sound/usb/implicit.c | 3 ++- sound/usb/pcm.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
sound/usb/implicit.c +2 -1
@@ -471,7 +471,7 @@ snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip, subs =find_matching_substream (chip, stream, target->sync_ep, target->fmt_type);if (!subs) -return sync_fmt; + goto end; high_score =0 ;list_for_each_entry (fp, &subs->fmt_list, list) {
@@ -485,6 +485,7 @@ snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip, } } + end:if (fixed_rate) *fixed_rate =snd_usb_pcm_has_fixed_rate (subs);return sync_fmt;
sound/usb/pcm.c +2 -0
@@ -163,6 +163,8 @@ bool snd_usb_pcm_has_fixed_rate(struct snd_usb_substream *subs)struct snd_usb_audio *chip = subs->stream->chip;int rate =-1 ; +if (!subs) +return false;if (!(chip->quirk_flags &QUIRK_FLAG_FIXED_RATE ))return false;list_for_each_entry (fp, &subs->fmt_list, list) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 70/76 ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum610 Wireless
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit dfd5fe19db7dc7006642f8109ee8965e5d031897 ]
JBL Quantum610 Wireless (0ecb:205c) requires the same workaround that was used for JBL Quantum810 for limiting the sample rate.
Stable-dep-of: 668abe6dc7b6 ("ALSA: usb-audio: Sort quirk table entries")
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -1896,6 +1896,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GENERIC_IMPLICIT_FB),DEVICE_FLG (0x0525 ,0xa4ad ,/* Hamedal C20 usb camero */ QUIRK_FLAG_IFACE_SKIP_CLOSE ), +DEVICE_FLG (0x0ecb ,0x205c ,/* JBL Quantum610 Wireless */ +QUIRK_FLAG_FIXED_RATE ),DEVICE_FLG (0x0ecb ,0x2069 ,/* JBL Quantum810 Wireless */ QUIRK_FLAG_FIXED_RATE ), DEVICE_FLG(0x1bcf, 0x2283, /* NexiGo N930AF FHD Webcam */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 71/76 ALSA: usb-audio: Sort quirk table entries
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 668abe6dc7b61941fa5c724c06797efb0b87f070 ]
The quirk table entries should be put in the USB ID order, but some entries have been put in random places. Re-sort them.
--- sound/usb/quirks.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
sound/usb/quirks.c +18 -18
@@ -1765,6 +1765,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GET_SAMPLE_RATE),DEVICE_FLG (0x04e8 ,0xa051 ,/* Samsung USBC Headset (AKG) */ QUIRK_FLAG_SKIP_CLOCK_SELECTOR |QUIRK_FLAG_CTL_MSG_DELAY_5M ), +DEVICE_FLG (0x0525 ,0xa4ad ,/* Hamedal C20 usb camero */ +QUIRK_FLAG_IFACE_SKIP_CLOSE ),DEVICE_FLG (0x054c ,0x0b8c ,/* Sony WALKMAN NW-A45 DAC */ QUIRK_FLAG_SET_IFACE_FIRST ), DEVICE_FLG(0x0556, 0x0014, /* Phoenix Audio TMX320VC */
@@ -1808,8 +1810,14 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_CTL_MSG_DELAY_1M),DEVICE_FLG (0x0b0e ,0x0349 ,/* Jabra 550a */ QUIRK_FLAG_CTL_MSG_DELAY_1M ), +DEVICE_FLG (0x0ecb ,0x205c ,/* JBL Quantum610 Wireless */ +QUIRK_FLAG_FIXED_RATE ), +DEVICE_FLG (0x0ecb ,0x2069 ,/* JBL Quantum810 Wireless */ +QUIRK_FLAG_FIXED_RATE ),DEVICE_FLG (0x0fd9 ,0x0008 ,/* Hauppauge HVR-950Q */ QUIRK_FLAG_SHARE_MEDIA_DEVICE |QUIRK_FLAG_ALIGN_TRANSFER ), +DEVICE_FLG (0x1224 ,0x2a25 ,/* Jieli Technology USB PHY 2.0 */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x1395 ,0x740a ,/* Sennheiser DECT */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x1397, 0x0507, /* Behringer UMC202HD */
@@ -1840,6 +1848,10 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_ITF_USB_DSD_DAC | QUIRK_FLAG_CTL_MSG_DELAY),DEVICE_FLG (0x1901 ,0x0191 ,/* GE B850V3 CP2114 audio interface */ QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x19f7 ,0x0035 ,/* RODE NT-USB+ */ +QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x1bcf ,0x2283 ,/* NexiGo N930AF FHD Webcam */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x2040 ,0x7200 ,/* Hauppauge HVR-950Q */ QUIRK_FLAG_SHARE_MEDIA_DEVICE |QUIRK_FLAG_ALIGN_TRANSFER ), DEVICE_FLG(0x2040, 0x7201, /* Hauppauge HVR-950Q-MXL */
@@ -1878,6 +1890,12 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_IGNORE_CTL_ERROR),DEVICE_FLG (0x2912 ,0x30c8 ,/* Audioengine D1 */ QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x2b53 ,0x0023 ,/* Fiero SC-01 (firmware v1.0.0 @ 48 kHz) */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ), +DEVICE_FLG (0x2b53 ,0x0024 ,/* Fiero SC-01 (firmware v1.0.0 @ 96 kHz) */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ), +DEVICE_FLG (0x2b53 ,0x0031 ,/* Fiero SC-01 (firmware v1.1.0) */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ),DEVICE_FLG (0x30be ,0x0101 ,/* Schiit Hel */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */
@@ -1886,24 +1904,6 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_ALIGN_TRANSFER),DEVICE_FLG (0x534d ,0x2109 ,/* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER ), -DEVICE_FLG (0x1224 ,0x2a25 ,/* Jieli Technology USB PHY 2.0 */ -QUIRK_FLAG_GET_SAMPLE_RATE ), -DEVICE_FLG (0x2b53 ,0x0023 ,/* Fiero SC-01 (firmware v1.0.0 @ 48 kHz) */ -QUIRK_FLAG_GENERIC_IMPLICIT_FB ), -DEVICE_FLG (0x2b53 ,0x0024 ,/* Fiero SC-01 (firmware v1.0.0 @ 96 kHz) */ -QUIRK_FLAG_GENERIC_IMPLICIT_FB ), -DEVICE_FLG (0x2b53 ,0x0031 ,/* Fiero SC-01 (firmware v1.1.0) */ -QUIRK_FLAG_GENERIC_IMPLICIT_FB ), -DEVICE_FLG (0x0525 ,0xa4ad ,/* Hamedal C20 usb camero */ -QUIRK_FLAG_IFACE_SKIP_CLOSE ), -DEVICE_FLG (0x0ecb ,0x205c ,/* JBL Quantum610 Wireless */ -QUIRK_FLAG_FIXED_RATE ), -DEVICE_FLG (0x0ecb ,0x2069 ,/* JBL Quantum810 Wireless */ -QUIRK_FLAG_FIXED_RATE ), -DEVICE_FLG (0x1bcf ,0x2283 ,/* NexiGo N930AF FHD Webcam */ -QUIRK_FLAG_GET_SAMPLE_RATE ), -DEVICE_FLG (0x19f7 ,0x0035 ,/* RODE NT-USB+ */ -QUIRK_FLAG_GET_SAMPLE_RATE ),/* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 72/76 regmap: allow to define reg_update_bits for no bus configuration
In reply to Sasha LevinFrom: Ansuel Smith <[email protected]>
[ Upstream commit 02d6fdecb9c38de19065f6bed8d5214556fd061d ]
Some device requires a special handling for reg_update_bits and can't use the normal regmap read write logic. An example is when locking is handled by the device and rmw operations requires to do atomic operations. Allow to declare a dedicated function in regmap_config for reg_update_bits in no bus configuration.
Stable-dep-of: 3f42b142ea11 ("serial: max310x: fix IO data corruption in batched operations")
--- drivers/base/regmap/regmap.c | 1 + include/linux/regmap.h | 7 +++++++ 2 files changed, 8 insertions(+)
drivers/base/regmap/regmap.c +1 -0
@@ -877,6 +877,7 @@ struct regmap *__regmap_init(struct device *dev,if (!bus) { map->reg_read = config->reg_read; map->reg_write = config->reg_write; + map->reg_update_bits = config->reg_update_bits; map->defer_caching = false; goto skip_format_initialization;
include/linux/regmap.h +7 -0
@@ -290,6 +290,11 @@ typedef void (*regmap_unlock)(void *);* read operation on a bus such as SPI, I2C, etc. Most of the * devices do not need this. * @reg_write: Same as above for writing. +* @reg_update_bits: Optional callback that if filled will be used to perform +* all the update_bits(rmw) operation. Should only be provided +* if the function require special handling with lock and reg +* handling and the operation cannot be represented as a simple +* update_bits operation on a bus such as SPI, I2C, etc. * @fast_io: Register IO is fast. Use a spinlock instead of a mutex * to perform locking. This field is ignored if custom lock/unlock * functions are used (see fields lock/unlock of struct regmap_config).
@@ -372,6 +377,8 @@ struct regmap_config {int (*reg_read)(void *context,unsigned int reg,unsigned int *val);int (*reg_write)(void *context,unsigned int reg,unsigned int val); +int (*reg_update_bits)(void *context,unsigned int reg, +unsigned int mask,unsigned int val);bool fast_io;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 73/76 regmap: Add bulk read/write callbacks into regmap_config
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit d77e745613680c54708470402e2b623dcd769681 ]
Currently the regmap_config structure only allows the user to implement single element register read/write using .reg_read/.reg_write callbacks. The regmap_bus already implements bulk counterparts of both, and is being misused as a workaround for the missing bulk read/write callbacks in regmap_config by a couple of drivers. To stop this misuse, add the bulk read/write callbacks to regmap_config and call them from the regmap core code.
Stable-dep-of: 3f42b142ea11 ("serial: max310x: fix IO data corruption in batched operations")
--- drivers/base/regmap/internal.h | 4 ++ drivers/base/regmap/regmap.c | 76 ++++++++++++++++++---------------- include/linux/regmap.h | 12 ++++++ 3 files changed, 56 insertions(+), 36 deletions(-)
drivers/base/regmap/internal.h +4 -0
@@ -108,6 +108,10 @@ struct regmap {int (*reg_write)(void *context,unsigned int reg,unsigned int val);int (*reg_update_bits)(void *context,unsigned int reg,unsigned int mask,unsigned int val); +/* Bulk read/write */ +int (*read)(void *context,const void *reg_buf,size_t reg_size, +void *val_buf,size_t val_size); +int (*write)(void *context,const void *data,size_t count);bool defer_caching;
drivers/base/regmap/regmap.c +40 -36
194 lines not on this page · raw message
include/linux/regmap.h +12 -0
@@ -295,6 +295,12 @@ typedef void (*regmap_unlock)(void *);* if the function require special handling with lock and reg * handling and the operation cannot be represented as a simple * update_bits operation on a bus such as SPI, I2C, etc. +* @read: Optional callback that if filled will be used to perform all the +* bulk reads from the registers. Data is returned in the buffer used +* to transmit data. +* @write: Same as above for writing. +* @max_raw_read: Max raw read size that can be used on the device. +* @max_raw_write: Max raw write size that can be used on the device. * @fast_io: Register IO is fast. Use a spinlock instead of a mutex * to perform locking. This field is ignored if custom lock/unlock * functions are used (see fields lock/unlock of struct regmap_config).
@@ -379,6 +385,12 @@ struct regmap_config {int (*reg_write)(void *context,unsigned int reg,unsigned int val);int (*reg_update_bits)(void *context,unsigned int reg,unsigned int mask,unsigned int val); +/* Bulk read/write */ +int (*read)(void *context,const void *reg_buf,size_t reg_size, +void *val_buf,size_t val_size); +int (*write)(void *context,const void *data,size_t count); +size_t max_raw_read; +size_t max_raw_write;bool fast_io;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 74/76 serial: max310x: make accessing revision id interface-agnostic
In reply to Sasha LevinFrom: Cosmin Tanislav <[email protected]>
[ Upstream commit b3883ab5e95713e479f774ea68be275413e8e5b2 ]
SPI can only use 5 address bits, since one bit is reserved for specifying R/W and 2 bits are used to specify the UART port. To access registers that have addresses past 0x1F, an extended register space can be enabled by writing to the GlobalCommand register (address 0x1F).
I2C uses 8 address bits. The R/W bit is placed in the slave address, and so is the UART port. Because of this, registers that have addresses higher than 0x1F can be accessed normally.
To access the RevID register, on SPI, 0xCE must be written to the 0x1F address to enable the extended register space, after which the RevID register is accessible at address 0x5. 0xCD must be written to the 0x1F address to disable the extended register space.
On I2C, the RevID register is accessible at address 0x25.
Create an interface config struct, and add a method for toggling the extended register space and a member for the RevId register address. Implement these for SPI.
Stable-dep-of: 3f42b142ea11 ("serial: max310x: fix IO data corruption in batched operations")
--- drivers/tty/serial/max310x.c | 40 +++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-)
drivers/tty/serial/max310x.c +30 -10
@@ -72,7 +72,7 @@#define MAX310X_GLOBALCMD_REG MAX310X_REG_1F/* Global Command (WO) */ /* Extended registers */ -#define MAX310X_REVID_EXTREG MAX310X_REG_05/* Revision ID */ +#define MAX310X_SPI_REVID_EXTREG MAX310X_REG_05/* Revision ID */ /* IRQ register bits */ #define MAX310X_IRQ_LSR_BIT (1 << 0)/* LSR interrupt */
@@ -253,6 +253,12 @@#define MAX14830_BRGCFG_CLKDIS_BIT (1 << 6)/* Clock Disable */ #define MAX14830_REV_ID (0xb0) +struct max310x_if_cfg { +int (*extended_reg_enable)(struct device *dev,bool enable); + +unsigned int rev_id_reg; +}; +struct max310x_devtype {char name[9 ];int nr;
@@ -275,6 +281,7 @@ struct max310x_one {struct max310x_port {const struct max310x_devtype *devtype; +const struct max310x_if_cfg *if_cfg;struct regmap *regmap;struct clk *clk;#ifdef CONFIG_GPIOLIB
@@ -364,13 +371,12 @@ static int max3109_detect(struct device *dev)unsigned int val =0 ;int ret; - ret =regmap_write (s->regmap,MAX310X_GLOBALCMD_REG , -MAX310X_EXTREG_ENBL ); + ret = s->if_cfg->extended_reg_enable (dev, true);if (ret)return ret; -regmap_read (s->regmap,MAX310X_REVID_EXTREG , &val); -regmap_write (s->regmap,MAX310X_GLOBALCMD_REG ,MAX310X_EXTREG_DSBL ); +regmap_read (s->regmap, s->if_cfg->rev_id_reg, &val); + s->if_cfg->extended_reg_enable (dev, false);if (((val & MAX310x_REV_MASK) !=MAX3109_REV_ID )) {dev_err (dev,"%s ID 0x%02x does not match\n" , s->devtype->name, val);
@@ -395,13 +401,12 @@ static int max14830_detect(struct device *dev)unsigned int val =0 ;int ret; - ret =regmap_write (s->regmap,MAX310X_GLOBALCMD_REG , -MAX310X_EXTREG_ENBL ); + ret = s->if_cfg->extended_reg_enable (dev, true);if (ret)return ret; -regmap_read (s->regmap,MAX310X_REVID_EXTREG , &val); -regmap_write (s->regmap,MAX310X_GLOBALCMD_REG ,MAX310X_EXTREG_DSBL ); +regmap_read (s->regmap, s->if_cfg->rev_id_reg, &val); + s->if_cfg->extended_reg_enable (dev, false);if (((val & MAX310x_REV_MASK) !=MAX14830_REV_ID )) {dev_err (dev,"%s ID 0x%02x does not match\n" , s->devtype->name, val);
@@ -1250,6 +1255,7 @@ static int max310x_gpio_set_config(struct gpio_chip *chip, unsigned int offset,#endif static int max310x_probe (struct device *dev,const struct max310x_devtype *devtype, +const struct max310x_if_cfg *if_cfg,struct regmap *regmaps[],int irq) {int i, ret, fmin, fmax, freq;
@@ -1308,6 +1314,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty s->regmap = regmaps[0 ]; s->devtype = devtype; + s->if_cfg = if_cfg;dev_set_drvdata (dev, s);/* Check device to ensure we are talking to what we expect */
@@ -1477,6 +1484,19 @@ static struct regmap_config regcfg = { };#ifdef CONFIG_SPI_MASTER +static int max310x_spi_extended_reg_enable (struct device *dev,bool enable) +{ +struct max310x_port *s =dev_get_drvdata (dev); + +return regmap_write (s->regmap,MAX310X_GLOBALCMD_REG , + enable ?MAX310X_EXTREG_ENBL :MAX310X_EXTREG_DSBL ); +} + +static const struct max310x_if_cfg __maybe_unused max310x_spi_if_cfg = { + .extended_reg_enable = max310x_spi_extended_reg_enable, + .rev_id_reg =MAX310X_SPI_REVID_EXTREG , +}; +static int max310x_spi_probe (struct spi_device *spi) {const struct max310x_devtype *devtype;
@@ -1503,7 +1523,7 @@ static int max310x_spi_probe(struct spi_device *spi) regmaps[i] =devm_regmap_init_spi (spi, ®cfg); } -return max310x_probe (&spi->dev, devtype, regmaps, spi->irq); +return max310x_probe (&spi->dev, devtype, &max310x_spi_if_cfg, regmaps, spi->irq); }static int max310x_spi_remove (struct spi_device *spi)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 75/76 serial: max310x: fix IO data corruption in batched operations
In reply to Sasha LevinFrom: Jan Kundrát <[email protected]>
[ Upstream commit 3f42b142ea1171967e40e10e4b0241c0d6d28d41 ]
After upgrading from 5.16 to 6.1, our board with a MAX14830 started producing lots of garbage data over UART. Bisection pointed out commit 285e76fc049c as the culprit. That patch tried to replace hand-written code which I added in 2b4bac48c1084 ("serial: max310x: Use batched reads when reasonably safe") with the generic regmap infrastructure for batched operations.
Unfortunately, the regmap_raw_read and regmap_raw_write which were used are actually functions which perform IO over *multiple* registers. That's not what is needed for accessing these Tx/Rx FIFOs; the appropriate functions are the _noinc_ versions, not the _raw_ ones.
Fix this regression by using regmap_noinc_read() and regmap_noinc_write() along with the necessary regmap_config setup; with this patch in place, our board communicates happily again. Since our board uses SPI for talking to this chip, the I2C part is completely untested.
--- drivers/tty/serial/max310x.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/tty/serial/max310x.c +11 -2
@@ -511,6 +511,11 @@ static bool max310x_reg_precious(struct device *dev, unsigned int reg)return false; } +static bool max310x_reg_noinc (struct device *dev,unsigned int reg) +{ +return reg ==MAX310X_RHR_REG ; +} +static int max310x_set_baud (struct uart_port *port,int baud) {unsigned int mode =0 , div =0 , frac =0 , c =0 ,F =0 ;
@@ -645,14 +650,14 @@ static void max310x_batch_write(struct uart_port *port, u8 *txbuf, unsigned int {struct max310x_one *one =to_max310x_port (port); -regmap_raw_write (one->regmap,MAX310X_THR_REG , txbuf, len); +regmap_noinc_write (one->regmap,MAX310X_THR_REG , txbuf, len); }static void max310x_batch_read (struct uart_port *port,u8 *rxbuf,unsigned int len) {struct max310x_one *one =to_max310x_port (port); -regmap_raw_read (one->regmap,MAX310X_RHR_REG , rxbuf, len); +regmap_noinc_read (one->regmap,MAX310X_RHR_REG , rxbuf, len); }static void max310x_handle_rx (struct uart_port *port,unsigned int rxlen)
@@ -1481,6 +1486,10 @@ static struct regmap_config regcfg = { .writeable_reg = max310x_reg_writeable, .volatile_reg = max310x_reg_volatile, .precious_reg = max310x_reg_precious, + .writeable_noinc_reg = max310x_reg_noinc, + .readable_noinc_reg = max310x_reg_noinc, + .max_raw_read = MAX310X_FIFO_SIZE, + .max_raw_write = MAX310X_FIFO_SIZE, };#ifdef CONFIG_SPI_MASTER
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 76/76 Linux 5.15.152-rc1
In reply to Sasha Levin--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 15 -SUBLEVEL = 151 -EXTRAVERSION = +SUBLEVEL = 152 +EXTRAVERSION = -rc1 NAME = Trick or Treat # *DOCUMENTATION*
Signature · 1 line
2.43.0
Re: [PATCH 5.15 72/76] regmap: allow to define reg_update_bits for no bus configuration
In reply to Sasha LevinQuoted 9 lines · Sasha Levin
From: Ansuel Smith <[email protected]>
[ Upstream commit
02d6fdecb9c38de19065f6bed8d5214556fd061d]Some device requires a special handling for
reg_update_bitsand can't use the normal regmap read write logic. An example is when locking is handled by the device and rmw operations requires to do atomic operations. Allow to declare a dedicated function inregmap_configforreg_update_bitsin no bus configuration.
This is fairly clearly new functionality?
Re: [PATCH 5.15 73/76] regmap: Add bulk read/write callbacks into regmap_config
In reply to Sasha LevinQuoted 11 lines · Sasha Levin
From: Marek Vasut <[email protected]>
[ Upstream commit
d77e745613680c54708470402e2b623dcd769681]Currently the
regmap_configstructure only allows the user to implement single element register read/write using .reg_read/.reg_write callbacks. Theregmap_busalready implements bulk counterparts of both, and is being misused as a workaround for the missing bulk read/write callbacks inregmap_configby a couple of drivers. To stop this misuse, add the bulk read/write callbacks toregmap_configand call them from the regmap core code.
This fairly clearly new functionality.
Re: [PATCH 5.15 45/76] modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS
In reply to Sasha LevinHi Sasha,
Quoted 23 lines · Sasha Levin
From: Nathan Chancellor <[email protected]>
[ Upstream commit
397586506c3da005b9333ce5947ad01e8018a3be]After the linked LLVM change, building ARCH=um defconfig results in a segmentation fault in modpost. Prior to commit
a23e7584ecf3("modpost:
unify 'sym' and 'to' indefault_mismatch_handler()"), there was a warning:WARNING: modpost:
vmlinux.o(__ex_table+0x88): Section mismatch in reference to the .ltext:(unknown)
WARNING: modpost: The relocation at__ex_table+0x88references
section ".ltext" which is not in the list of
authorized sections. If you're adding a new section
and/or if this reference is valid, add ".ltext" to the
list of authorized sections to jump to on fault.
This can be achieved by adding ".ltext" to
OTHER_TEXT_SECTIONSinscripts/mod/modpost.c.The linked LLVM change moves global objects to the '.ltext' (and '.ltext.*' with '-ffunction-sections') sections with '-mcmodel=large', which ARCH=um uses. These sections should be handled just as '.text' and '.text.*' are, so add them to
TEXT_SECTIONS.
Quoted 6 lines
Signed-off-by Nathan Chancellor <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>Signed-off-by Sasha Levin <[email protected]>
This causes a warning when building with HOSTCC=clang:
scripts/mod/modpost.c:1123:37: warning: excess elements in array initializer [-Wexcess-initializers]
1123 | .good_tosec = {ALL_TEXT_SECTIONS , NULL},
| ^~~~
.../lib/clang/17/include/stddef.h:89:16: note: expanded from macro 'NULL'
89 | # define NULL ((void*)0)
| ^~~~~~~~~~1 warning generated.
Same comment as on the other UML clang-18 patch, I do not think this is necessary right now in 5.15 and earlier. The other modpost patch can go as well, as it is only a prerequisite change.
Cheers,
Nathan
Sasha Levin
maintainerRe: [PATCH 5.15 73/76] regmap: Add bulk read/write callbacks into regmap_config
In reply to Mark BrownQuoted 13 lines · Mark Brown
Quoted 11 lines · Sasha Levin
From: Marek Vasut <[email protected]>
[ Upstream commit
d77e745613680c54708470402e2b623dcd769681]Currently the
regmap_configstructure only allows the user to implement single element register read/write using .reg_read/.reg_write callbacks. Theregmap_busalready implements bulk counterparts of both, and is being misused as a workaround for the missing bulk read/write callbacks inregmap_configby a couple of drivers. To stop this misuse, add the bulk read/write callbacks toregmap_configand call them from the regmap core code.
Quoted 1 line
This fairly clearly new functionality.
It is, but its needed for 3f42b142ea11 ("serial: max310x: fix IO data corruption in batched operations") which uses this new functionality.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerRe: [PATCH 5.15 72/76] regmap: allow to define reg_update_bits for no bus configuration
In reply to Mark BrownQuoted 5 lines · Mark Brown
Quoted 4 lines · Sasha Levin
From: Ansuel Smith <[email protected]>
[ Upstream commit
02d6fdecb9c38de19065f6bed8d5214556fd061d]
Quoted 7 lines
Quoted 5 lines
Some device requires a special handling for
reg_update_bitsand can't use the normal regmap read write logic. An example is when locking is handled by the device and rmw operations requires to do atomic operations. Allow to declare a dedicated function inregmap_configforreg_update_bitsin no bus configuration.This is fairly clearly new functionality?
It is, but like the other commit, this new functionality is needed for a later fix. We indicate this in the commit message by adding a trailer:
Signed-off-by: Ansuel Smith <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]> Stable-dep-of: 3f42b142ea11 ("serial: max310x: fix IO data corruption in batched operations") ^^^^^^^^^ Signed-off-by: Sasha Levin <[email protected]>
Signature · 2 lines
Thanks, Sasha
Hello!
Quoted 8 lines · Sasha Levin
This is the start of the stable review cycle for the 5.15.152 release. There are 76 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Mar 15 04:42:22 PM UTC 2024. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.151or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.Thanks,
Sasha
We see new warnings everywhere:
-----8<-----
/builds/linux/scripts/mod/modpost.c:1123:44: warning: excess elements in array initializer
1123 | .good_tosec = {ALL_TEXT_SECTIONS , NULL},
| ^~~~
----->8-----
Bisection points to:
commit 4060bae9dab232eb15bc7ddaaeb278b39456adf9
Author: Nathan Chancellor <[email protected]>
Date: Tue Jan 23 15:59:55 2024 -0700
modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS
[ Upstream commit 397586506c3da005b9333ce5947ad01e8018a3be ]
Reverting that commits makes the warning go away.
One reproducer:
tuxmake --runtime podman --target-arch arm64 --toolchain gcc-12 --kconfig tinyconfig
Greetings!
Daniel Díaz
[email protected]
Sasha Levin
maintainerRe: [PATCH 5.15 45/76] modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS
In reply to Nathan ChancellorQuoted 39 lines · Nathan Chancellor
Hi Sasha,
Quoted 23 lines · Sasha Levin
From: Nathan Chancellor <[email protected]>
[ Upstream commit
397586506c3da005b9333ce5947ad01e8018a3be]After the linked LLVM change, building ARCH=um defconfig results in a segmentation fault in modpost. Prior to commit
a23e7584ecf3("modpost:
unify 'sym' and 'to' indefault_mismatch_handler()"), there was a warning:WARNING: modpost:
vmlinux.o(__ex_table+0x88): Section mismatch in reference to the .ltext:(unknown)
WARNING: modpost: The relocation at__ex_table+0x88references
section ".ltext" which is not in the list of
authorized sections. If you're adding a new section
and/or if this reference is valid, add ".ltext" to the
list of authorized sections to jump to on fault.
This can be achieved by adding ".ltext" to
OTHER_TEXT_SECTIONSinscripts/mod/modpost.c.The linked LLVM change moves global objects to the '.ltext' (and '.ltext.*' with '-ffunction-sections') sections with '-mcmodel=large', which ARCH=um uses. These sections should be handled just as '.text' and '.text.*' are, so add them to
TEXT_SECTIONS.Quoted 6 lines
Signed-off-by Nathan Chancellor <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>Signed-off-by Sasha Levin <[email protected]>This causes a warning when building with HOSTCC=clang:
scripts/mod/modpost.c:1123:37: warning: excess elements in array initializer [-Wexcess-initializers]
1123 | .good_tosec = {ALL_TEXT_SECTIONS, NULL},
| ^~~~
.../lib/clang/17/include/stddef.h:89:16: note: expanded from macro 'NULL'
Quoted 7 lines
89 | # define NULL ((void*)0) | ^~~~~~~~~~1 warning generated.
Same comment as on the other UML clang-18 patch, I do not think this is necessary right now in 5.15 and earlier. The other modpost patch can go as well, as it is only a prerequisite change.
Dropped, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerQuoted 30 lines · Daniel Díaz
Hello!
Quoted 8 lines · Sasha Levin
This is the start of the stable review cycle for the 5.15.152 release. There are 76 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Mar 15 04:42:22 PM UTC 2024. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.151or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.Thanks,
SashaWe see new warnings everywhere:
-----8<-----
/builds/linux/scripts/mod/modpost.c:1123:44: warning: excess elements in array initializer
1123 | .good_tosec = {ALL_TEXT_SECTIONS, NULL},
| ^~~~
----->8-----Bisection points to:
Quoted 8 lines
commit
4060bae9dab232eb15bc7ddaaeb278b39456adf9
Author: Nathan Chancellor <[email protected]>
Date: Tue Jan 23 15:59:55 2024 -0700modpost: Add '.ltext' and '.ltext.*' to
TEXT_SECTIONS[ Upstream commit397586506c3da005b9333ce5947ad01e8018a3be]Reverting that commits makes the warning go away.
I've dropped it, thanks for the report!
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 5.15 64/76] proc: Use task_is_running() for wchan in /proc/$pid/stat
In reply to Sasha LevinQuoted 10 lines · Sasha Levin
From: Kees Cook <[email protected]>
[ Upstream commit
4e046156792c26bef8a4e30be711777fc8578257]The implementations of
get_wchan()can be expensive. The only information imparted here is whether or not a process is currently blocked in the scheduler (and even this doesn't need to be exact). Avoid doing the heavy lifting of stack walking and just report that information by usingtask_is_running().
Quoted 5 lines
Signed-off-by Kees Cook <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Stable-dep-of:
60f92acb60a9("fs/proc:do_task_stat: movethread_group_cputime_adjusted()outside oflock_task_sighand()")Signed-off-by Sasha Levin <[email protected]>
Looks fine to me. Can you double-check that commit54354c6a9f7f ("Revert "proc/wchan: use printk format instead of lookup_symbol_name()"") is already backported too?
Signature · 1 line
Kees Cook
Hi Sasha,
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.15.152 release. There are 76 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Mar 15 04:42:22 PM UTC 2024. Anything received after that time might be too late.
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Harshit
Quoted 9 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.151or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.Thanks,
Sasha
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.15.152 release. There are 76 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Mar 15 04:42:22 PM UTC 2024. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.151or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.Thanks,
Sasha
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Hello,
Quoted 6 lines · On Wed, 13 Mar 2024 12:41:07 -0400 Sasha Levin <[email protected]> wrote:
This is the start of the stable review cycle for the 5.15.152 release. There are 76 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Fri Mar 15 04:42:22 PM UTC 2024. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.151or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/awslabs/damon-tests/tree/next/corr
[2] 3e68d7dfa7d6 ("Linux 5.15.152-rc1")
Thanks,
SJ
[...]
---
ok 1 selftests: damon: debugfs_attrs.sh
ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh
ok 12 selftests: damon-tests: build_m68k.sh
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.15.152 release. There are 76 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 9 lines
Responses should be made by Fri Mar 15 04:42:22 PM UTC 2024. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.151or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.
KernelCI report for stable-rc/linux-5.15.y for this week.
## stable-rc HEAD for linux-5.15.y:
Date: 2024-03-13
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=97877abed2af926040ddc1dc8d68d11b73e44e42
## Build failures:
No build failures seen for the stable-rc/linux-5.15.y commit head \o/
## Boot failures:
No **new** boot failures seen for the stable-rc/linux-5.15.y commit head \o/
Thanks,
Shreeya Patel
Sasha Levin
maintainerRe: [PATCH 5.15 64/76] proc: Use task_is_running() for wchan in /proc/$pid/stat
In reply to Kees CookQuoted 17 lines · Kees Cook
Quoted 10 lines · Sasha Levin
From: Kees Cook <[email protected]>
[ Upstream commit
4e046156792c26bef8a4e30be711777fc8578257]The implementations of
get_wchan()can be expensive. The only information imparted here is whether or not a process is currently blocked in the scheduler (and even this doesn't need to be exact). Avoid doing the heavy lifting of stack walking and just report that information by usingtask_is_running().Quoted 5 lines
Signed-off-by Kees Cook <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Stable-dep-of:
60f92acb60a9("fs/proc:do_task_stat: movethread_group_cputime_adjusted()outside oflock_task_sighand()")Signed-off-by Sasha Levin <[email protected]>
Quoted 3 lines
Looks fine to me. Can you double-check that commit
54354c6a9f7f("Revert "proc/wchan: use printk format instead oflookup_symbol_name()"") is already backported too?
Yup, it's there too.
Signature · 2 lines
Thanks, Sasha