Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GIT PULL] sound updates for 5.15-rc1 #2

Closed
wants to merge 462 commits into from

Conversation

ammarfaizi2
Copy link
Owner

The following changes since commit e22ce8eb631bdc47a4a4ea7ecf4e4ba499db4f93:

  Linux 5.14-rc7 (2021-08-22 14:24:56 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git tags/sound-5.15-rc1

for you to fetch changes up to a8729efbbb847f6ea9b06e73491ec8ddb560465e:

  Merge tag 'asoc-v5.15' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus (2021-08-30 14:57:03 +0200)

----------------------------------------------------------------
sound updates for 5.15-rc1

There are a few intensive changes in ALSA core side at this time that
helped the significant code reduction.  Meanwhile we keep getting new
stuff, so the total size still grows...
Anyway, the below are some highlights in this development cycle.

ALSA core:
- New helpers to manage page allocations and card object with devres
- Refactoring for memory allocation with wc-pages
- A new PCM hardware flag SNDRV_PCM_INFO_EXPLICIT_SYNC for controlling
  the explicit sync of the stream control; it'll be used for ASoC SOF
  and non-coherent memory in future

ASoC:
- Lots of cleanups and improvements to the Intel drivers, including
  some new systems support
- New support for AMD Vangoh, CUI CMM-4030D-261, Mediatek Mt8195,
  Renesas RZ/G2L Mediatek Mt8195, RealTek RT101P, Renesas RZ/G2L,
  Rockchip RK3568 S/PDIF

USB-audio:
- Re-organized the quirk handling and  a new option quirk_flags
- Fix for a regression in 5.14 code change for JACK
- Quirks for Sony WALKMAN, Digidesign mbox

HD-audio:
- Enhanced support for CS8409 codec
- More consistent shutdown behavior with the runtime PM
- The model option can accept the PCI or codec SSID as an alias
- Quirks for ASUS ROG, HP Spectre x360

Others:
- Lots of code reduction in legacy drivers with devres helpers
- FireWire MOTU 896HD support

----------------------------------------------------------------
Aakash Hemadri (4):
      ASoC: tegra30: ahub: Use of_device_get_match_data
      ASoC: tegra30: i2s: Use of_device_get_match_data
      ASoC: tegra30: ahub: Fix incorrect usage of of_device_get_match_data
      ASoC: tegra30: i2s: Fix incorrect usage of of_device_get_match_data

Angelo Dureghello (3):
      ASoC: ics43432: add CMM-4030D-261 support
      dt-bindings: add compatible vendor prefix for CUI Devices
      ASoC: ics43432: add compatible for CUI Devices

Bard Liao (8):
      ASoC: Intel: sof_sdw: extends SOF_RT711_JDSRC to 4 bits
      ASoC: Intel: sof_sdw: include rt711.h for RT711 JD mode
      soundwire: move intel sdw register definitions to sdw_intel.h
      ASoC: SOF: intel: add sdw_shim/alh_base to sof_intel_dsp_desc
      ASoC: SOF: intel: hda: remove HDA_DSP_REG_SNDW_WAKE_STS definition
      ASoC: SOF: intel: move sof_intel_dsp_desc() forward
      ASoC: SOF: intel: add snd_sof_dsp_check_sdw_irq ops
      soundwire: intel: introduce shim and alh base

Biju Das (8):
      ASoC: dt-bindings: Document RZ/G2L bindings
      ASoC: dt-bindings: sound: renesas,rz-ssi: Document DMA support
      ASoC: sh: Add RZ/G2L SSIF-2 driver
      ASoC: dt-bindings: renesas,rz-ssi: Update slave dma channel configuration parameter
      ASoC: sh: rz-ssi: Add SSI DMAC support
      ASoC: sh: rz-ssi: Fix dereference of noderef expression warning
      ASoC: sh: rz-ssi: Fix wrong operator used issue
      ASoC: sh: rz-ssi: Improve error handling in rz_ssi_dma_request function

Brent Lu (6):
      ASoC: SOF: add a helper to get topology configured bclk
      ASoC: Intel: sof_cs42l42: use helper function to get bclk frequency
      ASoC: Intel: sof_cs42l42: support arbitrary DAI link sequence
      ASoC: Intel: maxim-common: support max98360a
      ASoC: Intel: sof_cs42l42: add support for jsl_cs4242_mx98360a
      ASoC: Intel: sof_rt5682: code refactor for max98360a

Cezary Rojewski (5):
      ASoC: Intel: kbl_da7219_max98927: Fix format selection for max98373
      ASoC: Intel: Skylake: Leave data as is when invoking TLV IPCs
      ASoC: Intel: Skylake: Fix module resource and format selection
      ASoC: Intel: Skylake: Fix module configuration for KPB and MIXER
      ASoC: Intel: Skylake: Select first entry for singular pipe config arrays

Changcheng Deng (1):
      ASoC: SOF: intel: remove duplicate include

Charles Keepax (2):
      ASoC: wm_adsp: Remove pointless string comparison
      ASoC: wm_adsp: Put debugfs_remove_recursive back in

Christophe JAILLET (3):
      ASoC: wcd9335: Fix a double irq free in the remove function
      ASoC: wcd9335: Fix a memory leak in the error handling path of the probe function
      ASoC: wcd9335: Disable irq on slave ports in the remove function

Codrin Ciubotariu (1):
      ASoC: codecs: ad193x: add support for 96kHz and 192kHz playback rates

Colin Ian King (12):
      ALSA: hda/ca0132: remove redundant initialization of variable status
      ASoC: codecs: lpass-rx-macro: clean up for-loop indentation in switch statement
      ALSA: aloop: Fix spelling mistake "synchronization" -> "synchronization"
      ALSA: opti9xx: fix missing { } around an if block
      ALSA: sc6000: Fix incorrect sizeof operator
      ASoC: Intel: Fix spelling contraction "cant" -> "can't"
      ASoC: rsnd: make some arrays static const, makes object smaller
      ASoC: tlv320aic32x4: make array clocks static, makes object smaller
      ALSA: usb-audio: make array static const, makes object smaller
      ASoC: rt5514: make array div static const, makes object smaller
      ASoC: uniphier: make arrays mul and div static const, makes object smaller
      ASoC: mediatek: mt8195: Fix spelling mistake "bitwiedh" -> "bitwidth"

Curtis Malainey (1):
      ASoC: Intel: Fix platform ID matching

Damien Zammit (1):
      ALSA: usb-audio: Input source control - digidesign mbox

Dan Carpenter (2):
      ASoC: ti: delete some dead code in omap_abe_probe()
      ASoC: amd: fix an IS_ERR() vs NULL bug in probe

Derek Fang (2):
      ASoC: rt5682: Adjust headset volume button threshold again
      ASoC: rt5682: Fix the vol+ button detection issue

Dmitry Osipenko (1):
      ASoC: rt5640: Silence warning message about missing interrupt

Douglas Anderson (2):
      ASoC: rt5682: Properly turn off regulators if wrong device ID
      ASoC: rt5682: Remove unused variable in rt5682_i2c_remove()

Gongjun Song (1):
      ASoC: Intel: soc-acpi: add support for SoundWire of TGL-H-RVP

Gu Shengxian (2):
      ASoC: atmel: fix spelling mistakes
      ASoC: amd: fix spelling mistakes

Gustaw Lewandowski (2):
      ASoC: Intel: Skylake: Fix passing loadable flag for module
      ASoC: Intel: Skylake: Simplify m_state for loadable modules

Hans de Goede (14):
      ASoC: Intel: bytcr_rt5640: Move "Platform Clock" routes to the maps for the matching in-/output
      ASoC: Intel: bytcr_rt5640: Add line-out support
      ASoC: Intel: bytcr_rt5640: Add a byt_rt5640_get_codec_dai() helper
      ASoC: Intel: bytcr_rt5640: Add support for a second headphones output
      ASoC: Intel: bytcr_rt5640: Add support for a second headset mic input
      ASoC: Intel: bytcr_rt5640: Fix HP ElitePad 1000 G2 quirk
      ASoC: Intel: bytcr_rt5640: Use cfg-lineout:2 in the components string
      ASoC: rt5640: Move rt5640_disable_jack_detect() up in the rt5640.c file
      ASoC: rt5640: Delay requesting IRQ until the machine-drv calls set_jack
      ASoC: rt5640: Add optional hp_det_gpio parameter to rt5640_detect_headset()
      ASoC: rt5640: Add rt5640_set_ovcd_params() helper
      ASoC: Intel: bytct_rt5640: Add a separate "Headset Mic 2" DAPM pin for the mic on the 2nd jack
      ASoC: Intel: bytcr_rt5640: Add support for HP Elite Pad 1000G2 jack-detect
      ASoC: Intel: bytcr_rt5640: Mark hp_elitepad_1000g2_jack?_check functions static

Heikki Krogerus (1):
      ASoC: Intel: boards: use software node API in Atom boards

Jack Yu (4):
      ASoC: rt1015: Remove unnecessary flush work on rt1015 driver
      ASoC: rt1015p: add new acpi id and comapatible id
      ASoC: dt-bindings: rt1015p: add new compatible id
      ASoC: dt-bindings: rt1015p: fix syntax error in dts-binding document

Jason Wang (1):
      ALSA: pcxhr: use __func__ to get funcion's name in an output message

Jiri Slaby (2):
      ASoC: cx20442: tty_ldisc_ops::write_wakeup is optional
      ASoC: v253_init: eliminate pointer to string

Johnathon Clark (1):
      ALSA: hda/realtek: Quirk for HP Spectre x360 14 amp setup

Kareem Shaik (1):
      ASoC: Intel: Skylake: Support multiple format configs

Krzysztof Kozlowski (1):
      ASoC: rt1015p: correct indentation

Kuninori Morimoto (44):
      ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb()
      ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close()
      ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture()
      ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active()
      ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan()
      ASoC: soc-core: cleanup cppcheck warning at snd_soc_set_dmi_name()
      ASoC: soc-core: cleanup cppcheck warning at snd_soc_get_dai_name()
      ASoC: soc-core: cleanup cppcheck warning at snd_soc_daifmt_parse_format()
      ASoC: soc-core: cleanup cppcheck warning at snd_soc_unregister_component()
      ASoC: soc-core: cleanup cppcheck warning at snd_soc_add_controls()
      ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_simple_widgets()
      ASoC: soc-core: cleanup cppcheck warning at snd_soc_of_parse_audio_routing()
      ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_process_headers()
      ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dai_elems_load()
      ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_dapm_widget_elems_load()
      ASoC: soc-topology: cleanup cppcheck warning at soc_tplg_kcontrol_elems_load()
      ASoC: soc-topology: cleanup cppcheck warning at snd_soc_find_dai_link()
      ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx()
      ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume()
      ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx()
      ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx()
      ASoC: soc-dapm: cleanup cppcheck warning at dapm_wcache_lookup()
      ASoC: soc-dapm: cleanup cppcheck warning at dapm_connect_mux()
      ASoC: soc-dapm: cleanup cppcheck warning at dapm_set_mixer_path_status()
      ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_pga()
      ASoC: soc-dapm: cleanup cppcheck warning at dapm_new_dai_link()
      ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_check_event()
      ASoC: soc-dapm: cleanup cppcheck warning at dapm_seq_run()
      ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_del_route()
      ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_add_routes()
      ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_weak_routes()
      ASoC: soc-dapm: cleanup cppcheck warning at snd_soc_dapm_new_controls()
      ASoC: soc-dapm: cleanup cppcheck warning at soc_dapm_dai_stream_event()
      ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_pcm_hw_params()
      ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_pcm_new()
      ASoC: soc-generic-dmaengine-pcm: cleanup cppcheck warning at dmaengine_copy_user()
      ASoC: soc-dai: cleanup cppcheck warning at snd_soc_dai_link_set_capabilities()
      ASoC: soc-dai: cleanup cppcheck warning at snd_soc_pcm_dai_new()
      ASoC: soc-jack: cleanup cppcheck warning at snd_soc_jack_report()
      ASoC: soc-jack: cleanup cppcheck warning for CONFIG_GPIOLIB
      ASoC: soc-component: cleanup cppcheck warning at snd_soc_pcm_component_pm_runtime_get()
      ASoC: soc-ac97: cleanup cppcheck warning
      ASoC: rsnd: core: make some arrays static const, makes object smaller
      ASoC: rsnd: adg: clearly handle clock error / NULL case

Lucas Tanure (12):
      ALSA: hda/cirrus: Move CS8409 HDA bridge to separate module
      ALSA: hda/cs8409: Move arrays of configuration to a new file
      ALSA: hda/cs8409: Disable unsolicited response for the first boot
      ALSA: hda/cs8409: Prevent I2C access during suspend time
      ALSA: hda/cs8409: Generalize volume controls
      ALSA: hda/cs8409: Dont disable I2C clock between consecutive accesses
      ALSA: hda/cs8409: Avoid setting the same I2C address for every access
      ALSA: hda/cs8409: Avoid re-setting the same page as the last access
      ALSA: hda/cs8409: Support i2c bulk read/write functions
      ALSA: hda/cs8409: Separate CS8409, CS42L42 and project functions
      ALSA: hda/cs8409: Move codec properties to its own struct
      ALSA: hda/cs8409: Add support for dolphin

Marek Vasut (1):
      ASoC: tlv320aic32x4: Fix TAS2505/TAS2521 channel count

Mario Limonciello (2):
      ASoC: amd: Don't show messages about deferred probing by default
      ASoC: amd: Use dev_probe_err helper

Mark Brown (31):
      Merge existing fixes from asoc/for-5.14
      Merge series "ASoC: Intel: machine driver corrections" from Pierre-Louis Bossart <[email protected]>:
      Merge series "Fix unbalanced pm_runtime_enable in error handle" from Zhang Qilong <[email protected]>:
      Merge series "ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support" from Peter Ujfalusi <[email protected]>:
      Merge series "soundwire/ASoC: add mockup codec support" from Bard Liao <[email protected]>:
      Merge series "ASoC: soc-pcm: cleanup cppcheck warning" from Kuninori Morimoto <[email protected]>:
      Merge series "ASoC: soc-core: cleanup cppcheck warning" from Kuninori Morimoto <[email protected]>:
      Merge series "Add RZ/G2L Sound support" from Biju Das <[email protected]>:
      Merge series "ASoC: soc-topology: cleanup cppcheck warning" from Kuninori Morimoto <[email protected]>:
      Merge series "ASoC: Intel: bytcr_rt5640: Fix HP ElitePad 1000 G2 audio routing" from Hans de Goede <[email protected]>:
      Merge series "soundwire/ASoC: abstract platform-dependent bases" from Bard Liao <[email protected]>:
      Merge series "ASoC: SOF/Intel: machine driver updates" from Pierre-Louis Bossart <[email protected]>:
      Merge series "ASoC: soc-ops: cleanup cppcheck warning" from Kuninori Morimoto <[email protected]>:
      Merge series "ASoC: soc-dapm: cleanup cppcheck warning" from Kuninori Morimoto <[email protected]>:
      Merge series "ASoC: codecs: cppcheck warnings" from Pierre-Louis Bossart <[email protected]>:
      Merge some cs42l42 patches into asoc-5.15
      Merge series "ASoC: SOF: Intel: DMI L1 power optimization for HDaudio platforms" from Pierre-Louis Bossart <[email protected]>:
      Merge series "Add RZ/G2L Sound support" from Biju Das <[email protected]>:
      Merge series "ASoC: Intel: boards: use software node API" from Pierre-Louis Bossart <[email protected]>:
      Merge series "ASoC: soc-xxx: cleanup cppcheck warning" from Kuninori Morimoto <[email protected]>:
      Merge series "ASoC: tegra30: Fix use of of_device_get_match_data" from Aakash Hemadri <[email protected]>:
      Merge series "ASoC: Intel/rt5640: Add support for HP Elite Pad 1000G2 jack-detect" from Hans de Goede <[email protected]>:
      Merge series "ASoC: Intel: Skylake: Fix and support complex" from Cezary Rojewski <[email protected]>:
      Merge series "ASoC: mediatek: Add support for MT8195 SoC" from Trevor Wu <[email protected]>:
      Merge branch 'for-5.14' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.15
      Merge series "Patches to update for rockchip spdif" from Sugar Zhang <[email protected]>:
      Merge series "Patches to update for rockchip i2s" from Sugar Zhang <[email protected]>:
      Merge series "ASoC: wcd9335: Firx some resources leak in the probe and remove function" from Christophe JAILLET <[email protected]>:
      ASoC: Revert PCM trigger changes
      Merge remote-tracking branch 'asoc/for-5.14' into asoc-linus
      Merge remote-tracking branch 'asoc/for-5.15' into asoc-linus

Nathan Chancellor (2):
      ALSA: hda/sigmatel - Sink stac_shutup() into stac_suspend()
      ALSA: hda/analog - Sink ad198x_shutup() and shuffle CONFIG_PM guards

Nobuhiro Iwamatsu (1):
      ASoC: mediatek: mt6359: convert to use module_platform_driver

Pawel Harlozinski (1):
      ASoC: Intel: Skylake: Properly configure modules with generic extension

Peter Ujfalusi (5):
      ASoC: ti: davinci-mcasp: Fix DIT mode support
      ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4
      ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP
      ASoC: ti: j721e-evm: Convert the audio domain IDs to enum
      ASoC: Intel: bytcr_rt5640: Make rt5640_jack_gpio/rt5640_jack2_gpio static

Pierre-Louis Bossart (27):
      ASoC: codecs: add SoundWire mockup device support
      ASoC: soc-acpi: cnl: add table for SoundWire mockup devices
      ASoC: soc-acpi: tgl: add table for SoundWire mockup devices
      ASoC: Intel: boards: sof_sdw: add SoundWire mockup codecs for tests
      ASOC: Intel: sof_sdw: add quirk for Intel 'Bishop County' NUC M15
      ASoC: Intel: sof_sdw: add quirk for Dell XPS 9710
      ASoC: Intel: update sof_pcm512x quirks
      ASoC: Intel: sof_sdw_max98373: remove useless inits
      ALSA: pci/korg1212: completely remove 'set but not used' warnings
      ASoC: max98090: remove duplicate status reads and useless assignmment
      ASoC: mt6359-accdet.c: remove useless assignments
      ASoC: wcd938x: simplify return value
      ALSA: core: control_led: use strscpy instead of strlcpy
      ALSA: hda_audio_ext: fix kernel-doc
      ASoC: SOF: Intel: Kconfig: clarify DMI L1 option description
      ASoC: SOF: Intel: hda-stream: remove always true condition
      ASoC: SOF: Intel: simplify logic for DMI_L1 handling
      ASoC: SOF: Intel: make DMI L1 selection more robust
      ASoC: Intel: boards: harden codec property handling
      ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev()
      ASoC: Intel: boards: get codec device with ACPI instead of bus search
      ASoC: Intel: sof_sdw: pass card information to init/exit functions
      ASoC: Intel: sof_sdw_rt711*: keep codec device reference until remove
      ASoC: Intel: use software node API in SoundWire machines
      ASoC: Intel: remove device_properties for Atom boards
      ASoC: soc-pcm: protect BE dailink state changes in trigger
      ASoC: soc-pcm: test refcount before triggering

Piotr Maziarz (1):
      ASoC: Intel: Skylake: Select proper format for NHLT blob

Randy Dunlap (1):
      ASoC: atmel: ATMEL drivers don't need HAS_DMA

Richard Fitzgerald (4):
      ASoC: cs42l42: Add PLL configuration for 44.1kHz/16-bit
      ASoC: cs42l42: Validate dai_set_sysclk() frequency
      ASoC: cs42l42: Assume 24-bit samples are in 32-bit slots
      ASoC: cs42l42: Update module authors

Rikard Falkeborn (1):
      ASoC: samsung: Constify static snd_soc_ops

Robin Murphy (1):
      ASoC: dwc: Get IRQ optionally

Samuel Holland (1):
      ASoC: simple-card-utils: Avoid over-allocating DLCs

Shengjiu Wang (2):
      ASoC: fsl_rpmsg: Check -EPROBE_DEFER for getting clocks
      ASoC: imx-rpmsg: change dev_err to dev_err_probe for -EPROBE_DEFER

Shuming Fan (1):
      ASoC: rt5682: enable SAR ADC power saving mode during suspend

Srinivas Kandagatla (4):
      ASoC: codecs: wcd938x: remove unused port-map reference
      ASoC: codecs: wcd938x: add Multi Button Headset Control support
      ASoC: qdsp6: q6asm: fix cppcheck warnings for unnecessary initialization
      ASoC: qdsp6: q6adm: fix cppcheck warnings for unnecessary initialization

Stefan Binding (18):
      ALSA: hda/cs8409: Use enums for register names and coefficients
      ALSA: hda/cs8409: Mask all CS42L42 interrupts on initialization
      ALSA: hda/cs8409: Reduce HS pops/clicks for Cyborg
      ALSA: hda/cs8409: Disable unnecessary Ring Sense for Cyborg/Warlock/Bullseye
      ALSA: hda/cs8409: Disable unsolicited responses during suspend
      ALSA: hda/cs8409: Mask CS42L42 wake events
      ALSA: hda/cs8409: Simplify CS42L42 jack detect.
      ALSA: hda/cs8409: Support multiple sub_codecs for Suspend/Resume/Unsol events
      ALSA: hda/cs8409: Add Support to disable jack type detection for CS42L42
      ALSA: hda/cs8409: Enable Full Scale Volume for Line Out Codec on Dolphin
      ALSA: hda/cs8409: Set fixed sample rate of 48kHz for CS42L42
      ALSA: hda/cs8409: Use timeout rather than retries for I2C transaction waits
      ALSA: hda/cs8409: Remove unnecessary delays
      ALSA: hda/cs8409: Follow correct CS42L42 power down sequence for suspend
      ALSA: hda/cs8409: Unmute/Mute codec when stream starts/stops
      ALSA: hda/cs8409: Prevent pops and clicks during suspend
      ALSA: hda/cs8409: Ensure Type Detection is only run on startup when necessary
      ALSA: hda/cs8409: Initialize Codec only in init fixup.

Steve Lee (1):
      ASoC: max98390: Add support change dsm param name

Sugar Zhang (13):
      ASoC: rockchip: spdif: Mark SPDIF_SMPDR as volatile
      ASoC: rockchip: spdif: Fix some coding style
      ASoC: rockchip: spdif: Add support for rk3568 spdif
      ASoC: dt-bindings: rockchip: Add compatible for rk3568 spdif
      ASoC: rockchip: i2s: Add support for set bclk ratio
      ASoC: rockchip: i2s: Fixup clk div error
      ASoC: rockchip: i2s: Improve dma data transfer efficiency
      ASoC: rockchip: i2s: Fix regmap_ops hang
      ASoC: dt-bindings: rockchip: Document reset property for i2s
      ASoC: rockchip: i2s: Make playback/capture optional
      ASoC: rockchip: i2s: Add compatible for more SoCs
      ASoC: dt-bindings: rockchip: Add compatible strings for more SoCs
      ASoC: rockchip: i2s: Add support for frame inversion

Szymon Mielczarek (1):
      ASoC: Intel: Skylake: Support modules with generic extension

Takashi Iwai (158):
      ALSA: ice1724: Remove superfluous loop over model table
      ALSA: x86: simplify with sync_stop PCM ops
      ALSA: hda/hdmi: Add option to enable all pins forcibly
      ALSA: intel8x0: Skip ac97 clock measurement on VM
      ALSA: compress: Drop unused functions
      ALSA: compress: Initialize mutex in snd_compress_new()
      ALSA: core: Add device-managed page allocator helper
      ALSA: core: Add managed card creation
      ALSA: core: Add device-managed request_dma()
      ALSA: doc: Add device-managed resource section
      ALSA: intel8x0: Allocate resources with device-managed APIs
      ALSA: atiixp: Allocate resources with device-managed APIs
      ALSA: hda: Allocate resources with device-managed APIs
      ALSA: ad1889: Allocate resources with device-managed APIs
      ALSA: als300: Allocate resources with device-managed APIs
      ALSA: als4000: Allocate resources with device-managed APIs
      ALSA: azt3328: Allocate resources with device-managed APIs
      ALSA: bt87x: Allocate resources with device-managed APIs
      ALSA: cmipci: Allocate resources with device-managed APIs
      ALSA: cs4281: Allocate resources with device-managed APIs
      ALSA: cs5530: Allocate resources with device-managed APIs
      ALSA: ens137x: Allocate resources with device-managed APIs
      ALSA: es1938: Allocate resources with device-managed APIs
      ALSA: es1968: Allocate resources with device-managed APIs
      ALSA: fm801: Allocate resources with device-managed APIs
      ALSA: maestro3: Allocate resources with device-managed APIs
      ALSA: rme32: Allocate resources with device-managed APIs
      ALSA: rme96: Allocate resources with device-managed APIs
      ALSA: sis7019: Allocate resources with device-managed APIs
      ALSA: sonicvibes: Allocate resources with device-managed APIs
      ALSA: via82xx: Allocate resources with device-managed APIs
      ALSA: ali5451: Allocate resources with device-managed APIs
      ALSA: au88x0: Allocate resources with device-managed APIs
      ALSA: aw2: Allocate resources with device-managed APIs
      ALSA: ca0106: Allocate resources with device-managed APIs
      ALSA: cs46xx: Allocate resources with device-managed APIs
      ALSA: cs5535audio: Allocate resources with device-managed APIs
      ALSA: echoaudio: Allocate resources with device-managed APIs
      ALSA: emu10k1: Allocate resources with device-managed APIs
      ALSA: emu10k1x: Allocate resources with device-managed APIs
      ALSA: ice1712: Allocate resources with device-managed APIs
      ALSA: ice1724: Allocate resources with device-managed APIs
      ALSA: ali5451: Allocate resources with device-managed APIs
      ALSA: ice1724: Allocate resources with device-managed APIs
      ALSA: korg1212: Allocate resources with device-managed APIs
      ALSA: lola: Allocate resources with device-managed APIs
      ALSA: lx6464es: Allocate resources with device-managed APIs
      ALSA: nm256: Allocate resources with device-managed APIs
      ALSA: oxygen: Allocate resources with device-managed APIs
      ALSA: riptide: Allocate resources with device-managed APIs
      ALSA: hdsp: Allocate resources with device-managed APIs
      ALSA: hdspm: Allocate resources with device-managed APIs
      ALSA: rme9652: Allocate resources with device-managed APIs
      ALSA: trident: Allocate resources with device-managed APIs
      ALSA: vx: Manage vx_core object with devres
      ALSA: vx222: Allocate resources with device-managed APIs
      ALSA: ymfpci: Allocate resources with device-managed APIs
      ALSA: ad1816a: Allocate resources with device-managed APIs
      ALSA: wss: Allocate resources with device-managed APIs
      ALSA: sb: Allocate resources with device-managed APIs
      ALSA: ad1848: Allocate resources with device-managed APIs
      ALSA: adlib: Allocate resources with device-managed APIs
      ALSA: als100: Allocate resources with device-managed APIs
      ALSA: azt2320: Allocate resources with device-managed APIs
      ALSA: cmi8328: Allocate resources with device-managed APIs
      ALSA: cmi8330: Allocate resources with device-managed APIs
      ALSA: cs423x: Allocate resources with device-managed APIs
      ALSA: es1688: Allocate resources with device-managed APIs
      ALSA: es18xx: Allocate resources with device-managed APIs
      ALSA: galaxy: Allocate resources with device-managed APIs
      ALSA: gus: Allocate resources with device-managed APIs
      ALSA: msnd: Allocate resources with device-managed APIs
      ALSA: opti9xx: Allocate resources with device-managed APIs
      ALSA: opl3sa2: Allocate resources with device-managed APIs
      ALSA: sc6000: Allocate resources with device-managed APIs
      ALSA: sscape: Allocate resources with device-managed APIs
      ALSA: wavefront: Allocate resources with device-managed APIs
      ALSA: x86: Allocate resources with device-managed APIs
      ALSA: virmidi: Allocate resources with device-managed APIs
      ALSA: mtpav: Allocate resources with device-managed APIs
      ALSA: serial-u16550: Allocate resources with device-managed APIs
      ALSA: mpu401: Allocate resources with device-managed APIs
      ALSA: aloop: Allocate resources with device-managed APIs
      ALSA: dummy: Allocate resources with device-managed APIs
      ALSA: pcsp: Allocate resources with device-managed APIs
      ALSA: sc6000: Assign vport directly on card's private_data
      ALSA: cs4281: Fix missing chip initialization
      ALSA: als300: Fix missing chip initialization
      ALSA: korg1212: Fix wrongly shuffled firmware loader code
      ALSA: sc6000: Use explicit cast for __iomem pointer
      ALSA: seq: Fix comments of wrong client number for MIDI Passthrough
      ASoC: amd: Drop superfluous mmap callbacks
      ASoC: intel: skylake: Drop superfluous mmap callback
      ALSA: core: Fix double calls of snd_card_free() via devres
      Merge branch 'for-linus' into for-next
      ALSA: usb-audio: Introduce quirk_flags field
      ALSA: usb-audio: Move media-controller API quirk into quirk_flags
      ALSA: usb-audio: Move txfr_quirk handling to quirk_flags
      ALSA: usb-audio: Move tx_length quirk handling to quirk_flags
      ALSA: usb-audio: Move playback_first flag into quirk_flags
      ALSA: usb-audio: Move clock setup quirk into quirk_flags
      ALSA: usb-audio: Move ITF-USB DSD quirk handling into quirk_flags
      ALSA: usb-audio: Move control message delay quirk into quirk_flags
      ALSA: usb-audio: Move interface setup delay into quirk_flags
      ALSA: usb-audio: Move rate validation quirk into quirk_flags
      ALSA: usb-audio: Move autosuspend quirk into quirk_flags
      ALSA: usb-audio: Move ignore_ctl_error check into quirk_flags
      ALSA: usb-audio: Move generic DSD raw detection into quirk_flags
      ALSA: usb-audio: Add quirk_flags module option
      ALSA: doc: Add the description of quirk_flags option for snd-usb-audio
      ALSA: memalloc: Minor refactoring
      ALSA: memalloc: Correctly name as WC
      ALSA: pcm: Allow exact buffer preallocation
      ALSA: memalloc: Support WC allocation on all architectures
      ALSA: pxa2xx: Use managed PCM buffer allocation
      ASoC: bcm: Use managed PCM buffer allocation
      ASoC: fsl: imx-pcm-fiq: Use managed buffer allocation
      ASoC: fsl: imx-pcm-rpmsg: Use managed buffer allocation
      ASoC: tegra: Use managed buffer allocation
      ASoC: fsl_asrc_dma: Use managed buffer allocation
      ASoC: fsl_dma: Use managed buffer allocation
      ASoC: mpc5200: Use managed buffer allocation
      ASoC: qcom: lpass: Use managed buffer allocation
      ASoC: qcom: qdsp6: Use managed buffer allocation
      ASoC: sprd: Use managed buffer allocation
      ALSA: memalloc: Fix pgprot for WC mmap on x86
      ALSA: memalloc: Store snd_dma_buffer.addr for continuous pages, too
      ASoC: amd: vangogh: Drop superfluous mmap callback
      ALSA: es1688: Avoid devres management for es1688 object creation
      ALSA: memalloc: Fix mmap of SG-buffer with WC pages
      Merge branch 'for-linus' into for-next
      ALSA: harmony: Drop superfluous address setup
      ALSA: pcm: Check mmap capability of runtime dma buffer at first
      ALSA: pci: rme: Set up buffer type properly
      ALSA: pci: cs46xx: Fix set up buffer type properly
      ALSA: msnd: Use proper mmap method
      ALSA: memalloc: Count continuous pages in vmalloc buffer handler
      ALSA: pcm: Add SNDRV_PCM_INFO_EXPLICIT_SYNC flag
      ALSA: hda: conexant: Turn off EAPD at suspend, too
      ALSA: hda: Suspend codec at shutdown
      ALSA: hda: Nuke unused reboot_notify callback
      Merge branch 'for-linus' into for-next
      ALSA: hda: Drop workaround for a hang at shutdown again
      ALSA: hda/realtek: Workaround for conflicting SSID on ASUS ROG Strix G17
      ALSA: hda: Code refactoring snd_hda_pick_fixup()
      ALSA: hda: Allow model option to specify PCI SSID alias
      ALSA: hda: Update documentation for aliasing via the model option
      ALSA: doc: Fix indentation warning
      Merge branch 'for-linus' into for-next
      ASoC: intel: atom: Revert PCM buffer address setup workaround again
      ALSA: usb-audio: Fix regression on Sony WALKMAN NW-A45 DAC
      Merge branch 'for-linus' into for-next
      ALSA: usb-audio: Move set-interface-first workaround into common quirk
      ALSA: hda: Disable runtime resume at shutdown
      ALSA: usb-audio: Work around for XRUN with low latency playback
      ALSA: usb-audio: Add lowlatency module option
      Merge branch 'for-linus' into for-next
      Merge tag 'asoc-v5.15' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

Takashi Sakamoto (1):
      ALSA: firewire-motu: add support for MOTU 896HD

Tang Bin (2):
      ASoC: fsl_xcvr: Omit superfluous error message in fsl_xcvr_probe()
      ASoC: bcm: cygnus-pcm: Fix unused assignment about 'rc'

Trevor Wu (11):
      ASoC: mediatek: mt8195: update mediatek common driver
      ASoC: mediatek: mt8195: support audsys clock control
      ASoC: mediatek: mt8195: support etdm in platform driver
      ASoC: mediatek: mt8195: support adda in platform driver
      ASoC: mediatek: mt8195: support pcm in platform driver
      ASoC: mediatek: mt8195: add platform driver
      dt-bindings: mediatek: mt8195: add audio afe document
      ASoC: mediatek: mt8195: add machine driver with mt6359, rt1019 and rt5682
      ASoC: mediatek: mt8195: add DPTX audio support
      ASoC: mediatek: mt8195: add HDMITX audio support
      dt-bindings: mediatek: mt8195: add mt8195-mt6359-rt1019-rt5682 document

Tzung-Bi Shih (1):
      ASoC: rt1015: remove possible unused variable `bclk_ms'

Vijendar Mukunda (12):
      ASoC: amd: add Vangogh ACP5x IP register header
      ASoC: amd: add Vangogh ACP PCI driver
      ASoc: amd: add acp5x init/de-init functions
      ASoC: amd: create acp5x platform devices
      ASoC: amd: add ACP5x PCM platform driver
      ASoC: amd: irq handler changes for ACP5x PCM dma driver
      ASoC: amd: add ACP5x pcm dma driver ops
      ASoC: amd: add vangogh i2s controller driver
      ASoC: amd: add vangogh i2s dai driver ops
      ASoC: amd: add vangogh pci driver pm ops
      ASoC: amd: add vangogh i2s dma driver pm ops
      ASoC: amd: enable vangogh acp5x driver build

Vincent Knecht (1):
      ASoC: qcom: apq8016_sbc: Add SEC_MI2S support

Wolfram Sang (1):
      ASoC: sh: rcar: dma: : use proper DMAENGINE API for termination

Xiaotan Luo (1):
      ASoC: rockchip: i2s: Fixup config for DAIFMT_DSP_A/B

Yang Yingliang (1):
      ALSA: nm256: Fix error return code in snd_nm256_create()

Zhang Qilong (2):
      ASoC: mediatek: mt8192:Fix Unbalanced pm_runtime_enable in mt8192_afe_pcm_dev_probe
      ASoC: mediatek: mt8183: Fix Unbalanced pm_runtime_enable in mt8183_afe_pcm_dev_probe

Zubin Mithra (1):
      ALSA: pcm: fix divide error in snd_pcm_lib_ioctl

jairaj arava (2):
      ASoC: Intel: sof_sdw: update quirk for jack detection in ADL RVP
      ASoC: SOF: Intel: Use DMI string to search for adl_mx98373_rt5682 variant

kernel test robot (1):
      ASoC: codecs: wcd938x: fix returnvar.cocci warnings

 Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt          |    1 +
 Documentation/devicetree/bindings/sound/ics43432.txt                     |    6 +-
 Documentation/devicetree/bindings/sound/mt8195-afe-pcm.yaml              |  184 +++++++
 Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1019-rt5682.yaml |   47 ++
 Documentation/devicetree/bindings/sound/realtek,rt1015p.yaml             |    4 +-
 Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml              |  118 ++++
 Documentation/devicetree/bindings/sound/rockchip-i2s.yaml                |   11 +
 Documentation/devicetree/bindings/sound/rockchip-spdif.yaml              |    1 +
 Documentation/devicetree/bindings/vendor-prefixes.yaml                   |    2 +
 Documentation/sound/alsa-configuration.rst                               |   34 +-
 Documentation/sound/hd-audio/notes.rst                                   |   11 +
 Documentation/sound/kernel-api/writing-an-alsa-driver.rst                |   33 ++
 drivers/soundwire/intel.c                                                |   74 ---
 drivers/soundwire/intel_init.c                                           |   14 +-
 include/linux/platform_data/davinci_asp.h                                |    1 +
 include/linux/soundwire/sdw_intel.h                                      |   87 +++
 include/sound/compress_driver.h                                          |    2 -
 include/sound/core.h                                                     |    6 +
 include/sound/emu10k1.h                                                  |    6 +-
 include/sound/emu8000.h                                                  |    3 -
 include/sound/hda_codec.h                                                |    1 -
 include/sound/hdaudio_ext.h                                              |    2 +-
 include/sound/memalloc.h                                                 |   10 +-
 include/sound/pcm.h                                                      |   47 +-
 include/sound/pxa2xx-lib.h                                               |   13 +-
 include/sound/sof.h                                                      |    1 +
 include/uapi/sound/asound.h                                              |    1 +
 include/uapi/sound/snd_sst_tokens.h                                      |    6 +-
 sound/arm/pxa2xx-ac97.c                                                  |   18 +-
 sound/arm/pxa2xx-pcm-lib.c                                               |   90 +--
 sound/core/compress_offload.c                                            |   69 +--
 sound/core/control_led.c                                                 |    2 +-
 sound/core/init.c                                                        |  105 +++-
 sound/core/isadma.c                                                      |   38 ++
 sound/core/memalloc.c                                                    |  177 ++++--
 sound/core/memalloc_local.h                                              |    2 +-
 sound/core/pcm_lib.c                                                     |    2 +-
 sound/core/pcm_memory.c                                                  |   67 ++-
 sound/core/pcm_native.c                                                  |   18 +-
 sound/core/seq/seq_dummy.c                                               |    8 +-
 sound/core/sgbuf.c                                                       |   30 +-
 sound/drivers/Kconfig                                                    |    2 +-
 sound/drivers/aloop.c                                                    |   26 +-
 sound/drivers/dummy.c                                                    |   24 +-
 sound/drivers/mpu401/mpu401.c                                            |   34 +-
 sound/drivers/mtpav.c                                                    |   30 +-
 sound/drivers/pcsp/pcsp.c                                                |   49 +-
 sound/drivers/pcsp/pcsp_input.c                                          |   14 +-
 sound/drivers/pcsp/pcsp_input.h                                          |    1 -
 sound/drivers/serial-u16550.c                                            |   57 +-
 sound/drivers/virmidi.c                                                  |   21 +-
 sound/drivers/vx/vx_core.c                                               |   12 +-
 sound/firewire/motu/motu-protocol-v2.c                                   |   22 +-
 sound/firewire/motu/motu.c                                               |    1 +
 sound/firewire/motu/motu.h                                               |    1 +
 sound/isa/ad1816a/ad1816a.c                                              |   41 +-
 sound/isa/ad1816a/ad1816a_lib.c                                          |   49 +-
 sound/isa/ad1848/ad1848.c                                                |   19 +-
 sound/isa/adlib.c                                                        |   28 +-
 sound/isa/als100.c                                                       |   41 +-
 sound/isa/azt2320.c                                                      |   49 +-
 sound/isa/cmi8328.c                                                      |   31 +-
 sound/isa/cmi8330.c                                                      |   27 +-
 sound/isa/cs423x/cs4231.c                                                |   21 +-
 sound/isa/cs423x/cs4236.c                                                |   52 +-
 sound/isa/cs423x/cs4236_lib.c                                            |    2 -
 sound/isa/es1688/es1688.c                                                |   33 +-
 sound/isa/es18xx.c                                                       |  112 +---
 sound/isa/galaxy/galaxy.c                                                |   82 ++-
 sound/isa/gus/gus_main.c                                                 |   44 +-
 sound/isa/gus/gusclassic.c                                               |   28 +-
 sound/isa/gus/gusextreme.c                                               |   39 +-
 sound/isa/gus/gusmax.c                                                   |   65 +--
 sound/isa/gus/interwave.c                                                |   53 +-
 sound/isa/msnd/msnd.c                                                    |    8 +-
 sound/isa/msnd/msnd_pinnacle.c                                           |  119 +---
 sound/isa/opl3sa2.c                                                      |   60 +-
 sound/isa/opti9xx/miro.c                                                 |   76 +--
 sound/isa/opti9xx/opti92x-ad1848.c                                       |   77 +--
 sound/isa/sb/emu8000.c                                                   |   48 +-
 sound/isa/sb/jazz16.c                                                    |   39 +-
 sound/isa/sb/sb16.c                                                      |   42 +-
 sound/isa/sb/sb8.c                                                       |   48 +-
 sound/isa/sb/sb_common.c                                                 |   64 +--
 sound/isa/sc6000.c                                                       |   84 ++-
 sound/isa/sscape.c                                                       |   92 +---
 sound/isa/wavefront/wavefront.c                                          |   46 +-
 sound/isa/wss/wss_lib.c                                                  |   67 +--
 sound/parisc/harmony.c                                                   |   14 -
 sound/pci/ad1889.c                                                       |  144 +----
 sound/pci/ali5451/ali5451.c                                              |   90 +--
 sound/pci/als300.c                                                       |   80 +--
 sound/pci/als4000.c                                                      |   59 +-
 sound/pci/atiixp.c                                                       |   92 +---
 sound/pci/atiixp_modem.c                                                 |   92 +---
 sound/pci/au88x0/au88x0.c                                                |  134 +----
 sound/pci/aw2/aw2-alsa.c                                                 |  102 +---
 sound/pci/azt3328.c                                                      |  124 +----
 sound/pci/bt87x.c                                                        |   98 +---
 sound/pci/ca0106/ca0106.h                                                |    3 +-
 sound/pci/ca0106/ca0106_main.c                                           |  114 +---
 sound/pci/cmipci.c                                                       |  104 +---
 sound/pci/cs4281.c                                                       |  114 +---
 sound/pci/cs46xx/cs46xx.c                                                |   51 +-
 sound/pci/cs46xx/cs46xx.h                                                |    4 +-
 sound/pci/cs46xx/cs46xx_lib.c                                            |  141 ++---
 sound/pci/cs5530.c                                                       |   86 +--
 sound/pci/cs5535audio/cs5535audio.c                                      |   94 +---
 sound/pci/cs5535audio/cs5535audio_olpc.c                                 |    7 +-
 sound/pci/echoaudio/echoaudio.c                                          |  168 ++----
 sound/pci/echoaudio/echoaudio.h                                          |    2 +-
 sound/pci/emu10k1/emu10k1.c                                              |   53 +-
 sound/pci/emu10k1/emu10k1_main.c                                         |  102 +---
 sound/pci/emu10k1/emu10k1x.c                                             |  128 +----
 sound/pci/emu10k1/p16v.c                                                 |   22 +-
 sound/pci/ens1370.c                                                      |  115 +---
 sound/pci/es1938.c                                                       |   97 +---
 sound/pci/es1968.c                                                       |  112 +---
 sound/pci/fm801.c                                                        |  103 +---
 sound/pci/hda/Kconfig                                                    |   10 +
 sound/pci/hda/Makefile                                                   |    2 +
 sound/pci/hda/hda_auto_parser.c                                          |   84 +--
 sound/pci/hda/hda_bind.c                                                 |    8 +-
 sound/pci/hda/hda_codec.c                                                |   12 +
 sound/pci/hda/hda_controller.c                                           |   13 +-
 sound/pci/hda/hda_controller.h                                           |    3 -
 sound/pci/hda/hda_generic.c                                              |   19 -
 sound/pci/hda/hda_generic.h                                              |    1 -
 sound/pci/hda/hda_intel.c                                                |   52 +-
 sound/pci/hda/hda_local.h                                                |    2 +
 sound/pci/hda/patch_analog.c                                             |   11 +-
 sound/pci/hda/patch_ca0132.c                                             |    8 +-
 sound/pci/hda/patch_cirrus.c                                             | 1074 ------------------------------------
 sound/pci/hda/patch_conexant.c                                           |   15 +-
 sound/pci/hda/patch_cs8409-tables.c                                      |  560 +++++++++++++++++++
 sound/pci/hda/patch_cs8409.c                                             | 1299 ++++++++++++++++++++++++++++++++++++++++++++
 sound/pci/hda/patch_cs8409.h                                             |  371 +++++++++++++
 sound/pci/hda/patch_hdmi.c                                               |    7 +
 sound/pci/hda/patch_realtek.c                                            |   24 +-
 sound/pci/hda/patch_sigmatel.c                                           |   23 +-
 sound/pci/ice1712/ice1712.c                                              |  133 +----
 sound/pci/ice1712/ice1724.c                                              |  167 ++----
 sound/pci/intel8x0.c                                                     |  144 ++---
 sound/pci/intel8x0m.c                                                    |  139 ++---
 sound/pci/korg1212/korg1212.c                                            |  211 ++------
 sound/pci/lola/lola.c                                                    |  127 ++---
 sound/pci/lola/lola.h                                                    |    5 +-
 sound/pci/lola/lola_pcm.c                                                |   20 +-
 sound/pci/lx6464es/lx6464es.c                                            |  112 +---
 sound/pci/maestro3.c                                                     |  106 +---
 sound/pci/nm256/nm256.c                                                  |  131 ++---
 sound/pci/oxygen/oxygen.c                                                |    1 -
 sound/pci/oxygen/oxygen.h                                                |    1 -
 sound/pci/oxygen/oxygen_lib.c                                            |   66 +--
 sound/pci/oxygen/se6x.c                                                  |    1 -
 sound/pci/oxygen/virtuoso.c                                              |    1 -
 sound/pci/pcxhr/pcxhr.c                                                  |   47 +-
 sound/pci/riptide/riptide.c                                              |   89 +--
 sound/pci/rme32.c                                                        |   49 +-
 sound/pci/rme96.c                                                        |   57 +-
 sound/pci/rme9652/hdsp.c                                                 |   95 +---
 sound/pci/rme9652/hdspm.c                                                |   64 +--
 sound/pci/rme9652/rme9652.c                                              |   91 +---
 sound/pci/sis7019.c                                                      |   87 +--
 sound/pci/sonicvibes.c                                                   |  117 +---
 sound/pci/trident/trident.c                                              |   39 +-
 sound/pci/trident/trident.h                                              |    7 +-
 sound/pci/trident/trident_main.c                                         |   90 +--
 sound/pci/trident/trident_memory.c                                       |    8 +-
 sound/pci/via82xx.c                                                      |  116 +---
 sound/pci/via82xx_modem.c                                                |   88 +--
 sound/pci/vx222/vx222.c                                                  |   69 +--
 sound/pci/ymfpci/ymfpci.c                                                |   66 +--
 sound/pci/ymfpci/ymfpci.h                                                |    8 +-
 sound/pci/ymfpci/ymfpci_main.c                                           |  149 ++---
 sound/pcmcia/vx/vxpocket.c                                               |   22 -
 sound/soc/amd/Kconfig                                                    |    9 +
 sound/soc/amd/Makefile                                                   |    1 +
 sound/soc/amd/acp-da7219-max98357a.c                                     |   12 +-
 sound/soc/amd/acp-pcm-dma.c                                              |   20 +-
 sound/soc/amd/acp3x-rt5682-max9836.c                                     |   14 +-
 sound/soc/amd/raven/acp3x-pcm-dma.c                                      |   10 +-
 sound/soc/amd/renoir/acp3x-pdm-dma.c                                     |    8 -
 sound/soc/amd/renoir/acp3x-rn.c                                          |    7 +-
 sound/soc/amd/vangogh/Makefile                                           |    9 +
 sound/soc/amd/vangogh/acp5x-i2s.c                                        |  427 +++++++++++++++
 sound/soc/amd/vangogh/acp5x-pcm-dma.c                                    |  517 ++++++++++++++++++
 sound/soc/amd/vangogh/acp5x.h                                            |  193 +++++++
 sound/soc/amd/vangogh/pci-acp5x.c                                        |  326 +++++++++++
 sound/soc/amd/vangogh/vg_chip_offset_byte.h                              |  337 ++++++++++++
 sound/soc/atmel/Kconfig                                                  |    1 -
 sound/soc/atmel/mchp-spdifrx.c                                           |    6 +-
 sound/soc/atmel/mchp-spdiftx.c                                           |    2 +-
 sound/soc/atmel/tse850-pcm5142.c                                         |    2 +-
 sound/soc/bcm/bcm63xx-pcm-whistler.c                                     |   82 +--
 sound/soc/bcm/cygnus-pcm.c                                               |    2 +-
 sound/soc/codecs/Kconfig                                                 |   21 +-
 sound/soc/codecs/Makefile                                                |    2 +
 sound/soc/codecs/ad193x.c                                                |   30 +-
 sound/soc/codecs/ad193x.h                                                |    4 +
 sound/soc/codecs/cs42l42.c                                               |   28 +-
 sound/soc/codecs/cx20442.c                                               |    8 +-
 sound/soc/codecs/ics43432.c                                              |    4 +-
 sound/soc/codecs/lpass-rx-macro.c                                        |   65 +--
 sound/soc/codecs/max98090.c                                              |    4 +-
 sound/soc/codecs/max98390.c                                              |   26 +-
 sound/soc/codecs/max98390.h                                              |    1 +
 sound/soc/codecs/mt6359-accdet.c                                         |   25 +-
 sound/soc/codecs/rt1015.c                                                |   46 +-
 sound/soc/codecs/rt1015.h                                                |    2 -
 sound/soc/codecs/rt1015p.c                                               |    2 +
 sound/soc/codecs/rt5514.c                                                |    2 +-
 sound/soc/codecs/rt5640.c                                                |  133 +++--
 sound/soc/codecs/rt5640.h                                                |    6 +
 sound/soc/codecs/rt5682-i2c.c                                            |   15 +-
 sound/soc/codecs/rt5682.c                                                |   57 +-
 sound/soc/codecs/sdw-mockup.c                                            |  310 +++++++++++
 sound/soc/codecs/tlv320aic32x4.c                                         |   10 +-
 sound/soc/codecs/wcd9335.c                                               |   23 +-
 sound/soc/codecs/wcd938x.c                                               |  854 +++++++++++++++++++++++++++--
 sound/soc/codecs/wcd938x.h                                               |    1 -
 sound/soc/codecs/wm_adsp.c                                               |    9 +-
 sound/soc/dwc/dwc-i2s.c                                                  |    2 +-
 sound/soc/fsl/fsl_asrc_dma.c                                             |   47 +-
 sound/soc/fsl/fsl_dma.c                                                  |   50 +-
 sound/soc/fsl/fsl_rpmsg.c                                                |   20 +-
 sound/soc/fsl/fsl_xcvr.c                                                 |    4 +-
 sound/soc/fsl/imx-pcm-fiq.c                                              |   75 +--
 sound/soc/fsl/imx-pcm-rpmsg.c                                            |   89 +--
 sound/soc/fsl/imx-rpmsg.c                                                |    2 +-
 sound/soc/fsl/mpc5200_dma.c                                              |   63 +--
 sound/soc/generic/simple-card-utils.c                                    |    4 +-
 sound/soc/intel/atom/sst-mfld-platform-pcm.c                             |    2 +-
 sound/soc/intel/atom/sst/sst_ipc.c                                       |    2 +-
 sound/soc/intel/boards/Kconfig                                           |    1 +
 sound/soc/intel/boards/bytcht_es8316.c                                   |   31 +-
 sound/soc/intel/boards/bytcr_rt5640.c                                    |  328 ++++++++++-
 sound/soc/intel/boards/bytcr_rt5651.c                                    |   63 ++-
 sound/soc/intel/boards/kbl_da7219_max98927.c                             |   55 +-
 sound/soc/intel/boards/sof_cs42l42.c                                     |  361 ++++++++----
 sound/soc/intel/boards/sof_maxim_common.c                                |   17 +-
 sound/soc/intel/boards/sof_maxim_common.h                                |    4 +-
 sound/soc/intel/boards/sof_pcm512x.c                                     |   13 +-
 sound/soc/intel/boards/sof_rt5682.c                                      |   66 +--
 sound/soc/intel/boards/sof_sdw.c                                         |  105 +++-
 sound/soc/intel/boards/sof_sdw_common.h                                  |   64 ++-
 sound/soc/intel/boards/sof_sdw_max98373.c                                |    7 +-
 sound/soc/intel/boards/sof_sdw_rt1308.c                                  |    3 +-
 sound/soc/intel/boards/sof_sdw_rt1316.c                                  |    3 +-
 sound/soc/intel/boards/sof_sdw_rt5682.c                                  |    3 +-
 sound/soc/intel/boards/sof_sdw_rt700.c                                   |    3 +-
 sound/soc/intel/boards/sof_sdw_rt711.c                                   |   51 +-
 sound/soc/intel/boards/sof_sdw_rt711_sdca.c                              |   52 +-
 sound/soc/intel/boards/sof_sdw_rt715.c                                   |    3 +-
 sound/soc/intel/boards/sof_sdw_rt715_sdca.c                              |    3 +-
 sound/soc/intel/common/Makefile                                          |    3 +-
 sound/soc/intel/common/soc-acpi-intel-cml-match.c                        |    2 +-
 sound/soc/intel/common/soc-acpi-intel-cnl-match.c                        |   15 +
 sound/soc/intel/common/soc-acpi-intel-jsl-match.c                        |    8 +
 sound/soc/intel/common/soc-acpi-intel-kbl-match.c                        |    2 +-
 sound/soc/intel/common/soc-acpi-intel-sdw-mockup-match.c                 |  166 ++++++
 sound/soc/intel/common/soc-acpi-intel-sdw-mockup-match.h                 |   17 +
 sound/soc/intel/common/soc-acpi-intel-tgl-match.c                        |   38 ++
 sound/soc/intel/skylake/skl-messages.c                                   |  155 ++++--
 sound/soc/intel/skylake/skl-pcm.c                                        |   33 +-
 sound/soc/intel/skylake/skl-topology.c                                   |  155 +++---
 sound/soc/intel/skylake/skl-topology.h                                   |   26 +-
 sound/soc/mediatek/Kconfig                                               |   24 +
 sound/soc/mediatek/Makefile                                              |    1 +
 sound/soc/mediatek/common/mtk-afe-fe-dai.c                               |   22 +-
 sound/soc/mediatek/common/mtk-base-afe.h                                 |   10 +-
 sound/soc/mediatek/mt8183/mt8183-afe-pcm.c                               |   43 +-
 sound/soc/mediatek/mt8192/mt8192-afe-pcm.c                               |   27 +-
 sound/soc/mediatek/mt8195/Makefile                                       |   15 +
 sound/soc/mediatek/mt8195/mt8195-afe-clk.c                               |  441 +++++++++++++++
 sound/soc/mediatek/mt8195/mt8195-afe-clk.h                               |  109 ++++
 sound/soc/mediatek/mt8195/mt8195-afe-common.h                            |  158 ++++++
 sound/soc/mediatek/mt8195/mt8195-afe-pcm.c                               | 3281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/mediatek/mt8195/mt8195-audsys-clk.c                            |  214 ++++++++
 sound/soc/mediatek/mt8195/mt8195-audsys-clk.h                            |   15 +
 sound/soc/mediatek/mt8195/mt8195-audsys-clkid.h                          |   93 ++++
 sound/soc/mediatek/mt8195/mt8195-dai-adda.c                              |  830 ++++++++++++++++++++++++++++
 sound/soc/mediatek/mt8195/mt8195-dai-etdm.c                              | 2639 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/mediatek/mt8195/mt8195-dai-pcm.c                               |  389 +++++++++++++
 sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c                  | 1087 +++++++++++++++++++++++++++++++++++++
 sound/soc/mediatek/mt8195/mt8195-reg.h                                   | 2796 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/pxa/pxa-ssp.c                                                  |    3 -
 sound/soc/pxa/pxa2xx-ac97.c                                              |    3 -
 sound/soc/pxa/pxa2xx-i2s.c                                               |    3 -
 sound/soc/pxa/pxa2xx-pcm.c                                               |    3 -
 sound/soc/qcom/apq8016_sbc.c                                             |   17 +
 sound/soc/qcom/lpass-platform.c                                          |   60 +-
 sound/soc/qcom/qdsp6/q6adm.c                                             |    2 +-
 sound/soc/qcom/qdsp6/q6asm-dai.c                                         |   63 +--
 sound/soc/qcom/qdsp6/q6asm.c                                             |    2 +-
 sound/soc/rockchip/rockchip_i2s.c                                        |  212 +++++---
 sound/soc/rockchip/rockchip_i2s.h                                        |   10 +-
 sound/soc/rockchip/rockchip_spdif.c                                      |   38 +-
 sound/soc/samsung/aries_wm8994.c                                         |    2 +-
 sound/soc/samsung/arndale.c                                              |    4 +-
 sound/soc/samsung/h1940_uda1380.c                                        |    2 +-
 sound/soc/samsung/littlemill.c                                           |    2 +-
 sound/soc/samsung/midas_wm1811.c                                         |    2 +-
 sound/soc/samsung/neo1973_wm8753.c                                       |    4 +-
 sound/soc/samsung/rx1950_uda1380.c                                       |    2 +-
 sound/soc/samsung/smartq_wm8987.c                                        |    2 +-
 sound/soc/samsung/smdk_wm8580.c                                          |    2 +-
 sound/soc/samsung/smdk_wm8994.c                                          |    2 +-
 sound/soc/samsung/smdk_wm8994pcm.c                                       |    2 +-
 sound/soc/samsung/tm2_wm5110.c                                           |    6 +-
 sound/soc/samsung/tobermory.c                                            |    2 +-
 sound/soc/sh/Kconfig                                                     |    6 +
 sound/soc/sh/Makefile                                                    |    4 +
 sound/soc/sh/rcar/adg.c                                                  |   12 +-
 sound/soc/sh/rcar/core.c                                                 |    6 +-
 sound/soc/sh/rcar/dma.c                                                  |    2 +-
 sound/soc/sh/rcar/ssi.c                                                  |    6 +-
 sound/soc/sh/rz-ssi.c                                                    | 1074 ++++++++++++++++++++++++++++++++++++
 sound/soc/soc-ac97.c                                                     |   14 +-
 sound/soc/soc-component.c                                                |    4 +-
 sound/soc/soc-compress.c                                                 |    1 -
 sound/soc/soc-core.c                                                     |   36 +-
 sound/soc/soc-dai.c                                                      |   18 +-
 sound/soc/soc-dapm.c                                                     |   65 +--
 sound/soc/soc-generic-dmaengine-pcm.c                                    |    9 +-
 sound/soc/soc-jack.c                                                     |   15 +-
 sound/soc/soc-ops.c                                                      |   21 +-
 sound/soc/soc-pcm.c                                                      |   22 +-
 sound/soc/soc-topology.c                                                 |   23 +-
 sound/soc/sof/intel/Kconfig                                              |   10 -
 sound/soc/sof/intel/cnl.c                                                |    6 +
 sound/soc/sof/intel/hda-pcm.c                                            |   16 +-
 sound/soc/sof/intel/hda-stream.c                                         |   11 +-
 sound/soc/sof/intel/hda.c                                                |   39 +-
 sound/soc/sof/intel/hda.h                                                |    8 +-
 sound/soc/sof/intel/icl.c                                                |    3 +
 sound/soc/sof/intel/pci-tng.c                                            |    1 -
 sound/soc/sof/intel/shim.h                                               |    3 +
 sound/soc/sof/intel/tgl.c                                                |   12 +
 sound/soc/sof/sof-audio.c                                                |   42 +-
 sound/soc/sof/sof-pci-dev.c                                              |    9 +
 sound/soc/sprd/sprd-pcm-dma.c                                            |   67 +--
 sound/soc/tegra/tegra210_admaif.c                                        |    6 -
 sound/soc/tegra/tegra30_ahub.c                                           |    6 +-
 sound/soc/tegra/tegra30_i2s.c                                            |    8 +-
 sound/soc/tegra/tegra_pcm.c                                              |   93 +---
 sound/soc/tegra/tegra_pcm.h                                              |    7 -
 sound/soc/ti/Kconfig                                                     |    1 +
 sound/soc/ti/davinci-mcasp.c                                             |  176 +++++-
 sound/soc/ti/j721e-evm.c                                                 |   30 +-
 sound/soc/ti/omap-abe-twl6040.c                                          |    5 -
 sound/soc/uniphier/aio-cpu.c                                             |    4 +-
 sound/usb/card.c                                                         |   46 +-
 sound/usb/card.h                                                         |    2 +
 sound/usb/clock.c                                                        |   15 +-
 sound/usb/endpoint.c                                                     |   21 +-
 sound/usb/format.c                                                       |    6 +-
 sound/usb/implicit.c                                                     |    6 +-
 sound/usb/mixer.c                                                        |   10 +-
 sound/usb/mixer.h                                                        |    3 +-
 sound/usb/mixer_maps.c                                                   |   22 -
 sound/usb/mixer_quirks.c                                                 |  265 ++++++---
 sound/usb/pcm.c                                                          |   14 +-
 sound/usb/quirks-table.h                                                 |   70 +--
 sound/usb/quirks.c                                                       |  361 ++++++------
 sound/usb/quirks.h                                                       |    5 +-
 sound/usb/stream.c                                                       |    4 +-
 sound/usb/usbaudio.h                                                     |   69 ++-
 sound/x86/intel_hdmi_audio.c                                             |   90 +--
 sound/x86/intel_hdmi_audio.h                                             |    1 -
 370 files changed, 24294 insertions(+), 9452 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/mt8195-afe-pcm.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/mt8195-mt6359-rt1019-rt5682.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
 create mode 100644 sound/pci/hda/patch_cs8409-tables.c
 create mode 100644 sound/pci/hda/patch_cs8409.c
 create mode 100644 sound/pci/hda/patch_cs8409.h
 create mode 100644 sound/soc/amd/vangogh/Makefile
 create mode 100644 sound/soc/amd/vangogh/acp5x-i2s.c
 create mode 100644 sound/soc/amd/vangogh/acp5x-pcm-dma.c
 create mode 100644 sound/soc/amd/vangogh/acp5x.h
 create mode 100644 sound/soc/amd/vangogh/pci-acp5x.c
 create mode 100644 sound/soc/amd/vangogh/vg_chip_offset_byte.h
 create mode 100644 sound/soc/codecs/sdw-mockup.c
 create mode 100644 sound/soc/intel/common/soc-acpi-intel-sdw-mockup-match.c
 create mode 100644 sound/soc/intel/common/soc-acpi-intel-sdw-mockup-match.h
 create mode 100644 sound/soc/mediatek/mt8195/Makefile
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-afe-clk.c
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-afe-clk.h
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-afe-common.h
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-audsys-clk.c
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-audsys-clk.h
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-audsys-clkid.h
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-dai-adda.c
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-dai-pcm.c
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
 create mode 100644 sound/soc/mediatek/mt8195/mt8195-reg.h
 create mode 100644 sound/soc/sh/rz-ssi.c

broonie and others added 30 commits August 2, 2021 21:27
…o routing" from Hans de Goede <[email protected]>:

Changes in v2:
- Only set lineout_string if BYT_RT5640_LINEOUT is set, since
  BYT_RT5640_LINEOUT_AS_HP2 only works if the lineout is enabled in
  the first place

Original cover-letter:

The HP Elitepad 1000 G2 has 2 headset jacks:

1. on the dock which uses the output of the codecs built-in HP-amp +
the standard IN2 input which is always used with the headset-jack.

2. on the tablet itself, this uses the line-out of the codec, combined
with an external HP-amp + IN1 for the headset-mic.

This series adds support for this, resolving:
https://bugzilla.kernel.org/show_bug.cgi?id=213415

Note this series does not add jack-detect support. I plan to add that
with a follow-up series when I can make some time to implement that.

Regards,

Hans

Hans de Goede (6):
  ASoC: Intel: bytcr_rt5640: Move "Platform Clock" routes to the maps
    for the matching in-/output
  ASoC: Intel: bytcr_rt5640: Add line-out support
  ASoC: Intel: bytcr_rt5640: Add a byt_rt5640_get_codec_dai() helper
  ASoC: Intel: bytcr_rt5640: Add support for a second headphones output
  ASoC: Intel: bytcr_rt5640: Add support for a second headset mic input
  ASoC: Intel: bytcr_rt5640: Fix HP ElitePad 1000 G2 quirk

 sound/soc/intel/boards/bytcr_rt5640.c | 118 ++++++++++++++++++++++----
 1 file changed, 102 insertions(+), 16 deletions(-)

--
2.31.1
… Bard Liao <[email protected]>:

shim base and alh base are platform-dependent. This series suggests
to use variables for those bases. It allows us to use different bases
for new platforms.

v2:
 - Update the commit message of "soundwire: move intel sdw register
   definitions to sdw_intel.h"

Bard Liao (6):
  soundwire: move intel sdw register definitions to sdw_intel.h
  ASoC: SOF: intel: add sdw_shim/alh_base to sof_intel_dsp_desc
  ASoC: SOF: intel: hda: remove HDA_DSP_REG_SNDW_WAKE_STS definition
  ASoC: SOF: intel: move sof_intel_dsp_desc() forward
  ASoC: SOF: intel: add snd_sof_dsp_check_sdw_irq ops
  soundwire: intel: introduce shim and alh base

 drivers/soundwire/intel.c           | 74 ------------------------
 drivers/soundwire/intel_init.c      | 14 ++---
 include/linux/soundwire/sdw_intel.h | 87 +++++++++++++++++++++++++++++
 sound/soc/sof/intel/cnl.c           |  6 ++
 sound/soc/sof/intel/hda.c           | 39 ++++++++-----
 sound/soc/sof/intel/hda.h           |  8 ++-
 sound/soc/sof/intel/icl.c           |  3 +
 sound/soc/sof/intel/shim.h          |  3 +
 sound/soc/sof/intel/tgl.c           | 12 ++++
 9 files changed, 149 insertions(+), 97 deletions(-)

--
2.17.1
Don't populate array names_to_check on the stack but instead it
static.  Makes the object code smaller by 56 bytes.  Also clean
up checkpatch warning by adding extra const for names_to_check
and pointer s.

Before:
    text    data     bss     dec     hex filename
  103512   34380       0  137892   21aa4 ./sound/usb/mixer.o

After:
    text    data     bss     dec     hex filename
  103264   34572       0  137836   21a6c ./sound/usb/mixer.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
This device has the same audio subsystem as the 0A5E skew (RT711
headset codec, 2 RT1308 amps and RT715 for mic capture)

BugLink: thesofproject/linux#3057
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Kai Vehmanen <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: FRED OH <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
…iant

DMI product name is used to support system variants based on
adl_mx98373_rt5682 in current implementation. Replace this DMI search with
DMI_OEM_STRING and coreboot(BIOS used in these systems) is
setting the needed DMI_OEM_STRING field to uniquely identify these
systems.

Reviewed-by: Bard Liao <[email protected]>
Signed-off-by: jairaj arava <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
The default SOF topology enables SSP capture and DMICs, even though
both of these hardware capabilities are not always available in
hardware (specific versions of HiFiberry and DMIC kit needed).

For the SSP capture, this leads to annoying "SP5-Codec: ASoC: no
backend capture" and "streamSSP5-Codec: ASoC: no users capture at
close - state 0" errors.

Update the quirks to match what the topology needs, which also allows
for the ability to remove SSP capture and DMIC support.

BugLink: thesofproject/linux#3061
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Guennadi Liakhovetski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
No need to initialize a variable if the next line overwrites the value.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Rander Wang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
This patch cleanups below cppcheck warning.

sound/soc/soc-ops.c:410:30: style: The scope of the variable 'val2' can be reduced. [variableScope]
 unsigned int val, val_mask, val2 = 0;
                             ^

Signed-off-by: Kuninori Morimoto <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
This patch cleanups below cppcheck warning.

sound/soc/soc-ops.c:576:28: style: The scope of the variable 'mc' can be reduced. [variableScope]
 struct soc_mixer_control *mc;
                           ^

Signed-off-by: Kuninori Morimoto <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
This patch cleanups below cppcheck warning.

sound/soc/soc-ops.c:814:15: style: The scope of the variable 'regval' can be reduced. [variableScope]
 unsigned int regval;
              ^

Signed-off-by: Kuninori Morimoto <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
This patch cleanups below cppcheck warning.

sound/soc/soc-ops.c:859:18: style: The scope of the variable 'regval' can be reduced. [variableScope]
 unsigned int i, regval, regmask;
                 ^
sound/soc/soc-ops.c:859:26: style: The scope of the variable 'regmask' can be reduced. [variableScope]
 unsigned int i, regval, regmask;
                         ^
sound/soc/soc-ops.c:860:6: style: The scope of the variable 'err' can be reduced. [variableScope]
 int err;
     ^

Signed-off-by: Kuninori Morimoto <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
ad193x devices support 96KHz and 192KHz sampling rates, when PLL/MCLK is
referenced to 48kHz.
Tested on ad1934.

Signed-off-by: Codrin Ciubotariu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Don't populate the array div on the stack but instead it
static const. Makes the object code smaller by 48 bytes.

Before:
   text    data     bss     dec     hex filename
  53894   16368     128   70390   112f6 ./sound/soc/codecs/rt5514.o

After:
   text    data     bss     dec     hex filename
  53750   16464     128   70342   112c6 ./sound/soc/codecs/rt5514.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
…uis Bossart <[email protected]>:

Two quirks added for Dell XPS 9710 and Intel reference boards, and two
minor cleanups.

Pierre-Louis Bossart (3):
  ASoC: Intel: sof_sdw: add quirk for Dell XPS 9710
  ASoC: Intel: update sof_pcm512x quirks
  ASoC: Intel: sof_sdw_max98373: remove useless inits

jairaj arava (1):
  ASoC: SOF: Intel: Use DMI string to search for adl_mx98373_rt5682
    variant

 sound/soc/intel/boards/sof_pcm512x.c      | 13 +++++++++++--
 sound/soc/intel/boards/sof_rt5682.c       | 14 ++++++++++++++
 sound/soc/intel/boards/sof_sdw.c          | 12 ++++++++++++
 sound/soc/intel/boards/sof_sdw_max98373.c |  4 ++--
 sound/soc/sof/sof-pci-dev.c               |  9 +++++++++
 5 files changed, 48 insertions(+), 4 deletions(-)

--
2.25.1
…Morimoto <[email protected]>:

Hi Mark

Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer
discussion. Thus I want to post more easy patch first, and reduce my
local patches.

These are cppcheck warning cleanup patches for soc-ops.

Kuninori Morimoto (4):
  ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_volsw_sx()
  ASoC: soc-ops: cleanup cppcheck warning at snd_soc_limit_volume()
  ASoC: soc-ops: cleanup cppcheck warning at snd_soc_get_xr_sx()
  ASoC: soc-ops: cleanup cppcheck warning at snd_soc_put_xr_sx()

 sound/soc/soc-ops.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

--
2.25.1
Simplify the code by using module_platform_driver macro for
mt6359-accdet.

Signed-off-by: Nobuhiro Iwamatsu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Return the pointer directly from alloc ops instead of setting
dmab->area at each place.  It simplifies the code a bit.

Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
SNDRV_DMA_TYPE_DEV_UC and SNDRV_DMA_TYPE_DEV_UC_SG are incorrectly
named as if they were for the uncached memory, while actually we set
the pages as write-combined.  Rename them to reflect the right
attribute.

Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
A few drivers want to have rather the exact buffer preallocation at
the driver probe time and keep using it for the whole operations
without allowing dynamic buffer allocation.  For satisfying the
demands, this patch extends the managed buffer allocation API
slightly.

Namely, when 0 is passed to max argument of the allocation helper
functions snd_pcm_set_managed_buffer*(), it treats as if the fixed
size allocation of the given size.  If the pre-allocation fails in
this mode, the function returns now -ENOMEM.  Otherwise, i.e. max
argument is non-zero, the function never returns -ENOMEM but tries to
fall back to the smaller chunks and allows the dynamic allocation
later -- which is still the default behavior until now.

For more intuitive use, also two new helpers are added for handling
the fixed size buffer allocation, too: snd_pcm_set_fixed_buffer() and
snd_pcm_set_fixed_buffer_all().

Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
There are the generic DMA API calls for allocating and managing the
pages with the write-combined attribute.  Let's use them for all
architectures but x86; x86 still needs the special handling to
override the page attributes.

Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
Now with the recent addition of WC buffer allocation support, we can
use the standard PCM buffer allocation helpers for pxa2xx drivers.
This allows us to remove lots of superfluous code.

Cc: Daniel Mack <[email protected]>
Cc: Haojian Zhuang <[email protected]>
Cc: Robert Jarzmik <[email protected]>
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
As the standard buffer allocation helper supports WC pages now, we can
convert bcm driver to use that.  This allows us to remove lots of
superfluous code.

Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
As the standard buffer allocation helper supports WC pages now, we can
convert imx-pcm-fiq driver to use that.  This allows us to remove lots
of superfluous code.

Cc: Nicolin Chen <[email protected]>
Cc: Xiubo Li <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Shengjiu Wang <[email protected]>
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
As the standard buffer allocation helper supports WC pages now, we can
convert imx-pcm-rpmsg driver to use that.  This allows us to remove
lots of superfluous code.

Cc: Nicolin Chen <[email protected]>
Cc: Xiubo Li <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Shengjiu Wang <[email protected]>
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
As the standard buffer allocation helper supports WC pages now, we can
convert imx-pcm-rpmsg driver to use that.  This allows us to remove
lots of superfluous code.

Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
This patch simplifies the buffer pre-allocation code of fsl_asrc_dma
driver with the standard managed buffer helper.  It uses the newly
introduced fixed-size buffer allocation helper.

Cc: Nicolin Chen <[email protected]>
Cc: Xiubo Li <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Shengjiu Wang <[email protected]>
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
This patch simplifies the buffer pre-allocation code of fsl_dma
driver with the standard managed buffer helper.  It uses the newly
introduced fixed-size buffer allocation helper.

Cc: Nicolin Chen <[email protected]>
Cc: Xiubo Li <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Shengjiu Wang <[email protected]>
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
This patch simplifies the buffer pre-allocation code of fsl mpc5200
driver with the standard managed buffer helper.  It uses the newly
introduced fixed-size buffer allocation helper.

Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
This patch simplifies the buffer pre-allocation code of qcom lpass
driver with the standard managed buffer helper.  It uses the newly
introduced fixed-size buffer allocation helper.

Cc: Srinivas Kandagatla <[email protected]>
Cc: Banajit Goswami <[email protected]>
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
This patch simplifies the buffer pre-allocation code of qcom qdsp6
driver with the standard managed buffer helper.  It uses the newly
introduced fixed-size buffer allocation helper.

Cc: Srinivas Kandagatla <[email protected]>
Cc: Banajit Goswami <[email protected]>
Acked-by: Mark Brown <[email protected]>
Tested-by: Srinivas Kandagatla <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
Drop support for virtualizing adaptive PEBS, as KVM's implementation is
architecturally broken without an obvious/easy path forward, and because
exposing adaptive PEBS can leak host LBRs to the guest, i.e. can leak
host kernel addresses to the guest.

Bug #1 is that KVM doesn't account for the upper 32 bits of
IA32_FIXED_CTR_CTRL when (re)programming fixed counters, e.g
fixed_ctrl_field() drops the upper bits, reprogram_fixed_counters()
stores local variables as u8s and truncates the upper bits too, etc.

Bug #2 is that, because KVM _always_ sets precise_ip to a non-zero value
for PEBS events, perf will _always_ generate an adaptive record, even if
the guest requested a basic record.  Note, KVM will also enable adaptive
PEBS in individual *counter*, even if adaptive PEBS isn't exposed to the
guest, but this is benign as MSR_PEBS_DATA_CFG is guaranteed to be zero,
i.e. the guest will only ever see Basic records.

Bug #3 is in perf.  intel_pmu_disable_fixed() doesn't clear the upper
bits either, i.e. leaves ICL_FIXED_0_ADAPTIVE set, and
intel_pmu_enable_fixed() effectively doesn't clear ICL_FIXED_0_ADAPTIVE
either.  I.e. perf _always_ enables ADAPTIVE counters, regardless of what
KVM requests.

Bug #4 is that adaptive PEBS *might* effectively bypass event filters set
by the host, as "Updated Memory Access Info Group" records information
that might be disallowed by userspace via KVM_SET_PMU_EVENT_FILTER.

Bug #5 is that KVM doesn't ensure LBR MSRs hold guest values (or at least
zeros) when entering a vCPU with adaptive PEBS, which allows the guest
to read host LBRs, i.e. host RIPs/addresses, by enabling "LBR Entries"
records.

Disable adaptive PEBS support as an immediate fix due to the severity of
the LBR leak in particular, and because fixing all of the bugs will be
non-trivial, e.g. not suitable for backporting to stable kernels.

Note!  This will break live migration, but trying to make KVM play nice
with live migration would be quite complicated, wouldn't be guaranteed to
work (i.e. KVM might still kill/confuse the guest), and it's not clear
that there are any publicly available VMMs that support adaptive PEBS,
let alone live migrate VMs that support adaptive PEBS, e.g. QEMU doesn't
support PEBS in any capacity.

Link: https://lore.kernel.org/all/[email protected]
Link: https://lore.kernel.org/all/[email protected]
Fixes: c59a1f1 ("KVM: x86/pmu: Add IA32_PEBS_ENABLE MSR emulation for extended PEBS")
Cc: [email protected]
Cc: Like Xu <[email protected]>
Cc: Mingwei Zhang <[email protected]>
Cc: Zhenyu Wang <[email protected]>
Cc: Zhang Xiong <[email protected]>
Cc: Lv Zhiyuan <[email protected]>
Cc: Dapeng Mi <[email protected]>
Cc: Jim Mattson <[email protected]>
Acked-by: Like Xu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
…"RESET"

Set the enable bits for general purpose counters in IA32_PERF_GLOBAL_CTRL
when refreshing the PMU to emulate the MSR's architecturally defined
post-RESET behavior.  Per Intel's SDM:

  IA32_PERF_GLOBAL_CTRL:  Sets bits n-1:0 and clears the upper bits.

and

  Where "n" is the number of general-purpose counters available in the processor.

AMD also documents this behavior for PerfMonV2 CPUs in one of AMD's many
PPRs.

Do not set any PERF_GLOBAL_CTRL bits if there are no general purpose
counters, although a literal reading of the SDM would require the CPU to
set either bits 63:0 or 31:0.  The intent of the behavior is to globally
enable all GP counters; honor the intent, if not the letter of the law.

Leaving PERF_GLOBAL_CTRL '0' effectively breaks PMU usage in guests that
haven't been updated to work with PMUs that support PERF_GLOBAL_CTRL.
This bug was recently exposed when KVM added supported for AMD's
PerfMonV2, i.e. when KVM started exposing a vPMU with PERF_GLOBAL_CTRL to
guest software that only knew how to program v1 PMUs (that don't support
PERF_GLOBAL_CTRL).

Failure to emulate the post-RESET behavior results in such guests
unknowingly leaving all general purpose counters globally disabled (the
entire reason the post-RESET value sets the GP counter enable bits is to
maintain backwards compatibility).

The bug has likely gone unnoticed because PERF_GLOBAL_CTRL has been
supported on Intel CPUs for as long as KVM has existed, i.e. hardly anyone
is running guest software that isn't aware of PERF_GLOBAL_CTRL on Intel
PMUs.  And because up until v6.0, KVM _did_ emulate the behavior for Intel
CPUs, although the old behavior was likely dumb luck.

Because (a) that old code was also broken in its own way (the history of
this code is a comedy of errors), and (b) PERF_GLOBAL_CTRL was documented
as having a value of '0' post-RESET in all SDMs before March 2023.

Initial vPMU support in commit f5132b0 ("KVM: Expose a version 2
architectural PMU to a guests") *almost* got it right (again likely by
dumb luck), but for some reason only set the bits if the guest PMU was
advertised as v1:

        if (pmu->version == 1) {
                pmu->global_ctrl = (1 << pmu->nr_arch_gp_counters) - 1;
                return;
        }

Commit f19a0c2 ("KVM: PMU emulation: GLOBAL_CTRL MSR should be
enabled on reset") then tried to remedy that goof, presumably because
guest PMUs were leaving PERF_GLOBAL_CTRL '0', i.e. weren't enabling
counters.

        pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) |
                (((1ull << pmu->nr_arch_fixed_counters) - 1) << X86_PMC_IDX_FIXED);
        pmu->global_ctrl_mask = ~pmu->global_ctrl;

That was KVM's behavior up until commit c49467a ("KVM: x86/pmu:
Don't overwrite the pmu->global_ctrl when refreshing") removed
*everything*.  However, it did so based on the behavior defined by the
SDM , which at the time stated that "Global Perf Counter Controls" is
'0' at Power-Up and RESET.

But then the March 2023 SDM (325462-079US), stealthily changed its
"IA-32 and Intel 64 Processor States Following Power-up, Reset, or INIT"
table to say:

  IA32_PERF_GLOBAL_CTRL: Sets bits n-1:0 and clears the upper bits.

Note, kvm_pmu_refresh() can be invoked multiple times, i.e. it's not a
"pure" RESET flow.  But it can only be called prior to the first KVM_RUN,
i.e. the guest will only ever observe the final value.

Note #2, KVM has always cleared global_ctrl during refresh (see commit
f5132b0 ("KVM: Expose a version 2 architectural PMU to a guests")),
i.e. there is no danger of breaking existing setups by clobbering a value
set by userspace.

Reported-by: Babu Moger <[email protected]>
Cc: Sandipan Das <[email protected]>
Cc: Like Xu <[email protected]>
Cc: Mingwei Zhang <[email protected]>
Cc: Dapeng Mi <[email protected]>
Cc: [email protected]
Reviewed-by: Dapeng Mi <[email protected]>
Tested-by: Dapeng Mi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
…git/netfilter/nf

netfilter pull request 24-04-11

Pablo Neira Ayuso says:

====================
Netfilter fixes for net

The following patchset contains Netfilter fixes for net:

Patches #1 and #2 add missing rcu read side lock when iterating over
expression and object type list which could race with module removal.

Patch #3 prevents promisc packet from visiting the bridge/input hook
	 to amend a recent fix to address conntrack confirmation race
	 in br_netfilter and nf_conntrack_bridge.

Patch #4 adds and uses iterate decorator type to fetch the current
	 pipapo set backend datastructure view when netlink dumps the
	 set elements.

Patch #5 fixes removal of duplicate elements in the pipapo set backend.

Patch #6 flowtable validates pppoe header before accessing it.

Patch #7 fixes flowtable datapath for pppoe packets, otherwise lookup
         fails and pppoe packets follow classic path.
====================

Signed-off-by: David S. Miller <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
When disabling aRFS under the `priv->state_lock`, any scheduled
aRFS works are canceled using the `cancel_work_sync` function,
which waits for the work to end if it has already started.
However, while waiting for the work handler, the handler will
try to acquire the `state_lock` which is already acquired.

The worker acquires the lock to delete the rules if the state
is down, which is not the worker's responsibility since
disabling aRFS deletes the rules.

Add an aRFS state variable, which indicates whether the aRFS is
enabled and prevent adding rules when the aRFS is disabled.

Kernel log:

======================================================
WARNING: possible circular locking dependency detected
6.7.0-rc4_net_next_mlx5_5483eb2 #1 Tainted: G          I
------------------------------------------------------
ethtool/386089 is trying to acquire lock:
ffff88810f21ce68 ((work_completion)(&rule->arfs_work)){+.+.}-{0:0}, at: __flush_work+0x74/0x4e0

but task is already holding lock:
ffff8884a1808cc0 (&priv->state_lock){+.+.}-{3:3}, at: mlx5e_ethtool_set_channels+0x53/0x200 [mlx5_core]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (&priv->state_lock){+.+.}-{3:3}:
       __mutex_lock+0x80/0xc90
       arfs_handle_work+0x4b/0x3b0 [mlx5_core]
       process_one_work+0x1dc/0x4a0
       worker_thread+0x1bf/0x3c0
       kthread+0xd7/0x100
       ret_from_fork+0x2d/0x50
       ret_from_fork_asm+0x11/0x20

-> #0 ((work_completion)(&rule->arfs_work)){+.+.}-{0:0}:
       __lock_acquire+0x17b4/0x2c80
       lock_acquire+0xd0/0x2b0
       __flush_work+0x7a/0x4e0
       __cancel_work_timer+0x131/0x1c0
       arfs_del_rules+0x143/0x1e0 [mlx5_core]
       mlx5e_arfs_disable+0x1b/0x30 [mlx5_core]
       mlx5e_ethtool_set_channels+0xcb/0x200 [mlx5_core]
       ethnl_set_channels+0x28f/0x3b0
       ethnl_default_set_doit+0xec/0x240
       genl_family_rcv_msg_doit+0xd0/0x120
       genl_rcv_msg+0x188/0x2c0
       netlink_rcv_skb+0x54/0x100
       genl_rcv+0x24/0x40
       netlink_unicast+0x1a1/0x270
       netlink_sendmsg+0x214/0x460
       __sock_sendmsg+0x38/0x60
       __sys_sendto+0x113/0x170
       __x64_sys_sendto+0x20/0x30
       do_syscall_64+0x40/0xe0
       entry_SYSCALL_64_after_hwframe+0x46/0x4e

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&priv->state_lock);
                               lock((work_completion)(&rule->arfs_work));
                               lock(&priv->state_lock);
  lock((work_completion)(&rule->arfs_work));

 *** DEADLOCK ***

3 locks held by ethtool/386089:
 #0: ffffffff82ea7210 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40
 #1: ffffffff82e94c88 (rtnl_mutex){+.+.}-{3:3}, at: ethnl_default_set_doit+0xd3/0x240
 #2: ffff8884a1808cc0 (&priv->state_lock){+.+.}-{3:3}, at: mlx5e_ethtool_set_channels+0x53/0x200 [mlx5_core]

stack backtrace:
CPU: 15 PID: 386089 Comm: ethtool Tainted: G          I        6.7.0-rc4_net_next_mlx5_5483eb2 #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x60/0xa0
 check_noncircular+0x144/0x160
 __lock_acquire+0x17b4/0x2c80
 lock_acquire+0xd0/0x2b0
 ? __flush_work+0x74/0x4e0
 ? save_trace+0x3e/0x360
 ? __flush_work+0x74/0x4e0
 __flush_work+0x7a/0x4e0
 ? __flush_work+0x74/0x4e0
 ? __lock_acquire+0xa78/0x2c80
 ? lock_acquire+0xd0/0x2b0
 ? mark_held_locks+0x49/0x70
 __cancel_work_timer+0x131/0x1c0
 ? mark_held_locks+0x49/0x70
 arfs_del_rules+0x143/0x1e0 [mlx5_core]
 mlx5e_arfs_disable+0x1b/0x30 [mlx5_core]
 mlx5e_ethtool_set_channels+0xcb/0x200 [mlx5_core]
 ethnl_set_channels+0x28f/0x3b0
 ethnl_default_set_doit+0xec/0x240
 genl_family_rcv_msg_doit+0xd0/0x120
 genl_rcv_msg+0x188/0x2c0
 ? ethnl_ops_begin+0xb0/0xb0
 ? genl_family_rcv_msg_dumpit+0xf0/0xf0
 netlink_rcv_skb+0x54/0x100
 genl_rcv+0x24/0x40
 netlink_unicast+0x1a1/0x270
 netlink_sendmsg+0x214/0x460
 __sock_sendmsg+0x38/0x60
 __sys_sendto+0x113/0x170
 ? do_user_addr_fault+0x53f/0x8f0
 __x64_sys_sendto+0x20/0x30
 do_syscall_64+0x40/0xe0
 entry_SYSCALL_64_after_hwframe+0x46/0x4e
 </TASK>

Fixes: 45bf454 ("net/mlx5e: Enabling aRFS mechanism")
Signed-off-by: Carolina Jubran <[email protected]>
Signed-off-by: Tariq Toukan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
When I did hard offline test with hugetlb pages, below deadlock occurs:

======================================================
WARNING: possible circular locking dependency detected
6.8.0-11409-gf6cef5f8c37f #1 Not tainted
------------------------------------------------------
bash/46904 is trying to acquire lock:
ffffffffabe68910 (cpu_hotplug_lock){++++}-{0:0}, at: static_key_slow_dec+0x16/0x60

but task is already holding lock:
ffffffffabf92ea8 (pcp_batch_high_lock){+.+.}-{3:3}, at: zone_pcp_disable+0x16/0x40

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (pcp_batch_high_lock){+.+.}-{3:3}:
       __mutex_lock+0x6c/0x770
       page_alloc_cpu_online+0x3c/0x70
       cpuhp_invoke_callback+0x397/0x5f0
       __cpuhp_invoke_callback_range+0x71/0xe0
       _cpu_up+0xeb/0x210
       cpu_up+0x91/0xe0
       cpuhp_bringup_mask+0x49/0xb0
       bringup_nonboot_cpus+0xb7/0xe0
       smp_init+0x25/0xa0
       kernel_init_freeable+0x15f/0x3e0
       kernel_init+0x15/0x1b0
       ret_from_fork+0x2f/0x50
       ret_from_fork_asm+0x1a/0x30

-> #0 (cpu_hotplug_lock){++++}-{0:0}:
       __lock_acquire+0x1298/0x1cd0
       lock_acquire+0xc0/0x2b0
       cpus_read_lock+0x2a/0xc0
       static_key_slow_dec+0x16/0x60
       __hugetlb_vmemmap_restore_folio+0x1b9/0x200
       dissolve_free_huge_page+0x211/0x260
       __page_handle_poison+0x45/0xc0
       memory_failure+0x65e/0xc70
       hard_offline_page_store+0x55/0xa0
       kernfs_fop_write_iter+0x12c/0x1d0
       vfs_write+0x387/0x550
       ksys_write+0x64/0xe0
       do_syscall_64+0xca/0x1e0
       entry_SYSCALL_64_after_hwframe+0x6d/0x75

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(pcp_batch_high_lock);
                               lock(cpu_hotplug_lock);
                               lock(pcp_batch_high_lock);
  rlock(cpu_hotplug_lock);

 *** DEADLOCK ***

5 locks held by bash/46904:
 #0: ffff98f6c3bb23f0 (sb_writers#5){.+.+}-{0:0}, at: ksys_write+0x64/0xe0
 #1: ffff98f6c328e488 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0xf8/0x1d0
 #2: ffff98ef83b31890 (kn->active#113){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x100/0x1d0
 #3: ffffffffabf9db48 (mf_mutex){+.+.}-{3:3}, at: memory_failure+0x44/0xc70
 #4: ffffffffabf92ea8 (pcp_batch_high_lock){+.+.}-{3:3}, at: zone_pcp_disable+0x16/0x40

stack backtrace:
CPU: 10 PID: 46904 Comm: bash Kdump: loaded Not tainted 6.8.0-11409-gf6cef5f8c37f #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x68/0xa0
 check_noncircular+0x129/0x140
 __lock_acquire+0x1298/0x1cd0
 lock_acquire+0xc0/0x2b0
 cpus_read_lock+0x2a/0xc0
 static_key_slow_dec+0x16/0x60
 __hugetlb_vmemmap_restore_folio+0x1b9/0x200
 dissolve_free_huge_page+0x211/0x260
 __page_handle_poison+0x45/0xc0
 memory_failure+0x65e/0xc70
 hard_offline_page_store+0x55/0xa0
 kernfs_fop_write_iter+0x12c/0x1d0
 vfs_write+0x387/0x550
 ksys_write+0x64/0xe0
 do_syscall_64+0xca/0x1e0
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7fc862314887
Code: 10 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
RSP: 002b:00007fff19311268 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fc862314887
RDX: 000000000000000c RSI: 000056405645fe10 RDI: 0000000000000001
RBP: 000056405645fe10 R08: 00007fc8623d1460 R09: 000000007fffffff
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000c
R13: 00007fc86241b780 R14: 00007fc862417600 R15: 00007fc862416a00

In short, below scene breaks the lock dependency chain:

 memory_failure
  __page_handle_poison
   zone_pcp_disable -- lock(pcp_batch_high_lock)
   dissolve_free_huge_page
    __hugetlb_vmemmap_restore_folio
     static_key_slow_dec
      cpus_read_lock -- rlock(cpu_hotplug_lock)

Fix this by calling drain_all_pages() instead.

This issue won't occur until commit a6b4085 ("mm: hugetlb: replace
hugetlb_free_vmemmap_enabled with a static_key").  As it introduced
rlock(cpu_hotplug_lock) in dissolve_free_huge_page() code path while
lock(pcp_batch_high_lock) is already in the __page_handle_poison().

[[email protected]: extend comment per Oscar]
[[email protected]: reflow block comment]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: a6b4085 ("mm: hugetlb: replace hugetlb_free_vmemmap_enabled with a static_key")
Signed-off-by: Miaohe Lin <[email protected]>
Acked-by: Oscar Salvador <[email protected]>
Reviewed-by: Jane Chu <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
vhost_worker will call tun call backs to receive packets. If too many
illegal packets arrives, tun_do_read will keep dumping packet contents.
When console is enabled, it will costs much more cpu time to dump
packet and soft lockup will be detected.

net_ratelimit mechanism can be used to limit the dumping rate.

PID: 33036    TASK: ffff949da6f20000  CPU: 23   COMMAND: "vhost-32980"
 #0 [fffffe00003fce50] crash_nmi_callback at ffffffff89249253
 #1 [fffffe00003fce58] nmi_handle at ffffffff89225fa3
 #2 [fffffe00003fceb0] default_do_nmi at ffffffff8922642e
 #3 [fffffe00003fced0] do_nmi at ffffffff8922660d
 #4 [fffffe00003fcef0] end_repeat_nmi at ffffffff89c01663
    [exception RIP: io_serial_in+20]
    RIP: ffffffff89792594  RSP: ffffa655314979e8  RFLAGS: 00000002
    RAX: ffffffff89792500  RBX: ffffffff8af428a0  RCX: 0000000000000000
    RDX: 00000000000003fd  RSI: 0000000000000005  RDI: ffffffff8af428a0
    RBP: 0000000000002710   R8: 0000000000000004   R9: 000000000000000f
    R10: 0000000000000000  R11: ffffffff8acbf64f  R12: 0000000000000020
    R13: ffffffff8acbf698  R14: 0000000000000058  R15: 0000000000000000
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #5 [ffffa655314979e8] io_serial_in at ffffffff89792594
 #6 [ffffa655314979e8] wait_for_xmitr at ffffffff89793470
 #7 [ffffa65531497a08] serial8250_console_putchar at ffffffff897934f6
 #8 [ffffa65531497a20] uart_console_write at ffffffff8978b605
 #9 [ffffa65531497a48] serial8250_console_write at ffffffff89796558
 #10 [ffffa65531497ac8] console_unlock at ffffffff89316124
 #11 [ffffa65531497b10] vprintk_emit at ffffffff89317c07
 #12 [ffffa65531497b68] printk at ffffffff89318306
 #13 [ffffa65531497bc8] print_hex_dump at ffffffff89650765
 #14 [ffffa65531497ca8] tun_do_read at ffffffffc0b06c27 [tun]
 #15 [ffffa65531497d38] tun_recvmsg at ffffffffc0b06e34 [tun]
 #16 [ffffa65531497d68] handle_rx at ffffffffc0c5d682 [vhost_net]
 #17 [ffffa65531497ed0] vhost_worker at ffffffffc0c644dc [vhost]
 #18 [ffffa65531497f10] kthread at ffffffff892d2e72
 #19 [ffffa65531497f50] ret_from_fork at ffffffff89c0022f

Fixes: ef3db4a ("tun: avoid BUG, dump packet on GSO errors")
Signed-off-by: Lei Chen <[email protected]>
Reviewed-by: Willem de Bruijn <[email protected]>
Acked-by: Jason Wang <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
…git/netfilter/nf

Pablo Neira Ayuso says:

====================
Netfilter fixes for net

The following patchset contains Netfilter fixes for net:

Patch #1 amends a missing spot where the set iterator type is unset.
	 This is fixing a issue in the previous pull request.

Patch #2 fixes the delete set command abort path by restoring state
         of the elements. Reverse logic for the activate (abort) case
	 otherwise element state is not restored, this requires to move
	 the check for active/inactive elements to the set iterator
	 callback. From the deactivate path, toggle the next generation
	 bit and from the activate (abort) path, clear the next generation
	 bitmask.

Patch #3 skips elements already restored by delete set command from the
	 abort path in case there is a previous delete element command in
	 the batch. Check for the next generation bit just like it is done
	 via set iteration to restore maps.

netfilter pull request 24-04-18

* tag 'nf-24-04-18' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
  netfilter: nf_tables: fix memleak in map from abort path
  netfilter: nf_tables: restore set elements when delete set fails
  netfilter: nf_tables: missing iterator type in lookup walk
====================

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
Petr Machata says:

====================
mlxsw: Fixes

This patchset fixes the following issues:

- During driver de-initialization the driver unregisters the EMAD
  response trap by setting its action to DISCARD. However the manual
  only permits TRAP and FORWARD, and future firmware versions will
  enforce this.

  In patch #1, suppress the error message by aligning the driver to the
  manual and use a FORWARD (NOP) action when unregistering the trap.

- The driver queries the Management Capabilities Mask (MCAM) register
  during initialization to understand if certain features are supported.

  However, not all firmware versions support this register, leading to
  the driver failing to load.

  Patches #2 and #3 fix this issue by treating an error in the register
  query as an indication that the feature is not supported.

v2:
- Patch #2:
    - Make mlxsw_env_max_module_eeprom_len_query() void
====================

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
… update

The rule activity update delayed work periodically traverses the list of
configured rules and queries their activity from the device.

As part of this task it accesses the entry pointed by 'ventry->entry',
but this entry can be changed concurrently by the rehash delayed work,
leading to a use-after-free [1].

Fix by closing the race and perform the activity query under the
'vregion->lock' mutex.

[1]
BUG: KASAN: slab-use-after-free in mlxsw_sp_acl_tcam_flower_rule_activity_get+0x121/0x140
Read of size 8 at addr ffff8881054ed808 by task kworker/0:18/181

CPU: 0 PID: 181 Comm: kworker/0:18 Not tainted 6.9.0-rc2-custom-00781-gd5ab772d32f7 #2
Hardware name: Mellanox Technologies Ltd. MSN3700/VMOD0005, BIOS 5.11 01/06/2019
Workqueue: mlxsw_core mlxsw_sp_acl_rule_activity_update_work
Call Trace:
 <TASK>
 dump_stack_lvl+0xc6/0x120
 print_report+0xce/0x670
 kasan_report+0xd7/0x110
 mlxsw_sp_acl_tcam_flower_rule_activity_get+0x121/0x140
 mlxsw_sp_acl_rule_activity_update_work+0x219/0x400
 process_one_work+0x8eb/0x19b0
 worker_thread+0x6c9/0xf70
 kthread+0x2c9/0x3b0
 ret_from_fork+0x4d/0x80
 ret_from_fork_asm+0x1a/0x30
 </TASK>

Allocated by task 1039:
 kasan_save_stack+0x33/0x60
 kasan_save_track+0x14/0x30
 __kasan_kmalloc+0x8f/0xa0
 __kmalloc+0x19c/0x360
 mlxsw_sp_acl_tcam_entry_create+0x7b/0x1f0
 mlxsw_sp_acl_tcam_vchunk_migrate_all+0x30d/0xb50
 mlxsw_sp_acl_tcam_vregion_rehash_work+0x157/0x1300
 process_one_work+0x8eb/0x19b0
 worker_thread+0x6c9/0xf70
 kthread+0x2c9/0x3b0
 ret_from_fork+0x4d/0x80
 ret_from_fork_asm+0x1a/0x30

Freed by task 1039:
 kasan_save_stack+0x33/0x60
 kasan_save_track+0x14/0x30
 kasan_save_free_info+0x3b/0x60
 poison_slab_object+0x102/0x170
 __kasan_slab_free+0x14/0x30
 kfree+0xc1/0x290
 mlxsw_sp_acl_tcam_vchunk_migrate_all+0x3d7/0xb50
 mlxsw_sp_acl_tcam_vregion_rehash_work+0x157/0x1300
 process_one_work+0x8eb/0x19b0
 worker_thread+0x6c9/0xf70
 kthread+0x2c9/0x3b0
 ret_from_fork+0x4d/0x80
 ret_from_fork_asm+0x1a/0x30

Fixes: 2bffc53 ("mlxsw: spectrum_acl: Don't take mutex in mlxsw_sp_acl_tcam_vregion_rehash_work()")
Signed-off-by: Ido Schimmel <[email protected]>
Tested-by: Alexander Zubkov <[email protected]>
Reviewed-by: Petr Machata <[email protected]>
Signed-off-by: Petr Machata <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://lore.kernel.org/r/1fcce0a60b231ebeb2515d91022284ba7b4ffe7a.1713797103.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
9f74a3d ("ice: Fix VF Reset paths when interface in a failed over
aggregate"), the ice driver has acquired the LAG mutex in ice_reset_vf().
The commit placed this lock acquisition just prior to the acquisition of
the VF configuration lock.

If ice_reset_vf() acquires the configuration lock via the ICE_VF_RESET_LOCK
flag, this could deadlock with ice_vc_cfg_qs_msg() because it always
acquires the locks in the order of the VF configuration lock and then the
LAG mutex.

Lockdep reports this violation almost immediately on creating and then
removing 2 VF:

======================================================
WARNING: possible circular locking dependency detected
6.8.0-rc6 #54 Tainted: G        W  O
------------------------------------------------------
kworker/60:3/6771 is trying to acquire lock:
ff40d43e099380a0 (&vf->cfg_lock){+.+.}-{3:3}, at: ice_reset_vf+0x22f/0x4d0 [ice]

but task is already holding lock:
ff40d43ea1961210 (&pf->lag_mutex){+.+.}-{3:3}, at: ice_reset_vf+0xb7/0x4d0 [ice]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (&pf->lag_mutex){+.+.}-{3:3}:
       __lock_acquire+0x4f8/0xb40
       lock_acquire+0xd4/0x2d0
       __mutex_lock+0x9b/0xbf0
       ice_vc_cfg_qs_msg+0x45/0x690 [ice]
       ice_vc_process_vf_msg+0x4f5/0x870 [ice]
       __ice_clean_ctrlq+0x2b5/0x600 [ice]
       ice_service_task+0x2c9/0x480 [ice]
       process_one_work+0x1e9/0x4d0
       worker_thread+0x1e1/0x3d0
       kthread+0x104/0x140
       ret_from_fork+0x31/0x50
       ret_from_fork_asm+0x1b/0x30

-> #0 (&vf->cfg_lock){+.+.}-{3:3}:
       check_prev_add+0xe2/0xc50
       validate_chain+0x558/0x800
       __lock_acquire+0x4f8/0xb40
       lock_acquire+0xd4/0x2d0
       __mutex_lock+0x9b/0xbf0
       ice_reset_vf+0x22f/0x4d0 [ice]
       ice_process_vflr_event+0x98/0xd0 [ice]
       ice_service_task+0x1cc/0x480 [ice]
       process_one_work+0x1e9/0x4d0
       worker_thread+0x1e1/0x3d0
       kthread+0x104/0x140
       ret_from_fork+0x31/0x50
       ret_from_fork_asm+0x1b/0x30

other info that might help us debug this:
 Possible unsafe locking scenario:
       CPU0                    CPU1
       ----                    ----
  lock(&pf->lag_mutex);
                               lock(&vf->cfg_lock);
                               lock(&pf->lag_mutex);
  lock(&vf->cfg_lock);

 *** DEADLOCK ***
4 locks held by kworker/60:3/6771:
 #0: ff40d43e05428b38 ((wq_completion)ice){+.+.}-{0:0}, at: process_one_work+0x176/0x4d0
 #1: ff50d06e05197e58 ((work_completion)(&pf->serv_task)){+.+.}-{0:0}, at: process_one_work+0x176/0x4d0
 #2: ff40d43ea1960e50 (&pf->vfs.table_lock){+.+.}-{3:3}, at: ice_process_vflr_event+0x48/0xd0 [ice]
 #3: ff40d43ea1961210 (&pf->lag_mutex){+.+.}-{3:3}, at: ice_reset_vf+0xb7/0x4d0 [ice]

stack backtrace:
CPU: 60 PID: 6771 Comm: kworker/60:3 Tainted: G        W  O       6.8.0-rc6 #54
Hardware name:
Workqueue: ice ice_service_task [ice]
Call Trace:
 <TASK>
 dump_stack_lvl+0x4a/0x80
 check_noncircular+0x12d/0x150
 check_prev_add+0xe2/0xc50
 ? save_trace+0x59/0x230
 ? add_chain_cache+0x109/0x450
 validate_chain+0x558/0x800
 __lock_acquire+0x4f8/0xb40
 ? lockdep_hardirqs_on+0x7d/0x100
 lock_acquire+0xd4/0x2d0
 ? ice_reset_vf+0x22f/0x4d0 [ice]
 ? lock_is_held_type+0xc7/0x120
 __mutex_lock+0x9b/0xbf0
 ? ice_reset_vf+0x22f/0x4d0 [ice]
 ? ice_reset_vf+0x22f/0x4d0 [ice]
 ? rcu_is_watching+0x11/0x50
 ? ice_reset_vf+0x22f/0x4d0 [ice]
 ice_reset_vf+0x22f/0x4d0 [ice]
 ? process_one_work+0x176/0x4d0
 ice_process_vflr_event+0x98/0xd0 [ice]
 ice_service_task+0x1cc/0x480 [ice]
 process_one_work+0x1e9/0x4d0
 worker_thread+0x1e1/0x3d0
 ? __pfx_worker_thread+0x10/0x10
 kthread+0x104/0x140
 ? __pfx_kthread+0x10/0x10
 ret_from_fork+0x31/0x50
 ? __pfx_kthread+0x10/0x10
 ret_from_fork_asm+0x1b/0x30
 </TASK>

To avoid deadlock, we must acquire the LAG mutex only after acquiring the
VF configuration lock. Fix the ice_reset_vf() to acquire the LAG mutex only
after we either acquire or check that the VF configuration lock is held.

Fixes: 9f74a3d ("ice: Fix VF Reset paths when interface in a failed over aggregate")
Signed-off-by: Jacob Keller <[email protected]>
Reviewed-by: Dave Ertman <[email protected]>
Reviewed-by: Mateusz Polchlopek <[email protected]>
Tested-by: Przemek Kitszel <[email protected]>
Tested-by: Rafal Romanowski <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
…nix_gc().

syzbot reported a lockdep splat regarding unix_gc_lock and
unix_state_lock().

One is called from recvmsg() for a connected socket, and another
is called from GC for TCP_LISTEN socket.

So, the splat is false-positive.

Let's add a dedicated lock class for the latter to suppress the splat.

Note that this change is not necessary for net-next.git as the issue
is only applied to the old GC impl.

[0]:
WARNING: possible circular locking dependency detected
6.9.0-rc5-syzkaller-00007-g4d2008430ce8 #0 Not tainted
 -----------------------------------------------------
kworker/u8:1/11 is trying to acquire lock:
ffff88807cea4e70 (&u->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffff88807cea4e70 (&u->lock){+.+.}-{2:2}, at: __unix_gc+0x40e/0xf70 net/unix/garbage.c:302

but task is already holding lock:
ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: __unix_gc+0x117/0xf70 net/unix/garbage.c:261

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

 -> #1 (unix_gc_lock){+.+.}-{2:2}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
       _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
       spin_lock include/linux/spinlock.h:351 [inline]
       unix_notinflight+0x13d/0x390 net/unix/garbage.c:140
       unix_detach_fds net/unix/af_unix.c:1819 [inline]
       unix_destruct_scm+0x221/0x350 net/unix/af_unix.c:1876
       skb_release_head_state+0x100/0x250 net/core/skbuff.c:1188
       skb_release_all net/core/skbuff.c:1200 [inline]
       __kfree_skb net/core/skbuff.c:1216 [inline]
       kfree_skb_reason+0x16d/0x3b0 net/core/skbuff.c:1252
       kfree_skb include/linux/skbuff.h:1262 [inline]
       manage_oob net/unix/af_unix.c:2672 [inline]
       unix_stream_read_generic+0x1125/0x2700 net/unix/af_unix.c:2749
       unix_stream_splice_read+0x239/0x320 net/unix/af_unix.c:2981
       do_splice_read fs/splice.c:985 [inline]
       splice_file_to_pipe+0x299/0x500 fs/splice.c:1295
       do_splice+0xf2d/0x1880 fs/splice.c:1379
       __do_splice fs/splice.c:1436 [inline]
       __do_sys_splice fs/splice.c:1652 [inline]
       __se_sys_splice+0x331/0x4a0 fs/splice.c:1634
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

 -> #0 (&u->lock){+.+.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
       _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
       spin_lock include/linux/spinlock.h:351 [inline]
       __unix_gc+0x40e/0xf70 net/unix/garbage.c:302
       process_one_work kernel/workqueue.c:3254 [inline]
       process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
       worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
       kthread+0x2f0/0x390 kernel/kthread.c:388
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(unix_gc_lock);
                               lock(&u->lock);
                               lock(unix_gc_lock);
  lock(&u->lock);

 *** DEADLOCK ***

3 locks held by kworker/u8:1/11:
 #0: ffff888015089148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3229 [inline]
 #0: ffff888015089148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0x8e0/0x17c0 kernel/workqueue.c:3335
 #1: ffffc90000107d00 (unix_gc_work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3230 [inline]
 #1: ffffc90000107d00 (unix_gc_work){+.+.}-{0:0}, at: process_scheduled_works+0x91b/0x17c0 kernel/workqueue.c:3335
 #2: ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
 #2: ffffffff8f6ab638 (unix_gc_lock){+.+.}-{2:2}, at: __unix_gc+0x117/0xf70 net/unix/garbage.c:261

stack backtrace:
CPU: 0 PID: 11 Comm: kworker/u8:1 Not tainted 6.9.0-rc5-syzkaller-00007-g4d2008430ce8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: events_unbound __unix_gc
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:351 [inline]
 __unix_gc+0x40e/0xf70 net/unix/garbage.c:302
 process_one_work kernel/workqueue.c:3254 [inline]
 process_scheduled_works+0xa10/0x17c0 kernel/workqueue.c:3335
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
 kthread+0x2f0/0x390 kernel/kthread.c:388
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Fixes: 47d8ac0 ("af_unix: Fix garbage collector racing against connect()")
Reported-and-tested-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=fa379358c28cc87cc307
Signed-off-by: Kuniyuki Iwashima <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Apr 26, 2024
…git/netfilter/nf

Pablo Neira Ayuso says:

====================
Netfilter/IPVS fixes for net

The following patchset contains two Netfilter/IPVS fixes for net:

Patch #1 fixes SCTP checksumming for IPVS with gso packets,
	 from Ismael Luceno.

Patch #2 honor dormant flag from netdev event path to fix a possible
	 double hook unregistration.

* tag 'nf-24-04-25' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
  netfilter: nf_tables: honor table dormant flag from netdev release event path
  ipvs: Fix checksumming on GSO of SCTP packets
====================

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
This reworks hci_cb_list to not use mutex hci_cb_list_lock to avoid bugs
like the bellow:

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5070, name: kworker/u9:2
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
4 locks held by kworker/u9:2/5070:
 #0: ffff888015be3948 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3229 [inline]
 #0: ffff888015be3948 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_scheduled_works+0x8e0/0x1770 kernel/workqueue.c:3335
 #1: ffffc90003b6fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3230 [inline]
 #1: ffffc90003b6fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_scheduled_works+0x91b/0x1770 kernel/workqueue.c:3335
 #2: ffff8880665d0078 (&hdev->lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0xcf/0xae0 net/bluetooth/hci_event.c:6914
 #3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:298 [inline]
 #3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:750 [inline]
 #3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: hci_le_create_big_complete_evt+0xdb/0xae0 net/bluetooth/hci_event.c:6915
CPU: 0 PID: 5070 Comm: kworker/u9:2 Not tainted 6.8.0-syzkaller-08073-g480e035fc4c7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: hci0 hci_rx_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 __might_resched+0x5d4/0x780 kernel/sched/core.c:10187
 __mutex_lock_common kernel/locking/mutex.c:585 [inline]
 __mutex_lock+0xc1/0xd70 kernel/locking/mutex.c:752
 hci_connect_cfm include/net/bluetooth/hci_core.h:2004 [inline]
 hci_le_create_big_complete_evt+0x3d9/0xae0 net/bluetooth/hci_event.c:6939
 hci_event_func net/bluetooth/hci_event.c:7514 [inline]
 hci_event_packet+0xa53/0x1540 net/bluetooth/hci_event.c:7569
 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4171
 process_one_work kernel/workqueue.c:3254 [inline]
 process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
 kthread+0x2f0/0x390 kernel/kthread.c:388
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
 </TASK>

Reported-by: [email protected]
Tested-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=2fb0835e0c9cefc34614
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
This fixes the circular locking dependency warning below, by
releasing the socket lock before enterning iso_listen_bis, to
avoid any potential deadlock with hdev lock.

[   75.307983] ======================================================
[   75.307984] WARNING: possible circular locking dependency detected
[   75.307985] 6.12.0-rc6+ #22 Not tainted
[   75.307987] ------------------------------------------------------
[   75.307987] kworker/u81:2/2623 is trying to acquire lock:
[   75.307988] ffff8fde1769da58 (sk_lock-AF_BLUETOOTH-BTPROTO_ISO)
               at: iso_connect_cfm+0x253/0x840 [bluetooth]
[   75.308021]
               but task is already holding lock:
[   75.308022] ffff8fdd61a10078 (&hdev->lock)
               at: hci_le_per_adv_report_evt+0x47/0x2f0 [bluetooth]
[   75.308053]
               which lock already depends on the new lock.

[   75.308054]
               the existing dependency chain (in reverse order) is:
[   75.308055]
               -> #1 (&hdev->lock){+.+.}-{3:3}:
[   75.308057]        __mutex_lock+0xad/0xc50
[   75.308061]        mutex_lock_nested+0x1b/0x30
[   75.308063]        iso_sock_listen+0x143/0x5c0 [bluetooth]
[   75.308085]        __sys_listen_socket+0x49/0x60
[   75.308088]        __x64_sys_listen+0x4c/0x90
[   75.308090]        x64_sys_call+0x2517/0x25f0
[   75.308092]        do_syscall_64+0x87/0x150
[   75.308095]        entry_SYSCALL_64_after_hwframe+0x76/0x7e
[   75.308098]
               -> #0 (sk_lock-AF_BLUETOOTH-BTPROTO_ISO){+.+.}-{0:0}:
[   75.308100]        __lock_acquire+0x155e/0x25f0
[   75.308103]        lock_acquire+0xc9/0x300
[   75.308105]        lock_sock_nested+0x32/0x90
[   75.308107]        iso_connect_cfm+0x253/0x840 [bluetooth]
[   75.308128]        hci_connect_cfm+0x6c/0x190 [bluetooth]
[   75.308155]        hci_le_per_adv_report_evt+0x27b/0x2f0 [bluetooth]
[   75.308180]        hci_le_meta_evt+0xe7/0x200 [bluetooth]
[   75.308206]        hci_event_packet+0x21f/0x5c0 [bluetooth]
[   75.308230]        hci_rx_work+0x3ae/0xb10 [bluetooth]
[   75.308254]        process_one_work+0x212/0x740
[   75.308256]        worker_thread+0x1bd/0x3a0
[   75.308258]        kthread+0xe4/0x120
[   75.308259]        ret_from_fork+0x44/0x70
[   75.308261]        ret_from_fork_asm+0x1a/0x30
[   75.308263]
               other info that might help us debug this:

[   75.308264]  Possible unsafe locking scenario:

[   75.308264]        CPU0                CPU1
[   75.308265]        ----                ----
[   75.308265]   lock(&hdev->lock);
[   75.308267]                            lock(sk_lock-
                                                AF_BLUETOOTH-BTPROTO_ISO);
[   75.308268]                            lock(&hdev->lock);
[   75.308269]   lock(sk_lock-AF_BLUETOOTH-BTPROTO_ISO);
[   75.308270]
                *** DEADLOCK ***

[   75.308271] 4 locks held by kworker/u81:2/2623:
[   75.308272]  #0: ffff8fdd66e52148 ((wq_completion)hci0#2){+.+.}-{0:0},
                at: process_one_work+0x443/0x740
[   75.308276]  #1: ffffafb488b7fe48 ((work_completion)(&hdev->rx_work)),
                at: process_one_work+0x1ce/0x740
[   75.308280]  #2: ffff8fdd61a10078 (&hdev->lock){+.+.}-{3:3}
                at: hci_le_per_adv_report_evt+0x47/0x2f0 [bluetooth]
[   75.308304]  #3: ffffffffb6ba4900 (rcu_read_lock){....}-{1:2},
                at: hci_connect_cfm+0x29/0x190 [bluetooth]

Fixes: 02171da ("Bluetooth: ISO: Add hcon for listening bis sk")
Signed-off-by: Iulia Tanasescu <[email protected]>
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
This fixes the circular locking dependency warning below, by reworking
iso_sock_recvmsg, to ensure that the socket lock is always released
before calling a function that locks hdev.

[  561.670344] ======================================================
[  561.670346] WARNING: possible circular locking dependency detected
[  561.670349] 6.12.0-rc6+ #26 Not tainted
[  561.670351] ------------------------------------------------------
[  561.670353] iso-tester/3289 is trying to acquire lock:
[  561.670355] ffff88811f600078 (&hdev->lock){+.+.}-{3:3},
               at: iso_conn_big_sync+0x73/0x260 [bluetooth]
[  561.670405]
               but task is already holding lock:
[  561.670407] ffff88815af58258 (sk_lock-AF_BLUETOOTH){+.+.}-{0:0},
               at: iso_sock_recvmsg+0xbf/0x500 [bluetooth]
[  561.670450]
               which lock already depends on the new lock.

[  561.670452]
               the existing dependency chain (in reverse order) is:
[  561.670453]
               -> #2 (sk_lock-AF_BLUETOOTH){+.+.}-{0:0}:
[  561.670458]        lock_acquire+0x7c/0xc0
[  561.670463]        lock_sock_nested+0x3b/0xf0
[  561.670467]        bt_accept_dequeue+0x1a5/0x4d0 [bluetooth]
[  561.670510]        iso_sock_accept+0x271/0x830 [bluetooth]
[  561.670547]        do_accept+0x3dd/0x610
[  561.670550]        __sys_accept4+0xd8/0x170
[  561.670553]        __x64_sys_accept+0x74/0xc0
[  561.670556]        x64_sys_call+0x17d6/0x25f0
[  561.670559]        do_syscall_64+0x87/0x150
[  561.670563]        entry_SYSCALL_64_after_hwframe+0x76/0x7e
[  561.670567]
               -> #1 (sk_lock-AF_BLUETOOTH-BTPROTO_ISO){+.+.}-{0:0}:
[  561.670571]        lock_acquire+0x7c/0xc0
[  561.670574]        lock_sock_nested+0x3b/0xf0
[  561.670577]        iso_sock_listen+0x2de/0xf30 [bluetooth]
[  561.670617]        __sys_listen_socket+0xef/0x130
[  561.670620]        __x64_sys_listen+0xe1/0x190
[  561.670623]        x64_sys_call+0x2517/0x25f0
[  561.670626]        do_syscall_64+0x87/0x150
[  561.670629]        entry_SYSCALL_64_after_hwframe+0x76/0x7e
[  561.670632]
               -> #0 (&hdev->lock){+.+.}-{3:3}:
[  561.670636]        __lock_acquire+0x32ad/0x6ab0
[  561.670639]        lock_acquire.part.0+0x118/0x360
[  561.670642]        lock_acquire+0x7c/0xc0
[  561.670644]        __mutex_lock+0x18d/0x12f0
[  561.670647]        mutex_lock_nested+0x1b/0x30
[  561.670651]        iso_conn_big_sync+0x73/0x260 [bluetooth]
[  561.670687]        iso_sock_recvmsg+0x3e9/0x500 [bluetooth]
[  561.670722]        sock_recvmsg+0x1d5/0x240
[  561.670725]        sock_read_iter+0x27d/0x470
[  561.670727]        vfs_read+0x9a0/0xd30
[  561.670731]        ksys_read+0x1a8/0x250
[  561.670733]        __x64_sys_read+0x72/0xc0
[  561.670736]        x64_sys_call+0x1b12/0x25f0
[  561.670738]        do_syscall_64+0x87/0x150
[  561.670741]        entry_SYSCALL_64_after_hwframe+0x76/0x7e
[  561.670744]
               other info that might help us debug this:

[  561.670745] Chain exists of:
&hdev->lock --> sk_lock-AF_BLUETOOTH-BTPROTO_ISO --> sk_lock-AF_BLUETOOTH

[  561.670751]  Possible unsafe locking scenario:

[  561.670753]        CPU0                    CPU1
[  561.670754]        ----                    ----
[  561.670756]   lock(sk_lock-AF_BLUETOOTH);
[  561.670758]                                lock(sk_lock
                                              AF_BLUETOOTH-BTPROTO_ISO);
[  561.670761]                                lock(sk_lock-AF_BLUETOOTH);
[  561.670764]   lock(&hdev->lock);
[  561.670767]
                *** DEADLOCK ***

Fixes: 07a9342 ("Bluetooth: ISO: Send BIG Create Sync via hci_sync")
Signed-off-by: Iulia Tanasescu <[email protected]>
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
Aishwarya reports that warnings are sometimes seen when running the
ftrace kselftests, e.g.

| WARNING: CPU: 5 PID: 2066 at arch/arm64/kernel/stacktrace.c:141 arch_stack_walk+0x4a0/0x4c0
| Modules linked in:
| CPU: 5 UID: 0 PID: 2066 Comm: ftracetest Not tainted 6.13.0-rc2 #2
| Hardware name: linux,dummy-virt (DT)
| pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
| pc : arch_stack_walk+0x4a0/0x4c0
| lr : arch_stack_walk+0x248/0x4c0
| sp : ffff800083643d20
| x29: ffff800083643dd0 x28: ffff00007b891400 x27: ffff00007b891928
| x26: 0000000000000001 x25: 00000000000000c0 x24: ffff800082f39d80
| x23: ffff80008003ee8c x22: ffff80008004baa8 x21: ffff8000800533e0
| x20: ffff800083643e10 x19: ffff80008003eec8 x18: 0000000000000000
| x17: 0000000000000000 x16: ffff800083640000 x15: 0000000000000000
| x14: 02a37a802bbb8a92 x13: 00000000000001a9 x12: 0000000000000001
| x11: ffff800082ffad60 x10: ffff800083643d20 x9 : ffff80008003eed0
| x8 : ffff80008004baa8 x7 : ffff800086f2be80 x6 : ffff0000057cf000
| x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff800086f2b690
| x2 : ffff80008004baa8 x1 : ffff80008004baa8 x0 : ffff80008004baa8
| Call trace:
|  arch_stack_walk+0x4a0/0x4c0 (P)
|  arch_stack_walk+0x248/0x4c0 (L)
|  profile_pc+0x44/0x80
|  profile_tick+0x50/0x80 (F)
|  tick_nohz_handler+0xcc/0x160 (F)
|  __hrtimer_run_queues+0x2ac/0x340 (F)
|  hrtimer_interrupt+0xf4/0x268 (F)
|  arch_timer_handler_virt+0x34/0x60 (F)
|  handle_percpu_devid_irq+0x88/0x220 (F)
|  generic_handle_domain_irq+0x34/0x60 (F)
|  gic_handle_irq+0x54/0x140 (F)
|  call_on_irq_stack+0x24/0x58 (F)
|  do_interrupt_handler+0x88/0x98
|  el1_interrupt+0x34/0x68 (F)
|  el1h_64_irq_handler+0x18/0x28
|  el1h_64_irq+0x6c/0x70
|  queued_spin_lock_slowpath+0x78/0x460 (P)

The warning in question is:

  WARN_ON_ONCE(state->common.pc == orig_pc))

... in kunwind_recover_return_address(), which is triggered when
return_to_handler() is encountered in the trace, but
ftrace_graph_ret_addr() cannot find a corresponding original return
address on the fgraph return stack.

This happens because the stacktrace code encounters an exception
boundary where the LR was not live at the time of the exception, but the
LR happens to contain return_to_handler(); either because the task
recently returned there, or due to unfortunate usage of the LR at a
scratch register. In such cases attempts to recover the return address
via ftrace_graph_ret_addr() may fail, triggering the WARN_ON_ONCE()
above and aborting the unwind (hence the stacktrace terminating after
reporting the PC at the time of the exception).

Handling unreliable LR values in these cases is likely to require some
larger rework, so for the moment avoid this problem by restoring the old
behaviour of skipping the LR at exception boundaries, which the
stacktrace code did prior to commit:

  c2c6b27 ("arm64: stacktrace: unwind exception boundaries")

This commit is effectively a partial revert, keeping the structures and
logic to explicitly identify exception boundaries while still skipping
reporting of the LR. The logic to explicitly identify exception
boundaries is still useful for general robustness and as a building
block for future support for RELIABLE_STACKTRACE.

Fixes: c2c6b27 ("arm64: stacktrace: unwind exception boundaries")
Signed-off-by: Mark Rutland <[email protected]>
Reported-by: Aishwarya TCV <[email protected]>
Cc: Will Deacon <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Catalin Marinas <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
The arm64 stacktrace code has a few error conditions where a
WARN_ON_ONCE() is triggered before the stacktrace is terminated and an
error is returned to the caller. The conditions shouldn't be triggered
when unwinding the current task, but it is possible to trigger these
when unwinding another task which is not blocked, as the stack of that
task is concurrently modified. Kent reports that these warnings can be
triggered while running filesystem tests on bcachefs, which calls the
stacktrace code directly.

To produce a meaningful stacktrace of another task, the task in question
should be blocked, but the stacktrace code is expected to be robust to
cases where it is not blocked. Note that this is purely about not
unuduly scaring the user and/or crashing the kernel; stacktraces in such
cases are meaningless and may leak kernel secrets from the stack of the
task being unwound.

Ideally we'd pin the task in a blocked state during the unwind, as we do
for /proc/${PID}/wchan since commit:

  42a20f8 ("sched: Add wrapper for get_wchan() to keep task blocked")

... but a bunch of places don't do that, notably /proc/${PID}/stack,
where we don't pin the task in a blocked state, but do restrict the
output to privileged users since commit:

  f8a00ce ("proc: restrict kernel stack dumps to root")

... and so it's possible to trigger these warnings accidentally, e.g. by
reading /proc/*/stack (as root):

| for n in $(seq 1 10); do
|     while true; do cat /proc/*/stack > /dev/null 2>&1; done &
| done
| ------------[ cut here ]------------
| WARNING: CPU: 3 PID: 166 at arch/arm64/kernel/stacktrace.c:207 arch_stack_walk+0x1c8/0x370
| Modules linked in:
| CPU: 3 UID: 0 PID: 166 Comm: cat Not tainted 6.13.0-rc2-00003-g3dafa7a7925d #2
| Hardware name: linux,dummy-virt (DT)
| pstate: 81400005 (Nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
| pc : arch_stack_walk+0x1c8/0x370
| lr : arch_stack_walk+0x1b0/0x370
| sp : ffff800080773890
| x29: ffff800080773930 x28: fff0000005c44500 x27: fff00000058fa038
| x26: 000000007ffff000 x25: 0000000000000000 x24: 0000000000000000
| x23: ffffa35a8d9600ec x22: 0000000000000000 x21: fff00000043a33c0
| x20: ffff800080773970 x19: ffffa35a8d960168 x18: 0000000000000000
| x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
| x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
| x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
| x8 : ffff8000807738e0 x7 : ffff8000806e3800 x6 : ffff8000806e3818
| x5 : ffff800080773920 x4 : ffff8000806e4000 x3 : ffff8000807738e0
| x2 : 0000000000000018 x1 : ffff8000806e3800 x0 : 0000000000000000
| Call trace:
|  arch_stack_walk+0x1c8/0x370 (P)
|  stack_trace_save_tsk+0x8c/0x108
|  proc_pid_stack+0xb0/0x134
|  proc_single_show+0x60/0x120
|  seq_read_iter+0x104/0x438
|  seq_read+0xf8/0x140
|  vfs_read+0xc4/0x31c
|  ksys_read+0x70/0x108
|  __arm64_sys_read+0x1c/0x28
|  invoke_syscall+0x48/0x104
|  el0_svc_common.constprop.0+0x40/0xe0
|  do_el0_svc+0x1c/0x28
|  el0_svc+0x30/0xcc
|  el0t_64_sync_handler+0x10c/0x138
|  el0t_64_sync+0x198/0x19c
| ---[ end trace 0000000000000000 ]---

Fix this by only warning when unwinding the current task. When unwinding
another task the error conditions will be handled by returning an error
without producing a warning.

The two warnings in kunwind_next_frame_record_meta() were added recently
as part of commit:

  c2c6b27 ("arm64: stacktrace: unwind exception boundaries")

The warning when recovering the fgraph return address has changed form
many times, but was originally introduced back in commit:

  9f41631 ("arm64: fix unwind_frame() for filtered out fn for function graph tracing")

Fixes: c2c6b27 ("arm64: stacktrace: unwind exception boundaries")
Fixes: 9f41631 ("arm64: fix unwind_frame() for filtered out fn for function graph tracing")
Signed-off-by: Mark Rutland <[email protected]>
Reported-by: Kent Overstreet <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Will Deacon <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Catalin Marinas <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
The current implementation removes cache tags after disabling ATS,
leading to potential memory leaks and kernel crashes. Specifically,
CACHE_TAG_DEVTLB type cache tags may still remain in the list even
after the domain is freed, causing a use-after-free condition.

This issue really shows up when multiple VFs from different PFs
passed through to a single user-space process via vfio-pci. In such
cases, the kernel may crash with kernel messages like:

 BUG: kernel NULL pointer dereference, address: 0000000000000014
 PGD 19036a067 P4D 1940a3067 PUD 136c9b067 PMD 0
 Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI
 CPU: 74 UID: 0 PID: 3183 Comm: testCli Not tainted 6.11.9 #2
 RIP: 0010:cache_tag_flush_range+0x9b/0x250
 Call Trace:
  <TASK>
  ? __die+0x1f/0x60
  ? page_fault_oops+0x163/0x590
  ? exc_page_fault+0x72/0x190
  ? asm_exc_page_fault+0x22/0x30
  ? cache_tag_flush_range+0x9b/0x250
  ? cache_tag_flush_range+0x5d/0x250
  intel_iommu_tlb_sync+0x29/0x40
  intel_iommu_unmap_pages+0xfe/0x160
  __iommu_unmap+0xd8/0x1a0
  vfio_unmap_unpin+0x182/0x340 [vfio_iommu_type1]
  vfio_remove_dma+0x2a/0xb0 [vfio_iommu_type1]
  vfio_iommu_type1_ioctl+0xafa/0x18e0 [vfio_iommu_type1]

Move cache_tag_unassign_domain() before iommu_disable_pci_caps() to fix
it.

Fixes: 3b1d9e2 ("iommu/vt-d: Add cache tag assignment interface")
Cc: [email protected]
Signed-off-by: Lu Baolu <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
…s_lock

For storing a value to a queue attribute, the queue_attr_store function
first freezes the queue (->q_usage_counter(io)) and then acquire
->sysfs_lock. This seems not correct as the usual ordering should be to
acquire ->sysfs_lock before freezing the queue. This incorrect ordering
causes the following lockdep splat which we are able to reproduce always
simply by accessing /sys/kernel/debug file using ls command:

[   57.597146] WARNING: possible circular locking dependency detected
[   57.597154] 6.12.0-10553-gb86545e02e8c #20 Tainted: G        W
[   57.597162] ------------------------------------------------------
[   57.597168] ls/4605 is trying to acquire lock:
[   57.597176] c00000003eb56710 (&mm->mmap_lock){++++}-{4:4}, at: __might_fault+0x58/0xc0
[   57.597200]
               but task is already holding lock:
[   57.597207] c0000018e27c6810 (&sb->s_type->i_mutex_key#3){++++}-{4:4}, at: iterate_dir+0x94/0x1d4
[   57.597226]
               which lock already depends on the new lock.

[   57.597233]
               the existing dependency chain (in reverse order) is:
[   57.597241]
               -> #5 (&sb->s_type->i_mutex_key#3){++++}-{4:4}:
[   57.597255]        down_write+0x6c/0x18c
[   57.597264]        start_creating+0xb4/0x24c
[   57.597274]        debugfs_create_dir+0x2c/0x1e8
[   57.597283]        blk_register_queue+0xec/0x294
[   57.597292]        add_disk_fwnode+0x2e4/0x548
[   57.597302]        brd_alloc+0x2c8/0x338
[   57.597309]        brd_init+0x100/0x178
[   57.597317]        do_one_initcall+0x88/0x3e4
[   57.597326]        kernel_init_freeable+0x3cc/0x6e0
[   57.597334]        kernel_init+0x34/0x1cc
[   57.597342]        ret_from_kernel_user_thread+0x14/0x1c
[   57.597350]
               -> #4 (&q->debugfs_mutex){+.+.}-{4:4}:
[   57.597362]        __mutex_lock+0xfc/0x12a0
[   57.597370]        blk_register_queue+0xd4/0x294
[   57.597379]        add_disk_fwnode+0x2e4/0x548
[   57.597388]        brd_alloc+0x2c8/0x338
[   57.597395]        brd_init+0x100/0x178
[   57.597402]        do_one_initcall+0x88/0x3e4
[   57.597410]        kernel_init_freeable+0x3cc/0x6e0
[   57.597418]        kernel_init+0x34/0x1cc
[   57.597426]        ret_from_kernel_user_thread+0x14/0x1c
[   57.597434]
               -> #3 (&q->sysfs_lock){+.+.}-{4:4}:
[   57.597446]        __mutex_lock+0xfc/0x12a0
[   57.597454]        queue_attr_store+0x9c/0x110
[   57.597462]        sysfs_kf_write+0x70/0xb0
[   57.597471]        kernfs_fop_write_iter+0x1b0/0x2ac
[   57.597480]        vfs_write+0x3dc/0x6e8
[   57.597488]        ksys_write+0x84/0x140
[   57.597495]        system_call_exception+0x130/0x360
[   57.597504]        system_call_common+0x160/0x2c4
[   57.597516]
               -> #2 (&q->q_usage_counter(io)#21){++++}-{0:0}:
[   57.597530]        __submit_bio+0x5ec/0x828
[   57.597538]        submit_bio_noacct_nocheck+0x1e4/0x4f0
[   57.597547]        iomap_readahead+0x2a0/0x448
[   57.597556]        xfs_vm_readahead+0x28/0x3c
[   57.597564]        read_pages+0x88/0x41c
[   57.597571]        page_cache_ra_unbounded+0x1ac/0x2d8
[   57.597580]        filemap_get_pages+0x188/0x984
[   57.597588]        filemap_read+0x13c/0x4bc
[   57.597596]        xfs_file_buffered_read+0x88/0x17c
[   57.597605]        xfs_file_read_iter+0xac/0x158
[   57.597614]        vfs_read+0x2d4/0x3b4
[   57.597622]        ksys_read+0x84/0x144
[   57.597629]        system_call_exception+0x130/0x360
[   57.597637]        system_call_common+0x160/0x2c4
[   57.597647]
               -> #1 (mapping.invalidate_lock#2){++++}-{4:4}:
[   57.597661]        down_read+0x6c/0x220
[   57.597669]        filemap_fault+0x870/0x100c
[   57.597677]        xfs_filemap_fault+0xc4/0x18c
[   57.597684]        __do_fault+0x64/0x164
[   57.597693]        __handle_mm_fault+0x1274/0x1dac
[   57.597702]        handle_mm_fault+0x248/0x484
[   57.597711]        ___do_page_fault+0x428/0xc0c
[   57.597719]        hash__do_page_fault+0x30/0x68
[   57.597727]        do_hash_fault+0x90/0x35c
[   57.597736]        data_access_common_virt+0x210/0x220
[   57.597745]        _copy_from_user+0xf8/0x19c
[   57.597754]        sel_write_load+0x178/0xd54
[   57.597762]        vfs_write+0x108/0x6e8
[   57.597769]        ksys_write+0x84/0x140
[   57.597777]        system_call_exception+0x130/0x360
[   57.597785]        system_call_common+0x160/0x2c4
[   57.597794]
               -> #0 (&mm->mmap_lock){++++}-{4:4}:
[   57.597806]        __lock_acquire+0x17cc/0x2330
[   57.597814]        lock_acquire+0x138/0x400
[   57.597822]        __might_fault+0x7c/0xc0
[   57.597830]        filldir64+0xe8/0x390
[   57.597839]        dcache_readdir+0x80/0x2d4
[   57.597846]        iterate_dir+0xd8/0x1d4
[   57.597855]        sys_getdents64+0x88/0x2d4
[   57.597864]        system_call_exception+0x130/0x360
[   57.597872]        system_call_common+0x160/0x2c4
[   57.597881]
               other info that might help us debug this:

[   57.597888] Chain exists of:
                 &mm->mmap_lock --> &q->debugfs_mutex --> &sb->s_type->i_mutex_key#3

[   57.597905]  Possible unsafe locking scenario:

[   57.597911]        CPU0                    CPU1
[   57.597917]        ----                    ----
[   57.597922]   rlock(&sb->s_type->i_mutex_key#3);
[   57.597932]                                lock(&q->debugfs_mutex);
[   57.597940]                                lock(&sb->s_type->i_mutex_key#3);
[   57.597950]   rlock(&mm->mmap_lock);
[   57.597958]
                *** DEADLOCK ***

[   57.597965] 2 locks held by ls/4605:
[   57.597971]  #0: c0000000137c12f8 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0xcc/0x154
[   57.597989]  #1: c0000018e27c6810 (&sb->s_type->i_mutex_key#3){++++}-{4:4}, at: iterate_dir+0x94/0x1d4

Prevent the above lockdep warning by acquiring ->sysfs_lock before
freezing the queue while storing a queue attribute in queue_attr_store
function. Later, we also found[1] another function __blk_mq_update_nr_
hw_queues where we first freeze queue and then acquire the ->sysfs_lock.
So we've also updated lock ordering in __blk_mq_update_nr_hw_queues
function and ensured that in all code paths we follow the correct lock
ordering i.e. acquire ->sysfs_lock before freezing the queue.

[1] https://lore.kernel.org/all/CAFj5m9Ke8+EHKQBs_Nk6hqd=LGXtk4mUxZUN5==ZcCjnZSBwHw@mail.gmail.com/

Reported-by: [email protected]
Fixes: af28141 ("block: freeze the queue in queue_attr_store")
Tested-by: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Nilay Shroff <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
Guangguan Wang says:

====================
net: several fixes for smc

v1 -> v2:
rewrite patch #2 suggested by Paolo.
====================

Signed-off-by: David S. Miller <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
The mapping VMA address is saved in VAS window struct when the
paste address is mapped. This VMA address is used during migration
to unmap the paste address if the window is active. The paste
address mapping will be removed when the window is closed or with
the munmap(). But the VMA address in the VAS window is not updated
with munmap() which is causing invalid access during migration.

The KASAN report shows:
[16386.254991] BUG: KASAN: slab-use-after-free in reconfig_close_windows+0x1a0/0x4e8
[16386.255043] Read of size 8 at addr c00000014a819670 by task drmgr/696928

[16386.255096] CPU: 29 UID: 0 PID: 696928 Comm: drmgr Kdump: loaded Tainted: G    B              6.11.0-rc5-nxgzip #2
[16386.255128] Tainted: [B]=BAD_PAGE
[16386.255148] Hardware name: IBM,9080-HEX Power11 (architected) 0x820200 0xf000007 of:IBM,FW1110.00 (NH1110_016) hv:phyp pSeries
[16386.255181] Call Trace:
[16386.255202] [c00000016b297660] [c0000000018ad0ac] dump_stack_lvl+0x84/0xe8 (unreliable)
[16386.255246] [c00000016b297690] [c0000000006e8a90] print_report+0x19c/0x764
[16386.255285] [c00000016b297760] [c0000000006e9490] kasan_report+0x128/0x1f8
[16386.255309] [c00000016b297880] [c0000000006eb5c8] __asan_load8+0xac/0xe0
[16386.255326] [c00000016b2978a0] [c00000000013f898] reconfig_close_windows+0x1a0/0x4e8
[16386.255343] [c00000016b297990] [c000000000140e58] vas_migration_handler+0x3a4/0x3fc
[16386.255368] [c00000016b297a90] [c000000000128848] pseries_migrate_partition+0x4c/0x4c4
...

[16386.256136] Allocated by task 696554 on cpu 31 at 16377.277618s:
[16386.256149]  kasan_save_stack+0x34/0x68
[16386.256163]  kasan_save_track+0x34/0x80
[16386.256175]  kasan_save_alloc_info+0x58/0x74
[16386.256196]  __kasan_slab_alloc+0xb8/0xdc
[16386.256209]  kmem_cache_alloc_noprof+0x200/0x3d0
[16386.256225]  vm_area_alloc+0x44/0x150
[16386.256245]  mmap_region+0x214/0x10c4
[16386.256265]  do_mmap+0x5fc/0x750
[16386.256277]  vm_mmap_pgoff+0x14c/0x24c
[16386.256292]  ksys_mmap_pgoff+0x20c/0x348
[16386.256303]  sys_mmap+0xd0/0x160
...

[16386.256350] Freed by task 0 on cpu 31 at 16386.204848s:
[16386.256363]  kasan_save_stack+0x34/0x68
[16386.256374]  kasan_save_track+0x34/0x80
[16386.256384]  kasan_save_free_info+0x64/0x10c
[16386.256396]  __kasan_slab_free+0x120/0x204
[16386.256415]  kmem_cache_free+0x128/0x450
[16386.256428]  vm_area_free_rcu_cb+0xa8/0xd8
[16386.256441]  rcu_do_batch+0x2c8/0xcf0
[16386.256458]  rcu_core+0x378/0x3c4
[16386.256473]  handle_softirqs+0x20c/0x60c
[16386.256495]  do_softirq_own_stack+0x6c/0x88
[16386.256509]  do_softirq_own_stack+0x58/0x88
[16386.256521]  __irq_exit_rcu+0x1a4/0x20c
[16386.256533]  irq_exit+0x20/0x38
[16386.256544]  interrupt_async_exit_prepare.constprop.0+0x18/0x2c
...

[16386.256717] Last potentially related work creation:
[16386.256729]  kasan_save_stack+0x34/0x68
[16386.256741]  __kasan_record_aux_stack+0xcc/0x12c
[16386.256753]  __call_rcu_common.constprop.0+0x94/0xd04
[16386.256766]  vm_area_free+0x28/0x3c
[16386.256778]  remove_vma+0xf4/0x114
[16386.256797]  do_vmi_align_munmap.constprop.0+0x684/0x870
[16386.256811]  __vm_munmap+0xe0/0x1f8
[16386.256821]  sys_munmap+0x54/0x6c
[16386.256830]  system_call_exception+0x1a0/0x4a0
[16386.256841]  system_call_vectored_common+0x15c/0x2ec

[16386.256868] The buggy address belongs to the object at c00000014a819670
                which belongs to the cache vm_area_struct of size 168
[16386.256887] The buggy address is located 0 bytes inside of
                freed 168-byte region [c00000014a819670, c00000014a819718)

[16386.256915] The buggy address belongs to the physical page:
[16386.256928] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14a81
[16386.256950] memcg:c0000000ba430001
[16386.256961] anon flags: 0x43ffff800000000(node=4|zone=0|lastcpupid=0x7ffff)
[16386.256975] page_type: 0xfdffffff(slab)
[16386.256990] raw: 043ffff800000000 c00000000501c080 0000000000000000 5deadbee00000001
[16386.257003] raw: 0000000000000000 00000000011a011a 00000001fdffffff c0000000ba430001
[16386.257018] page dumped because: kasan: bad access detected

This patch adds close() callback in vas_vm_ops vm_operations_struct
which will be executed during munmap() before freeing VMA. The VMA
address in the VAS window is set to NULL after holding the window
mmap_mutex.

Fixes: 37e6764 ("powerpc/pseries/vas: Add VAS migration handler")
Signed-off-by: Haren Myneni <[email protected]>
Signed-off-by: Madhavan Srinivasan <[email protected]>
Link: https://patch.msgid.link/[email protected]
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
Access to genmask field in struct nft_set_ext results in unaligned
atomic read:

[   72.130109] Unable to handle kernel paging request at virtual address ffff0000c2bb708c
[   72.131036] Mem abort info:
[   72.131213]   ESR = 0x0000000096000021
[   72.131446]   EC = 0x25: DABT (current EL), IL = 32 bits
[   72.132209]   SET = 0, FnV = 0
[   72.133216]   EA = 0, S1PTW = 0
[   72.134080]   FSC = 0x21: alignment fault
[   72.135593] Data abort info:
[   72.137194]   ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000
[   72.142351]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[   72.145989]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[   72.150115] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000237d27000
[   72.154893] [ffff0000c2bb708c] pgd=0000000000000000, p4d=180000023ffff403, pud=180000023f84b403, pmd=180000023f835403,
+pte=0068000102bb7707
[   72.163021] Internal error: Oops: 0000000096000021 [#1] SMP
[...]
[   72.170041] CPU: 7 UID: 0 PID: 54 Comm: kworker/7:0 Tainted: G            E      6.13.0-rc3+ #2
[   72.170509] Tainted: [E]=UNSIGNED_MODULE
[   72.170720] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-stable202302-for-qemu 03/01/2023
[   72.171192] Workqueue: events_power_efficient nft_rhash_gc [nf_tables]
[   72.171552] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
[   72.171915] pc : nft_rhash_gc+0x200/0x2d8 [nf_tables]
[   72.172166] lr : nft_rhash_gc+0x128/0x2d8 [nf_tables]
[   72.172546] sp : ffff800081f2bce0
[   72.172724] x29: ffff800081f2bd40 x28: ffff0000c2bb708c x27: 0000000000000038
[   72.173078] x26: ffff0000c6780ef0 x25: ffff0000c643df00 x24: ffff0000c6778f78
[   72.173431] x23: 000000000000001a x22: ffff0000c4b1f000 x21: ffff0000c6780f78
[   72.173782] x20: ffff0000c2bb70dc x19: ffff0000c2bb7080 x18: 0000000000000000
[   72.174135] x17: ffff0000c0a4e1c0 x16: 0000000000003000 x15: 0000ac26d173b978
[   72.174485] x14: ffffffffffffffff x13: 0000000000000030 x12: ffff0000c6780ef0
[   72.174841] x11: 0000000000000000 x10: ffff800081f2bcf8 x9 : ffff0000c3000000
[   72.175193] x8 : 00000000000004be x7 : 0000000000000000 x6 : 0000000000000000
[   72.175544] x5 : 0000000000000040 x4 : ffff0000c3000010 x3 : 0000000000000000
[   72.175871] x2 : 0000000000003a98 x1 : ffff0000c2bb708c x0 : 0000000000000004
[   72.176207] Call trace:
[   72.176316]  nft_rhash_gc+0x200/0x2d8 [nf_tables] (P)
[   72.176653]  process_one_work+0x178/0x3d0
[   72.176831]  worker_thread+0x200/0x3f0
[   72.176995]  kthread+0xe8/0xf8
[   72.177130]  ret_from_fork+0x10/0x20
[   72.177289] Code: 54fff984 d503201f d2800080 91003261 (f820303f)
[   72.177557] ---[ end trace 0000000000000000 ]---

Align struct nft_set_ext to word size to address this and
documentation it.

pahole reports that this increases the size of elements for rhash and
pipapo in 8 bytes on x86_64.

Fixes: 7ffc748 ("netfilter: nft_set_hash: skip duplicated elements pending gc run")
Signed-off-by: Pablo Neira Ayuso <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
syzbot reports that a recent fix causes nesting issues between the (now)
raw timeoutlock and the eventfd locking:

=============================
[ BUG: Invalid wait context ]
6.13.0-rc4-00080-g9828a4c0901f #29 Not tainted
-----------------------------
kworker/u32:0/68094 is trying to lock:
ffff000014d7a520 (&ctx->wqh#2){..-.}-{3:3}, at: eventfd_signal_mask+0x64/0x180
other info that might help us debug this:
context-{5:5}
6 locks held by kworker/u32:0/68094:
 #0: ffff0000c1d98148 ((wq_completion)iou_exit){+.+.}-{0:0}, at: process_one_work+0x4e8/0xfc0
 #1: ffff80008d927c78 ((work_completion)(&ctx->exit_work)){+.+.}-{0:0}, at: process_one_work+0x53c/0xfc0
 #2: ffff0000c59bc3d8 (&ctx->completion_lock){+.+.}-{3:3}, at: io_kill_timeouts+0x40/0x180
 #3: ffff0000c59bc358 (&ctx->timeout_lock){-.-.}-{2:2}, at: io_kill_timeouts+0x48/0x180
 #4: ffff800085127aa0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire+0x8/0x38
 #5: ffff800085127aa0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire+0x8/0x38
stack backtrace:
CPU: 7 UID: 0 PID: 68094 Comm: kworker/u32:0 Not tainted 6.13.0-rc4-00080-g9828a4c0901f #29
Hardware name: linux,dummy-virt (DT)
Workqueue: iou_exit io_ring_exit_work
Call trace:
 show_stack+0x1c/0x30 (C)
 __dump_stack+0x24/0x30
 dump_stack_lvl+0x60/0x80
 dump_stack+0x14/0x20
 __lock_acquire+0x19f8/0x60c8
 lock_acquire+0x1a4/0x540
 _raw_spin_lock_irqsave+0x90/0xd0
 eventfd_signal_mask+0x64/0x180
 io_eventfd_signal+0x64/0x108
 io_req_local_work_add+0x294/0x430
 __io_req_task_work_add+0x1c0/0x270
 io_kill_timeout+0x1f0/0x288
 io_kill_timeouts+0xd4/0x180
 io_uring_try_cancel_requests+0x2e8/0x388
 io_ring_exit_work+0x150/0x550
 process_one_work+0x5e8/0xfc0
 worker_thread+0x7ec/0xc80
 kthread+0x24c/0x300
 ret_from_fork+0x10/0x20

because after the preempt-rt fix for the timeout lock nesting inside
the io-wq lock, we now have the eventfd spinlock nesting inside the
raw timeout spinlock.

Rather than play whack-a-mole with other nesting on the timeout lock,
split the deletion and killing of timeouts so queueing the task_work
for the timeout cancelations can get done outside of the timeout lock.

Reported-by: [email protected]
Fixes: 020b40f ("io_uring: make ctx->timeout_lock a raw spinlock")
Signed-off-by: Jens Axboe <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
…le_direct_reclaim()

The task sometimes continues looping in throttle_direct_reclaim() because
allow_direct_reclaim(pgdat) keeps returning false.  

 #0 [ffff80002cb6f8d0] __switch_to at ffff8000080095ac
 #1 [ffff80002cb6f900] __schedule at ffff800008abbd1c
 #2 [ffff80002cb6f990] schedule at ffff800008abc50c
 #3 [ffff80002cb6f9b0] throttle_direct_reclaim at ffff800008273550
 #4 [ffff80002cb6fa20] try_to_free_pages at ffff800008277b68
 #5 [ffff80002cb6fae0] __alloc_pages_nodemask at ffff8000082c4660
 #6 [ffff80002cb6fc50] alloc_pages_vma at ffff8000082e4a98
 #7 [ffff80002cb6fca0] do_anonymous_page at ffff80000829f5a8
 #8 [ffff80002cb6fce0] __handle_mm_fault at ffff8000082a5974
 #9 [ffff80002cb6fd90] handle_mm_fault at ffff8000082a5bd4

At this point, the pgdat contains the following two zones:

        NODE: 4  ZONE: 0  ADDR: ffff00817fffe540  NAME: "DMA32"
          SIZE: 20480  MIN/LOW/HIGH: 11/28/45
          VM_STAT:
                NR_FREE_PAGES: 359
        NR_ZONE_INACTIVE_ANON: 18813
          NR_ZONE_ACTIVE_ANON: 0
        NR_ZONE_INACTIVE_FILE: 50
          NR_ZONE_ACTIVE_FILE: 0
          NR_ZONE_UNEVICTABLE: 0
        NR_ZONE_WRITE_PENDING: 0
                     NR_MLOCK: 0
                    NR_BOUNCE: 0
                   NR_ZSPAGES: 0
            NR_FREE_CMA_PAGES: 0

        NODE: 4  ZONE: 1  ADDR: ffff00817fffec00  NAME: "Normal"
          SIZE: 8454144  PRESENT: 98304  MIN/LOW/HIGH: 68/166/264
          VM_STAT:
                NR_FREE_PAGES: 146
        NR_ZONE_INACTIVE_ANON: 94668
          NR_ZONE_ACTIVE_ANON: 3
        NR_ZONE_INACTIVE_FILE: 735
          NR_ZONE_ACTIVE_FILE: 78
          NR_ZONE_UNEVICTABLE: 0
        NR_ZONE_WRITE_PENDING: 0
                     NR_MLOCK: 0
                    NR_BOUNCE: 0
                   NR_ZSPAGES: 0
            NR_FREE_CMA_PAGES: 0

In allow_direct_reclaim(), while processing ZONE_DMA32, the sum of
inactive/active file-backed pages calculated in zone_reclaimable_pages()
based on the result of zone_page_state_snapshot() is zero.  

Additionally, since this system lacks swap, the calculation of inactive/
active anonymous pages is skipped.

        crash> p nr_swap_pages
        nr_swap_pages = $1937 = {
          counter = 0
        }

As a result, ZONE_DMA32 is deemed unreclaimable and skipped, moving on to
the processing of the next zone, ZONE_NORMAL, despite ZONE_DMA32 having
free pages significantly exceeding the high watermark.

The problem is that the pgdat->kswapd_failures hasn't been incremented.

        crash> px ((struct pglist_data *) 0xffff00817fffe540)->kswapd_failures
        $1935 = 0x0

This is because the node deemed balanced.  The node balancing logic in
balance_pgdat() evaluates all zones collectively.  If one or more zones
(e.g., ZONE_DMA32) have enough free pages to meet their watermarks, the
entire node is deemed balanced.  This causes balance_pgdat() to exit early
before incrementing the kswapd_failures, as it considers the overall
memory state acceptable, even though some zones (like ZONE_NORMAL) remain
under significant pressure.


The patch ensures that zone_reclaimable_pages() includes free pages
(NR_FREE_PAGES) in its calculation when no other reclaimable pages are
available (e.g., file-backed or anonymous pages).  This change prevents
zones like ZONE_DMA32, which have sufficient free pages, from being
mistakenly deemed unreclaimable.  By doing so, the patch ensures proper
node balancing, avoids masking pressure on other zones like ZONE_NORMAL,
and prevents infinite loops in throttle_direct_reclaim() caused by
allow_direct_reclaim(pgdat) repeatedly returning false.


The kernel hangs due to a task stuck in throttle_direct_reclaim(), caused
by a node being incorrectly deemed balanced despite pressure in certain
zones, such as ZONE_NORMAL.  This issue arises from
zone_reclaimable_pages() returning 0 for zones without reclaimable file-
backed or anonymous pages, causing zones like ZONE_DMA32 with sufficient
free pages to be skipped.

The lack of swap or reclaimable pages results in ZONE_DMA32 being ignored
during reclaim, masking pressure in other zones.  Consequently,
pgdat->kswapd_failures remains 0 in balance_pgdat(), preventing fallback
mechanisms in allow_direct_reclaim() from being triggered, leading to an
infinite loop in throttle_direct_reclaim().

This patch modifies zone_reclaimable_pages() to account for free pages
(NR_FREE_PAGES) when no other reclaimable pages exist.  This ensures zones
with sufficient free pages are not skipped, enabling proper balancing and
reclaim behavior.

[[email protected]: coding-style cleanups]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 5a1c84b ("mm: remove reclaim and compaction retry approximations")
Signed-off-by: Seiji Nishikawa <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 14, 2025
We found a timeout problem with the pldm command on our system.  The
reason is that the MCTP-I3C driver has a race condition when receiving
multiple-packet messages in multi-thread, resulting in a wrong packet
order problem.

We identified this problem by adding a debug message to the
mctp_i3c_read function.

According to the MCTP spec, a multiple-packet message must be composed
in sequence, and if there is a wrong sequence, the whole message will be
discarded and wait for the next SOM.
For example, SOM → Pkt Seq #2 → Pkt Seq #1 → Pkt Seq #3 → EOM.

Therefore, we try to solve this problem by adding a mutex to the
mctp_i3c_read function.  Before the modification, when a command
requesting a multiple-packet message response is sent consecutively, an
error usually occurs within 100 loops.  After the mutex, it can go
through 40000 loops without any error, and it seems to run well.

Fixes: c8755b2 ("mctp i3c: MCTP I3C driver")
Signed-off-by: Leo Yang <[email protected]>
Link: https://patch.msgid.link/[email protected]
[[email protected]: dropped already answered question from changelog]
Signed-off-by: Paolo Abeni <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 21, 2025
irq_chip functions may be called in raw spinlock context. Therefore, we
must also use a raw spinlock for our own internal locking.

This fixes the following lockdep splat:

[    5.349336] =============================
[    5.353349] [ BUG: Invalid wait context ]
[    5.357361] 6.13.0-rc5+ #69 Tainted: G        W
[    5.363031] -----------------------------
[    5.367045] kworker/u17:1/44 is trying to lock:
[    5.371587] ffffff88018b02c0 (&chip->gpio_lock){....}-{3:3}, at: xgpio_irq_unmask (drivers/gpio/gpio-xilinx.c:433 (discriminator 8))
[    5.380079] other info that might help us debug this:
[    5.385138] context-{5:5}
[    5.387762] 5 locks held by kworker/u17:1/44:
[    5.392123] #0: ffffff8800014958 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work (kernel/workqueue.c:3204)
[    5.402260] #1: ffffffc082fcbdd8 (deferred_probe_work){+.+.}-{0:0}, at: process_one_work (kernel/workqueue.c:3205)
[    5.411528] #2: ffffff880172c900 (&dev->mutex){....}-{4:4}, at: __device_attach (drivers/base/dd.c:1006)
[    5.419929] #3: ffffff88039c8268 (request_class#2){+.+.}-{4:4}, at: __setup_irq (kernel/irq/internals.h:156 kernel/irq/manage.c:1596)
[    5.428331] #4: ffffff88039c80c8 (lock_class#2){....}-{2:2}, at: __setup_irq (kernel/irq/manage.c:1614)
[    5.436472] stack backtrace:
[    5.439359] CPU: 2 UID: 0 PID: 44 Comm: kworker/u17:1 Tainted: G        W          6.13.0-rc5+ #69
[    5.448690] Tainted: [W]=WARN
[    5.451656] Hardware name: xlnx,zynqmp (DT)
[    5.455845] Workqueue: events_unbound deferred_probe_work_func
[    5.461699] Call trace:
[    5.464147] show_stack+0x18/0x24 C
[    5.467821] dump_stack_lvl (lib/dump_stack.c:123)
[    5.471501] dump_stack (lib/dump_stack.c:130)
[    5.474824] __lock_acquire (kernel/locking/lockdep.c:4828 kernel/locking/lockdep.c:4898 kernel/locking/lockdep.c:5176)
[    5.478758] lock_acquire (arch/arm64/include/asm/percpu.h:40 kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5851 kernel/locking/lockdep.c:5814)
[    5.482429] _raw_spin_lock_irqsave (include/linux/spinlock_api_smp.h:111 kernel/locking/spinlock.c:162)
[    5.486797] xgpio_irq_unmask (drivers/gpio/gpio-xilinx.c:433 (discriminator 8))
[    5.490737] irq_enable (kernel/irq/internals.h:236 kernel/irq/chip.c:170 kernel/irq/chip.c:439 kernel/irq/chip.c:432 kernel/irq/chip.c:345)
[    5.494060] __irq_startup (kernel/irq/internals.h:241 kernel/irq/chip.c:180 kernel/irq/chip.c:250)
[    5.497645] irq_startup (kernel/irq/chip.c:270)
[    5.501143] __setup_irq (kernel/irq/manage.c:1807)
[    5.504728] request_threaded_irq (kernel/irq/manage.c:2208)

Fixes: a32c7ca ("gpio: gpio-xilinx: Add interrupt support")
Signed-off-by: Sean Anderson <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 21, 2025
This commit addresses a circular locking dependency issue within the GFX
isolation mechanism. The problem was identified by a warning indicating
a potential deadlock due to inconsistent lock acquisition order.

- The `amdgpu_gfx_enforce_isolation_ring_begin_use` and
  `amdgpu_gfx_enforce_isolation_ring_end_use` functions previously
  acquired `enforce_isolation_mutex` and called `amdgpu_gfx_kfd_sch_ctrl`,
  leading to potential deadlocks. ie., If `amdgpu_gfx_kfd_sch_ctrl` is
  called while `enforce_isolation_mutex` is held, and
  `amdgpu_gfx_enforce_isolation_handler` is called while `kfd_sch_mutex` is
  held, it can create a circular dependency.

By ensuring consistent lock usage, this fix resolves the issue:

[  606.297333] ======================================================
[  606.297343] WARNING: possible circular locking dependency detected
[  606.297353] 6.10.0-amd-mlkd-610-311224-lof #19 Tainted: G           OE
[  606.297365] ------------------------------------------------------
[  606.297375] kworker/u96:3/3825 is trying to acquire lock:
[  606.297385] ffff9aa64e431cb8 ((work_completion)(&(&adev->gfx.enforce_isolation[i].work)->work)){+.+.}-{0:0}, at: __flush_work+0x232/0x610
[  606.297413]
               but task is already holding lock:
[  606.297423] ffff9aa64e432338 (&adev->gfx.kfd_sch_mutex){+.+.}-{3:3}, at: amdgpu_gfx_kfd_sch_ctrl+0x51/0x4d0 [amdgpu]
[  606.297725]
               which lock already depends on the new lock.

[  606.297738]
               the existing dependency chain (in reverse order) is:
[  606.297749]
               -> #2 (&adev->gfx.kfd_sch_mutex){+.+.}-{3:3}:
[  606.297765]        __mutex_lock+0x85/0x930
[  606.297776]        mutex_lock_nested+0x1b/0x30
[  606.297786]        amdgpu_gfx_kfd_sch_ctrl+0x51/0x4d0 [amdgpu]
[  606.298007]        amdgpu_gfx_enforce_isolation_ring_begin_use+0x2a4/0x5d0 [amdgpu]
[  606.298225]        amdgpu_ring_alloc+0x48/0x70 [amdgpu]
[  606.298412]        amdgpu_ib_schedule+0x176/0x8a0 [amdgpu]
[  606.298603]        amdgpu_job_run+0xac/0x1e0 [amdgpu]
[  606.298866]        drm_sched_run_job_work+0x24f/0x430 [gpu_sched]
[  606.298880]        process_one_work+0x21e/0x680
[  606.298890]        worker_thread+0x190/0x350
[  606.298899]        kthread+0xe7/0x120
[  606.298908]        ret_from_fork+0x3c/0x60
[  606.298919]        ret_from_fork_asm+0x1a/0x30
[  606.298929]
               -> #1 (&adev->enforce_isolation_mutex){+.+.}-{3:3}:
[  606.298947]        __mutex_lock+0x85/0x930
[  606.298956]        mutex_lock_nested+0x1b/0x30
[  606.298966]        amdgpu_gfx_enforce_isolation_handler+0x87/0x370 [amdgpu]
[  606.299190]        process_one_work+0x21e/0x680
[  606.299199]        worker_thread+0x190/0x350
[  606.299208]        kthread+0xe7/0x120
[  606.299217]        ret_from_fork+0x3c/0x60
[  606.299227]        ret_from_fork_asm+0x1a/0x30
[  606.299236]
               -> #0 ((work_completion)(&(&adev->gfx.enforce_isolation[i].work)->work)){+.+.}-{0:0}:
[  606.299257]        __lock_acquire+0x16f9/0x2810
[  606.299267]        lock_acquire+0xd1/0x300
[  606.299276]        __flush_work+0x250/0x610
[  606.299286]        cancel_delayed_work_sync+0x71/0x80
[  606.299296]        amdgpu_gfx_kfd_sch_ctrl+0x287/0x4d0 [amdgpu]
[  606.299509]        amdgpu_gfx_enforce_isolation_ring_begin_use+0x2a4/0x5d0 [amdgpu]
[  606.299723]        amdgpu_ring_alloc+0x48/0x70 [amdgpu]
[  606.299909]        amdgpu_ib_schedule+0x176/0x8a0 [amdgpu]
[  606.300101]        amdgpu_job_run+0xac/0x1e0 [amdgpu]
[  606.300355]        drm_sched_run_job_work+0x24f/0x430 [gpu_sched]
[  606.300369]        process_one_work+0x21e/0x680
[  606.300378]        worker_thread+0x190/0x350
[  606.300387]        kthread+0xe7/0x120
[  606.300396]        ret_from_fork+0x3c/0x60
[  606.300406]        ret_from_fork_asm+0x1a/0x30
[  606.300416]
               other info that might help us debug this:

[  606.300428] Chain exists of:
                 (work_completion)(&(&adev->gfx.enforce_isolation[i].work)->work) --> &adev->enforce_isolation_mutex --> &adev->gfx.kfd_sch_mutex

[  606.300458]  Possible unsafe locking scenario:

[  606.300468]        CPU0                    CPU1
[  606.300476]        ----                    ----
[  606.300484]   lock(&adev->gfx.kfd_sch_mutex);
[  606.300494]                                lock(&adev->enforce_isolation_mutex);
[  606.300508]                                lock(&adev->gfx.kfd_sch_mutex);
[  606.300521]   lock((work_completion)(&(&adev->gfx.enforce_isolation[i].work)->work));
[  606.300536]
                *** DEADLOCK ***

[  606.300546] 5 locks held by kworker/u96:3/3825:
[  606.300555]  #0: ffff9aa5aa1f5d58 ((wq_completion)comp_1.1.0){+.+.}-{0:0}, at: process_one_work+0x3f5/0x680
[  606.300577]  #1: ffffaa53c3c97e40 ((work_completion)(&sched->work_run_job)){+.+.}-{0:0}, at: process_one_work+0x1d6/0x680
[  606.300600]  #2: ffff9aa64e463c98 (&adev->enforce_isolation_mutex){+.+.}-{3:3}, at: amdgpu_gfx_enforce_isolation_ring_begin_use+0x1c3/0x5d0 [amdgpu]
[  606.300837]  #3: ffff9aa64e432338 (&adev->gfx.kfd_sch_mutex){+.+.}-{3:3}, at: amdgpu_gfx_kfd_sch_ctrl+0x51/0x4d0 [amdgpu]
[  606.301062]  #4: ffffffff8c1a5660 (rcu_read_lock){....}-{1:2}, at: __flush_work+0x70/0x610
[  606.301083]
               stack backtrace:
[  606.301092] CPU: 14 PID: 3825 Comm: kworker/u96:3 Tainted: G           OE      6.10.0-amd-mlkd-610-311224-lof #19
[  606.301109] Hardware name: Gigabyte Technology Co., Ltd. X570S GAMING X/X570S GAMING X, BIOS F7 03/22/2024
[  606.301124] Workqueue: comp_1.1.0 drm_sched_run_job_work [gpu_sched]
[  606.301140] Call Trace:
[  606.301146]  <TASK>
[  606.301154]  dump_stack_lvl+0x9b/0xf0
[  606.301166]  dump_stack+0x10/0x20
[  606.301175]  print_circular_bug+0x26c/0x340
[  606.301187]  check_noncircular+0x157/0x170
[  606.301197]  ? register_lock_class+0x48/0x490
[  606.301213]  __lock_acquire+0x16f9/0x2810
[  606.301230]  lock_acquire+0xd1/0x300
[  606.301239]  ? __flush_work+0x232/0x610
[  606.301250]  ? srso_alias_return_thunk+0x5/0xfbef5
[  606.301261]  ? mark_held_locks+0x54/0x90
[  606.301274]  ? __flush_work+0x232/0x610
[  606.301284]  __flush_work+0x250/0x610
[  606.301293]  ? __flush_work+0x232/0x610
[  606.301305]  ? __pfx_wq_barrier_func+0x10/0x10
[  606.301318]  ? mark_held_locks+0x54/0x90
[  606.301331]  ? srso_alias_return_thunk+0x5/0xfbef5
[  606.301345]  cancel_delayed_work_sync+0x71/0x80
[  606.301356]  amdgpu_gfx_kfd_sch_ctrl+0x287/0x4d0 [amdgpu]
[  606.301661]  amdgpu_gfx_enforce_isolation_ring_begin_use+0x2a4/0x5d0 [amdgpu]
[  606.302050]  ? srso_alias_return_thunk+0x5/0xfbef5
[  606.302069]  amdgpu_ring_alloc+0x48/0x70 [amdgpu]
[  606.302452]  amdgpu_ib_schedule+0x176/0x8a0 [amdgpu]
[  606.302862]  ? drm_sched_entity_error+0x82/0x190 [gpu_sched]
[  606.302890]  amdgpu_job_run+0xac/0x1e0 [amdgpu]
[  606.303366]  drm_sched_run_job_work+0x24f/0x430 [gpu_sched]
[  606.303388]  process_one_work+0x21e/0x680
[  606.303409]  worker_thread+0x190/0x350
[  606.303424]  ? __pfx_worker_thread+0x10/0x10
[  606.303437]  kthread+0xe7/0x120
[  606.303449]  ? __pfx_kthread+0x10/0x10
[  606.303463]  ret_from_fork+0x3c/0x60
[  606.303476]  ? __pfx_kthread+0x10/0x10
[  606.303489]  ret_from_fork_asm+0x1a/0x30
[  606.303512]  </TASK>

v2: Refactor lock handling to resolve circular dependency (Alex)

- Introduced a `sched_work` flag to defer the call to
  `amdgpu_gfx_kfd_sch_ctrl` until after releasing
  `enforce_isolation_mutex`.
- This change ensures that `amdgpu_gfx_kfd_sch_ctrl` is called outside
  the critical section, preventing the circular dependency and deadlock.
- The `sched_work` flag is set within the mutex-protected section if
  conditions are met, and the actual function call is made afterward.
- This approach ensures consistent lock acquisition order.

Fixes: afefd6f ("drm/amdgpu: Implement Enforce Isolation Handler for KGD/KFD serialization")
Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Suggested-by: Alex Deucher <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
(cherry picked from commit 0b6b2dd38336d5fd49214f0e4e6495e658e3ab44)
Cc: [email protected]
ammarfaizi2 pushed a commit that referenced this pull request Jan 21, 2025
syz reports an out of bounds read:

==================================================================
BUG: KASAN: slab-out-of-bounds in ocfs2_match fs/ocfs2/dir.c:334
[inline]
BUG: KASAN: slab-out-of-bounds in ocfs2_search_dirblock+0x283/0x6e0
fs/ocfs2/dir.c:367
Read of size 1 at addr ffff88804d8b9982 by task syz-executor.2/14802

CPU: 0 UID: 0 PID: 14802 Comm: syz-executor.2 Not tainted 6.13.0-rc4 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1
04/01/2014
Sched_ext: serialise (enabled+all), task: runnable_at=-10ms
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x229/0x350 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x164/0x530 mm/kasan/report.c:489
kasan_report+0x147/0x180 mm/kasan/report.c:602
ocfs2_match fs/ocfs2/dir.c:334 [inline]
ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367
ocfs2_find_entry_id fs/ocfs2/dir.c:414 [inline]
ocfs2_find_entry+0x1143/0x2db0 fs/ocfs2/dir.c:1078
ocfs2_find_files_on_disk+0x18e/0x530 fs/ocfs2/dir.c:1981
ocfs2_lookup_ino_from_name+0xb6/0x110 fs/ocfs2/dir.c:2003
ocfs2_lookup+0x30a/0xd40 fs/ocfs2/namei.c:122
lookup_open fs/namei.c:3627 [inline]
open_last_lookups fs/namei.c:3748 [inline]
path_openat+0x145a/0x3870 fs/namei.c:3984
do_filp_open+0xe9/0x1c0 fs/namei.c:4014
do_sys_openat2+0x135/0x1d0 fs/open.c:1402
do_sys_open fs/open.c:1417 [inline]
__do_sys_openat fs/open.c:1433 [inline]
__se_sys_openat fs/open.c:1428 [inline]
__x64_sys_openat+0x15d/0x1c0 fs/open.c:1428
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf6/0x210 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f01076903ad
Code: c3 e8 a7 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 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:00007f01084acfc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f01077cbf80 RCX: 00007f01076903ad
RDX: 0000000000105042 RSI: 0000000020000080 RDI: ffffffffffffff9c
RBP: 00007f01077cbf80 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000
R13: 00007f01077cbf80 R14: 00007f010764fc90 R15: 00007f010848d000
</TASK>
==================================================================

And a general protection fault in ocfs2_prepare_dir_for_insert:

==================================================================
loop0: detected capacity change from 0 to 32768
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data
mode.
Oops: general protection fault, probably for non-canonical address
0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
CPU: 0 UID: 0 PID: 5096 Comm: syz-executor792 Not tainted
6.11.0-rc4-syzkaller-00002-gb0da640826ba #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:ocfs2_find_dir_space_id fs/ocfs2/dir.c:3406 [inline]
RIP: 0010:ocfs2_prepare_dir_for_insert+0x3309/0x5c70 fs/ocfs2/dir.c:4280
Code: 00 00 e8 2a 25 13 fe e9 ba 06 00 00 e8 20 25 13 fe e9 4f 01 00 00
e8 16 25 13 fe 49 8d 7f 08 49 8d 5f 09 48 89 f8 48 c1 e8 03 <42> 0f b6
04 20 84 c0 0f 85 bd 23 00 00 48 89 d8 48 c1 e8 03 42 0f
RSP: 0018:ffffc9000af9f020 EFLAGS: 00010202
RAX: 0000000000000001 RBX: 0000000000000009 RCX: ffff88801e27a440
RDX: 0000000000000000 RSI: 0000000000000400 RDI: 0000000000000008
RBP: ffffc9000af9f830 R08: ffffffff8380395b R09: ffffffff838090a7
R10: 0000000000000002 R11: ffff88801e27a440 R12: dffffc0000000000
R13: ffff88803c660878 R14: f700000000000088 R15: 0000000000000000
FS:  000055555a677380(0000) GS:ffff888020800000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000560bce569178 CR3: 000000001de5a000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
ocfs2_mknod+0xcaf/0x2b40 fs/ocfs2/namei.c:292
vfs_mknod+0x36d/0x3b0 fs/namei.c:4088
do_mknodat+0x3ec/0x5b0
__do_sys_mknodat fs/namei.c:4166 [inline]
__se_sys_mknodat fs/namei.c:4163 [inline]
__x64_sys_mknodat+0xa7/0xc0 fs/namei.c:4163
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2dafda3a99
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 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 b8 ff ff ff f7 d8
64 89 01 48
RSP: 002b:00007ffe336a6658 EFLAGS: 00000246 ORIG_RAX:
0000000000000103
RAX: ffffffffffffffda RBX: 0000000000000000 RCX:
00007f2dafda3a99
RDX: 00000000000021c0 RSI: 0000000020000040 RDI:
00000000ffffff9c
RBP: 00007f2dafe1b5f0 R08: 0000000000004480 R09:
000055555a6784c0
R10: 0000000000000103 R11: 0000000000000246 R12:
00007ffe336a6680
R13: 00007ffe336a68a8 R14: 431bde82d7b634db R15:
00007f2dafdec03b
</TASK>
==================================================================

The two reports are all caused invalid negative i_size of dir inode.  For
ocfs2, dir_inode can't be negative or zero.

Here add a check in which is called by ocfs2_check_dir_for_entry().  It
fixes the second report as ocfs2_check_dir_for_entry() must be called
before ocfs2_prepare_dir_for_insert().  Also set a up limit for dir with
OCFS2_INLINE_DATA_FL.  The i_size can't be great than blocksize.

Link: https://lkml.kernel.org/r/[email protected]
Reported-by: Jiacheng Xu <[email protected]>
Link: https://lore.kernel.org/ocfs2-devel/[email protected]/T/#u
Reported-by: [email protected]
Link: https://lore.kernel.org/all/[email protected]/T/
Signed-off-by: Su Yue <[email protected]>
Reviewed-by: Heming Zhao <[email protected]>
Reviewed-by: Joseph Qi <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Junxiao Bi <[email protected]>
Cc: Changwei Ge <[email protected]>
Cc: Jun Piao <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 21, 2025
Fix a lockdep warning [1] observed during the write combining test.

The warning indicates a potential nested lock scenario that could lead
to a deadlock.

However, this is a false positive alarm because the SF lock and its
parent lock are distinct ones.

The lockdep confusion arises because the locks belong to the same object
class (i.e., struct mlx5_core_dev).

To resolve this, the code has been refactored to avoid taking both
locks. Instead, only the parent lock is acquired.

[1]
raw_ethernet_bw/2118 is trying to acquire lock:
[  213.619032] ffff88811dd75e08 (&dev->wc_state_lock){+.+.}-{3:3}, at:
               mlx5_wc_support_get+0x18c/0x210 [mlx5_core]
[  213.620270]
[  213.620270] but task is already holding lock:
[  213.620943] ffff88810b585e08 (&dev->wc_state_lock){+.+.}-{3:3}, at:
               mlx5_wc_support_get+0x10c/0x210 [mlx5_core]
[  213.622045]
[  213.622045] other info that might help us debug this:
[  213.622778]  Possible unsafe locking scenario:
[  213.622778]
[  213.623465]        CPU0
[  213.623815]        ----
[  213.624148]   lock(&dev->wc_state_lock);
[  213.624615]   lock(&dev->wc_state_lock);
[  213.625071]
[  213.625071]  *** DEADLOCK ***
[  213.625071]
[  213.625805]  May be due to missing lock nesting notation
[  213.625805]
[  213.626522] 4 locks held by raw_ethernet_bw/2118:
[  213.627019]  #0: ffff88813f80d578 (&uverbs_dev->disassociate_srcu){.+.+}-{0:0},
                at: ib_uverbs_ioctl+0xc4/0x170 [ib_uverbs]
[  213.628088]  #1: ffff88810fb23930 (&file->hw_destroy_rwsem){.+.+}-{3:3},
                at: ib_init_ucontext+0x2d/0xf0 [ib_uverbs]
[  213.629094]  #2: ffff88810fb23878 (&file->ucontext_lock){+.+.}-{3:3},
                at: ib_init_ucontext+0x49/0xf0 [ib_uverbs]
[  213.630106]  #3: ffff88810b585e08 (&dev->wc_state_lock){+.+.}-{3:3},
                at: mlx5_wc_support_get+0x10c/0x210 [mlx5_core]
[  213.631185]
[  213.631185] stack backtrace:
[  213.631718] CPU: 1 UID: 0 PID: 2118 Comm: raw_ethernet_bw Not tainted
               6.12.0-rc7_internal_net_next_mlx5_89a0ad0 #1
[  213.632722] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
               rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
[  213.633785] Call Trace:
[  213.634099]
[  213.634393]  dump_stack_lvl+0x7e/0xc0
[  213.634806]  print_deadlock_bug+0x278/0x3c0
[  213.635265]  __lock_acquire+0x15f4/0x2c40
[  213.635712]  lock_acquire+0xcd/0x2d0
[  213.636120]  ? mlx5_wc_support_get+0x18c/0x210 [mlx5_core]
[  213.636722]  ? mlx5_ib_enable_lb+0x24/0xa0 [mlx5_ib]
[  213.637277]  __mutex_lock+0x81/0xda0
[  213.637697]  ? mlx5_wc_support_get+0x18c/0x210 [mlx5_core]
[  213.638305]  ? mlx5_wc_support_get+0x18c/0x210 [mlx5_core]
[  213.638902]  ? rcu_read_lock_sched_held+0x3f/0x70
[  213.639400]  ? mlx5_wc_support_get+0x18c/0x210 [mlx5_core]
[  213.640016]  mlx5_wc_support_get+0x18c/0x210 [mlx5_core]
[  213.640615]  set_ucontext_resp+0x68/0x2b0 [mlx5_ib]
[  213.641144]  ? debug_mutex_init+0x33/0x40
[  213.641586]  mlx5_ib_alloc_ucontext+0x18e/0x7b0 [mlx5_ib]
[  213.642145]  ib_init_ucontext+0xa0/0xf0 [ib_uverbs]
[  213.642679]  ib_uverbs_handler_UVERBS_METHOD_GET_CONTEXT+0x95/0xc0
                [ib_uverbs]
[  213.643426]  ? _copy_from_user+0x46/0x80
[  213.643878]  ib_uverbs_cmd_verbs+0xa6b/0xc80 [ib_uverbs]
[  213.644426]  ? ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0x130/0x130
               [ib_uverbs]
[  213.645213]  ? __lock_acquire+0xa99/0x2c40
[  213.645675]  ? lock_acquire+0xcd/0x2d0
[  213.646101]  ? ib_uverbs_ioctl+0xc4/0x170 [ib_uverbs]
[  213.646625]  ? reacquire_held_locks+0xcf/0x1f0
[  213.647102]  ? do_user_addr_fault+0x45d/0x770
[  213.647586]  ib_uverbs_ioctl+0xe0/0x170 [ib_uverbs]
[  213.648102]  ? ib_uverbs_ioctl+0xc4/0x170 [ib_uverbs]
[  213.648632]  __x64_sys_ioctl+0x4d3/0xaa0
[  213.649060]  ? do_user_addr_fault+0x4a8/0x770
[  213.649528]  do_syscall_64+0x6d/0x140
[  213.649947]  entry_SYSCALL_64_after_hwframe+0x4b/0x53
[  213.650478] RIP: 0033:0x7fa179b0737b
[  213.650893] Code: ff ff ff 85 c0 79 9b 49 c7 c4 ff ff ff ff 5b 5d 4c
               89 e0 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa b8
               10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d
               7d 2a 0f 00 f7 d8 64 89 01 48
[  213.652619] RSP: 002b:00007ffd2e6d46e8 EFLAGS: 00000246 ORIG_RAX:
               0000000000000010
[  213.653390] RAX: ffffffffffffffda RBX: 00007ffd2e6d47f8 RCX:
               00007fa179b0737b
[  213.654084] RDX: 00007ffd2e6d47e0 RSI: 00000000c0181b01 RDI:
               0000000000000003
[  213.654767] RBP: 00007ffd2e6d47c0 R08: 00007fa1799be010 R09:
               0000000000000002
[  213.655453] R10: 00007ffd2e6d4960 R11: 0000000000000246 R12:
               00007ffd2e6d487c
[  213.656170] R13: 0000000000000027 R14: 0000000000000001 R15:
               00007ffd2e6d4f70

Fixes: d98995b ("net/mlx5: Reimplement write combining test")
Signed-off-by: Yishai Hadas <[email protected]>
Reviewed-by: Michael Guralnik <[email protected]>
Reviewed-by: Larysa Zaremba <[email protected]>
Signed-off-by: Tariq Toukan <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
ammarfaizi2 pushed a commit that referenced this pull request Jan 21, 2025
Clear the port select structure on error so no stale values left after
definers are destroyed. That's because the mlx5_lag_destroy_definers()
always try to destroy all lag definers in the tt_map, so in the flow
below lag definers get double-destroyed and cause kernel crash:

  mlx5_lag_port_sel_create()
    mlx5_lag_create_definers()
      mlx5_lag_create_definer()     <- Failed on tt 1
        mlx5_lag_destroy_definers() <- definers[tt=0] gets destroyed
  mlx5_lag_port_sel_create()
    mlx5_lag_create_definers()
      mlx5_lag_create_definer()     <- Failed on tt 0
        mlx5_lag_destroy_definers() <- definers[tt=0] gets double-destroyed

 Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
 Mem abort info:
   ESR = 0x0000000096000005
   EC = 0x25: DABT (current EL), IL = 32 bits
   SET = 0, FnV = 0
   EA = 0, S1PTW = 0
   FSC = 0x05: level 1 translation fault
 Data abort info:
   ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
 user pgtable: 64k pages, 48-bit VAs, pgdp=0000000112ce2e00
 [0000000000000008] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
 Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
 Modules linked in: iptable_raw bonding ip_gre ip6_gre gre ip6_tunnel tunnel6 geneve ip6_udp_tunnel udp_tunnel ipip tunnel4 ip_tunnel rdma_ucm(OE) rdma_cm(OE) iw_cm(OE) ib_ipoib(OE) ib_cm(OE) ib_umad(OE) mlx5_ib(OE) ib_uverbs(OE) mlx5_fwctl(OE) fwctl(OE) mlx5_core(OE) mlxdevm(OE) ib_core(OE) mlxfw(OE) memtrack(OE) mlx_compat(OE) openvswitch nsh nf_conncount psample xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo xt_addrtype iptable_filter iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter bridge stp llc netconsole overlay efi_pstore sch_fq_codel zram ip_tables crct10dif_ce qemu_fw_cfg fuse ipv6 crc_ccitt [last unloaded: mlx_compat(OE)]
  CPU: 3 UID: 0 PID: 217 Comm: kworker/u53:2 Tainted: G           OE      6.11.0+ #2
  Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
  Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
  Workqueue: mlx5_lag mlx5_do_bond_work [mlx5_core]
  pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
  pc : mlx5_del_flow_rules+0x24/0x2c0 [mlx5_core]
  lr : mlx5_lag_destroy_definer+0x54/0x100 [mlx5_core]
  sp : ffff800085fafb00
  x29: ffff800085fafb00 x28: ffff0000da0c8000 x27: 0000000000000000
  x26: ffff0000da0c8000 x25: ffff0000da0c8000 x24: ffff0000da0c8000
  x23: ffff0000c31f81a0 x22: 0400000000000000 x21: ffff0000da0c8000
  x20: 0000000000000000 x19: 0000000000000001 x18: 0000000000000000
  x17: 0000000000000000 x16: 0000000000000000 x15: 0000ffff8b0c9350
  x14: 0000000000000000 x13: ffff800081390d18 x12: ffff800081dc3cc0
  x11: 0000000000000001 x10: 0000000000000b10 x9 : ffff80007ab7304c
  x8 : ffff0000d00711f0 x7 : 0000000000000004 x6 : 0000000000000190
  x5 : ffff00027edb3010 x4 : 0000000000000000 x3 : 0000000000000000
  x2 : ffff0000d39b8000 x1 : ffff0000d39b8000 x0 : 0400000000000000
  Call trace:
   mlx5_del_flow_rules+0x24/0x2c0 [mlx5_core]
   mlx5_lag_destroy_definer+0x54/0x100 [mlx5_core]
   mlx5_lag_destroy_definers+0xa0/0x108 [mlx5_core]
   mlx5_lag_port_sel_create+0x2d4/0x6f8 [mlx5_core]
   mlx5_activate_lag+0x60c/0x6f8 [mlx5_core]
   mlx5_do_bond_work+0x284/0x5c8 [mlx5_core]
   process_one_work+0x170/0x3e0
   worker_thread+0x2d8/0x3e0
   kthread+0x11c/0x128
   ret_from_fork+0x10/0x20
  Code: a9025bf5 aa0003f6 a90363f7 f90023f9 (f9400400)
  ---[ end trace 0000000000000000 ]---

Fixes: dc48516 ("net/mlx5: Lag, add support to create definers for LAG")
Signed-off-by: Mark Zhang <[email protected]>
Reviewed-by: Leon Romanovsky <[email protected]>
Reviewed-by: Mark Bloch <[email protected]>
Reviewed-by: Jacob Keller <[email protected]>
Signed-off-by: Tariq Toukan <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.