ALSA: hda: cs35l56: Fix lifecycle of codec pointer
Subsystems (8)
Sasha Levin
maintainerPATCH 1/20 ALSA: hda: cs35l56: Fix lifecycle of codec pointer
From: Simon Trimmer <[email protected]>
[ Upstream commit d339131bf02d4ed918415574082caf5e8af6e664 ]
The codec should be cleared when the amp driver is unbound and when resuming it should be tested to prevent loading firmware into the device and ALSA in a partially configured system state.
--- sound/pci/hda/cs35l56_hda.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/pci/hda/cs35l56_hda.c +5 -0
@@ -735,6 +735,8 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *if (comps[cs35l56->index].dev == dev)memset (&comps[cs35l56->index],0 ,sizeof (*comps)); + cs35l56->codec =NULL ; +dev_dbg (cs35l56->base.dev,"Unbound\n" ); }
@@ -840,6 +842,9 @@ static int cs35l56_hda_system_resume(struct device *dev) cs35l56->suspended = false; +if (!cs35l56->codec) +return 0 ; + ret =cs35l56_is_fw_reload_needed (&cs35l56->base);dev_dbg (cs35l56->base.dev,"fw_reload_needed: %d\n" , ret);if (ret >0 ) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/20 wifi: cfg80211: wext: add extra SIOCSIWSCAN data check
From: Dmitry Antipov <[email protected]>
[ Upstream commit 6ef09cdc5ba0f93826c09d810c141a8d103a80fc ]
In 'cfg80211_wext_siwscan()', add extra check whether number of channels passed via 'ioctl(sock, SIOCSIWSCAN, ...)' doesn't exceed IW_MAX_FREQUENCIES and reject invalid request with -EINVAL otherwise.
--- net/wireless/scan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/wireless/scan.c +6 -2
@@ -3396,10 +3396,14 @@ int cfg80211_wext_siwscan(struct net_device *dev, wiphy = &rdev->wiphy;/* Determine number of channels, needed to allocate creq */ -if (wreq && wreq->num_channels) +if (wreq && wreq->num_channels) { +/* Passed from userspace so should be checked */ +if (unlikely (wreq->num_channels >IW_MAX_FREQUENCIES )) +return -EINVAL ; n_channels = wreq->num_channels; -else + }else { n_channels =ieee80211_get_num_supported_channels (wiphy); + } creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) + n_channels * sizeof(void *),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/20 ALSA: hda: cs35l41: Support Lenovo Thinkbook 16P Gen 5
In reply to Sasha LevinFrom: Stefan Binding <[email protected]>
[ Upstream commit 82f3daed2d3590fa286a02301573a183dd902a0f ]
This laptop does not contain _DSD so needs to be supported using the configuration table.
--- sound/pci/hda/cs35l41_hda_property.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/cs35l41_hda_property.c +4 -0
@@ -118,6 +118,8 @@ static const struct cs35l41_config cs35l41_config_table[] = { { "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 }, { "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 }, { "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 }, + { "17AA38F9", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 }, + { "17AA38FA", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 }, {} };
@@ -509,6 +511,8 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = { { "CSC3551", "17AA38B5", generic_dsd_config }, { "CSC3551", "17AA38B6", generic_dsd_config }, { "CSC3551", "17AA38B7", generic_dsd_config }, + { "CSC3551", "17AA38F9", generic_dsd_config }, + { "CSC3551", "17AA38FA", generic_dsd_config }, {} };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/20 ALSA: hda: cs35l41: Support Lenovo Thinkbook 13x Gen 4
In reply to Sasha LevinFrom: Stefan Binding <[email protected]>
[ Upstream commit b32f92d1af3789038f03c2899e3be0d00b43faf2 ]
This laptop does not contain _DSD so needs to be supported using the configuration table.
--- sound/pci/hda/cs35l41_hda_property.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/cs35l41_hda_property.c +4 -0
@@ -118,6 +118,8 @@ static const struct cs35l41_config cs35l41_config_table[] = { { "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 }, { "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 }, { "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 }, + { "17AA38C7", 4, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT }, 0, 2, -1, 1000, 4500, 24 }, + { "17AA38C8", 4, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT }, 0, 2, -1, 1000, 4500, 24 }, { "17AA38F9", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 }, { "17AA38FA", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 }, {}
@@ -511,6 +513,8 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = { { "CSC3551", "17AA38B5", generic_dsd_config }, { "CSC3551", "17AA38B6", generic_dsd_config }, { "CSC3551", "17AA38B7", generic_dsd_config }, + { "CSC3551", "17AA38C7", generic_dsd_config }, + { "CSC3551", "17AA38C8", generic_dsd_config }, { "CSC3551", "17AA38F9", generic_dsd_config }, { "CSC3551", "17AA38FA", generic_dsd_config }, {}
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/20 ALSA: hda/realtek: Support Lenovo Thinkbook 16P Gen 5
In reply to Sasha LevinFrom: Stefan Binding <[email protected]>
[ Upstream commit 75f2ea939b5c694b36aad8ef823a2f9bcf7b3d7d ]
Add support for this laptop, which uses CS35L41 HDA amps. The laptop does not contain valid _DSD for these amps, so requires entries into the CS35L41 configuration table to function correctly.
[ fixed to lower hex numbers in quirk entries -- tiwai ]
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -10525,6 +10525,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x38cd ,"Y790 VECO DUAL" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38d2 ,"Lenovo Yoga 9 14IMH9" ,ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x38d7 ,"Lenovo Yoga 9 14IMH9" ,ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN ), +SND_PCI_QUIRK (0x17aa ,0x38f9 ,"Thinkbook 16P Gen5" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x17aa ,0x38fa ,"Thinkbook 16P Gen5" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x17aa ,0x3902 ,"Lenovo E50-80" ,ALC269_FIXUP_DMIC_THINKPAD_ACPI ),SND_PCI_QUIRK (0x17aa ,0x3977 ,"IdeaPad S210" ,ALC283_FIXUP_INT_MIC ), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/20 ALSA: hda/realtek: Support Lenovo Thinkbook 13x Gen 4
In reply to Sasha LevinFrom: Stefan Binding <[email protected]>
[ Upstream commit 4ecb16d9250e6fcf8818572bf317b6adae16515b ]
Add support for this laptop, which uses CS35L41 HDA amps. The laptop does not contain valid _DSD for these amps, so requires entries into the CS35L41 configuration table to function correctly.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -10521,6 +10521,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x38be ,"Yoga S980-14.5 proX YC Dual" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38bf ,"Yoga S980-14.5 proX LX Dual" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38c3 ,"Y980 DUAL" ,ALC287_FIXUP_TAS2781_I2C ), +SND_PCI_QUIRK (0x17aa ,0x38c7 ,"Thinkbook 13x Gen 4" ,ALC287_FIXUP_CS35L41_I2C_4 ), +SND_PCI_QUIRK (0x17aa ,0x38c8 ,"Thinkbook 13x Gen 4" ,ALC287_FIXUP_CS35L41_I2C_4 ),SND_PCI_QUIRK (0x17aa ,0x38cb ,"Y790 YG DUAL" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38cd ,"Y790 VECO DUAL" ,ALC287_FIXUP_TAS2781_I2C ), SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/20 wifi: mac80211: Avoid address calculations via out of bounds array indexing
In reply to Sasha LevinFrom: Kenton Groombridge <[email protected]>
[ Upstream commit 2663d0462eb32ae7c9b035300ab6b1523886c718 ]
req->n_channels must be set before req->channels[] can be used.
This patch fixes one of the issues encountered in [1].
[ 83.964255] UBSAN: array-index-out-of-bounds in net/mac80211/scan.c:364:4 [ 83.964258] index 0 is out of range for type 'struct ieee80211_channel *[]' [...] [ 83.964264] Call Trace: [ 83.964267] <TASK> [ 83.964269] dump_stack_lvl+0x3f/0xc0 [ 83.964274] __ubsan_handle_out_of_bounds+0xec/0x110 [ 83.964278] ieee80211_prep_hw_scan+0x2db/0x4b0 [ 83.964281] __ieee80211_start_scan+0x601/0x990 [ 83.964291] nl80211_trigger_scan+0x874/0x980 [ 83.964295] genl_family_rcv_msg_doit+0xe8/0x160 [ 83.964298] genl_rcv_msg+0x240/0x270
[...]
[1] https://bugzilla.kernel.org/show_bug.cgi?id=218810
--- net/mac80211/scan.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
net/mac80211/scan.c +9 -8
@@ -358,7 +358,8 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_sub_if_data *sdata)struct cfg80211_scan_request *req;struct cfg80211_chan_def chandef;u8 bands_used =0 ; -int i, ielen, n_chans; +int i, ielen; +u32 *n_chans;u32 flags =0 ; req = rcu_dereference_protected(local->scan_req,
@@ -368,34 +369,34 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_sub_if_data *sdata)return false;if (ieee80211_hw_check (&local->hw,SINGLE_SCAN_ON_ALL_BANDS )) { + local->hw_scan_req->req.n_channels = req->n_channels; +for (i =0 ; i < req->n_channels; i++) { local->hw_scan_req->req.channels[i] = req->channels[i]; bands_used |=BIT (req->channels[i]->band); } - - n_chans = req->n_channels; }else {do {if (local->hw_scan_band ==NUM_NL80211_BANDS )return false; - n_chans =0 ; + n_chans = &local->hw_scan_req->req.n_channels; + *n_chans =0 ;for (i =0 ; i < req->n_channels; i++) {if (req->channels[i]->band != local->hw_scan_band)continue ; - local->hw_scan_req->req.channels[n_chans] = + local->hw_scan_req->req.channels[(*n_chans)++] = req->channels[i]; - n_chans++; + bands_used |=BIT (req->channels[i]->band); } local->hw_scan_band++; - }while (!n_chans); + }while (!*n_chans); } - local->hw_scan_req->req.n_channels = n_chans;ieee80211_prepare_scan_chandef (&chandef);if (req->flags &NL80211_SCAN_FLAG_MIN_PREQ_CONTENT )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/20 KVM: PPC: Book3S HV: Prevent UAF in kvm_spapr_tce_attach_iommu_group()
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
[ Upstream commit a986fa57fd81a1430e00b3c6cf8a325d6f894a63 ]
Al reported a possible use-after-free (UAF) in kvm_spapr_tce_attach_iommu_group().
It looks up stt from tablefd, but then continues to use it after doing fdput() on the returned fd. After the fdput() the tablefd is free to be closed by another thread. The close calls kvm_spapr_tce_release() and then release_spapr_tce_table() (via call_rcu()) which frees stt.
Although there are calls to rcu_read_lock() in kvm_spapr_tce_attach_iommu_group() they are not sufficient to prevent the UAF, because stt is used outside the locked regions.
With an artifcial delay after the fdput() and a userspace program which triggers the race, KASAN detects the UAF:
BUG: KASAN: slab-use-after-free in kvm_spapr_tce_attach_iommu_group+0x298/0x720 [kvm]
Read of size 4 at addr c000200027552c30 by task kvm-vfio/2505
CPU: 54 PID: 2505 Comm: kvm-vfio Not tainted 6.10.0-rc3-next-20240612-dirty #1
Hardware name: 8335-GTH POWER9 0x4e1202 opal:skiboot-v6.5.3-35-g1851b2a06 PowerNV
Call Trace:
dump_stack_lvl+0xb4/0x108 (unreliable)
print_report+0x2b4/0x6ec
kasan_report+0x118/0x2b0
__asan_load4+0xb8/0xd0
kvm_spapr_tce_attach_iommu_group+0x298/0x720 [kvm]
kvm_vfio_set_attr+0x524/0xac0 [kvm]
kvm_device_ioctl+0x144/0x240 [kvm]
sys_ioctl+0x62c/0x1810
system_call_exception+0x190/0x440
system_call_vectored_common+0x15c/0x2ec
...
Freed by task 0:
...
kfree+0xec/0x3e0
release_spapr_tce_table+0xd4/0x11c [kvm]
rcu_core+0x568/0x16a0
handle_softirqs+0x23c/0x920
do_softirq_own_stack+0x6c/0x90
do_softirq_own_stack+0x58/0x90
__irq_exit_rcu+0x218/0x2d0
irq_exit+0x30/0x80
arch_local_irq_restore+0x128/0x230
arch_local_irq_enable+0x1c/0x30
cpuidle_enter_state+0x134/0x5cc
cpuidle_enter+0x6c/0xb0
call_cpuidle+0x7c/0x100
do_idle+0x394/0x410
cpu_startup_entry+0x60/0x70
start_secondary+0x3fc/0x410
start_secondary_prolog+0x10/0x14Fix it by delaying the fdput() until stt is no longer in use, which is effectively the entire function. To keep the patch minimal add a call to fdput() at each of the existing return paths. Future work can convert the function to goto or __cleanup style cleanup.
With the fix in place the test case no longer triggers the UAF.
--- arch/powerpc/kvm/book3s_64_vio.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
arch/powerpc/kvm/book3s_64_vio.c +13 -5
@@ -130,14 +130,16 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, }rcu_read_unlock (); -fdput (f); - -if (!found) +if (!found) { +fdput (f);return -EINVAL ; + } table_group =iommu_group_get_iommudata (grp); -if (WARN_ON (!table_group)) +if (WARN_ON (!table_group)) { +fdput (f);return -EFAULT ; + }for (i =0 ; i <IOMMU_TABLE_GROUP_MAX_TABLES ; ++i) {struct iommu_table *tbltmp = table_group->tables[i];
@@ -158,8 +160,10 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,break ; } } -if (!tbl) +if (!tbl) { +fdput (f);return -EINVAL ; + }rcu_read_lock ();list_for_each_entry_rcu (stit, &stt->iommu_tables, next) {
@@ -170,6 +174,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,/* stit is being destroyed */ iommu_tce_table_put (tbl);rcu_read_unlock (); +fdput (f);return -ENOTTY ; }/*
@@ -177,6 +182,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,* its KVM reference counter and can return. */ rcu_read_unlock (); +fdput (f);return 0 ; }rcu_read_unlock ();
@@ -184,6 +190,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, stit =kzalloc (sizeof (*stit),GFP_KERNEL );if (!stit) {iommu_tce_table_put (tbl); +fdput (f);return -ENOMEM ; }
@@ -192,6 +199,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,list_add_rcu (&stit->next, &stt->iommu_tables); +fdput (f);return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/20 drm/vmwgfx: Fix missing HYPERVISOR_GUEST dependency
In reply to Sasha LevinFrom: Alexey Makhalov <[email protected]>
[ Upstream commit 8c4d6945fe5bd04ff847c3c788abd34ca354ecee ]
VMWARE_HYPERCALL alternative will not work as intended without VMware guest code initialization.
[ bp: note that this doesn't reproduce with newer gccs so it must be
something gcc-9-specific. ]
--- drivers/gpu/drm/vmwgfx/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/Kconfig +1 -1
@@ -2,7 +2,7 @@ config DRM_VMWGFX tristate "DRM driver for VMware Virtual GPU" depends on DRM && PCI && MMU - depends on X86 || ARM64 + depends on (X86 && HYPERVISOR_GUEST) || ARM64 select DRM_TTM select DRM_TTM_HELPER select MAPPING_DIRTY_HELPERS
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/20 ALSA: hda/realtek: Add more codec ID to no shutup pins list
In reply to Sasha LevinFrom: Kailang Yang <[email protected]>
[ Upstream commit 70794b9563fe011988bcf6a081af9777e63e8d37 ]
If it enter to runtime D3 state, it didn't shutup Headset MIC pin.
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -585,10 +585,14 @@ static void alc_shutup_pins(struct hda_codec *codec)switch (codec->core.vendor_id) {case 0x10ec0236 :case 0x10ec0256 : +case 0x10ec0257 :case 0x19e58326 :case 0x10ec0283 : +case 0x10ec0285 :case 0x10ec0286 : +case 0x10ec0287 :case 0x10ec0288 : +case 0x10ec0295 :case 0x10ec0298 :alc_headset_mic_no_shutup (codec);break ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/20 spi: Fix OCTAL mode support
In reply to Sasha LevinFrom: Patrice Chotard <[email protected]>
[ Upstream commit d6a711a898672dd873aab3844f754a3ca40723a5 ]
Add OCTAL mode support.
Issue detected using "--octal" spidev_test's option.
--- drivers/spi/spi.c | 6 ++++-- include/linux/spi/spi.h | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/spi/spi.c +4 -2
@@ -4149,7 +4149,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)return -EINVAL ;if (xfer->tx_nbits !=SPI_NBITS_SINGLE && xfer->tx_nbits !=SPI_NBITS_DUAL && - xfer->tx_nbits !=SPI_NBITS_QUAD ) + xfer->tx_nbits !=SPI_NBITS_QUAD && + xfer->tx_nbits !=SPI_NBITS_OCTAL )return -EINVAL ;if ((xfer->tx_nbits ==SPI_NBITS_DUAL ) && !(spi->mode & (SPI_TX_DUAL |SPI_TX_QUAD )))
@@ -4164,7 +4165,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)return -EINVAL ;if (xfer->rx_nbits !=SPI_NBITS_SINGLE && xfer->rx_nbits !=SPI_NBITS_DUAL && - xfer->rx_nbits !=SPI_NBITS_QUAD ) + xfer->rx_nbits !=SPI_NBITS_QUAD && + xfer->rx_nbits !=SPI_NBITS_OCTAL )return -EINVAL ;if ((xfer->rx_nbits ==SPI_NBITS_DUAL ) && !(spi->mode & (SPI_RX_DUAL |SPI_RX_QUAD )))
include/linux/spi/spi.h +3 -2
@@ -1085,12 +1085,13 @@ struct spi_transfer { unsigned dummy_data:1; unsigned cs_off:1; unsigned cs_change:1; - unsigned tx_nbits:3; - unsigned rx_nbits:3; + unsigned tx_nbits:4; + unsigned rx_nbits:4; unsigned timestamped:1;#define SPI_NBITS_SINGLE 0x01/* 1-bit transfer */ #define SPI_NBITS_DUAL 0x02/* 2-bit transfer */ #define SPI_NBITS_QUAD 0x04/* 4-bit transfer */ +#define SPI_NBITS_OCTAL 0x08/* 8-bit transfer */ u8 bits_per_word;struct spi_delay delay;struct spi_delay cs_change_delay;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/20 cpumask: limit FORCE_NR_CPUS to just the UP case
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
[ Upstream commit 5d272dd1b3430bb31fa30042490fa081512424e4 ]
Hardcoding the number of CPUs at compile time does improve code generation, but if you get it wrong the result will be confusion.
We already limited this earlier to only "experts" (see commit fe5759d5bfda "cpumask: limit visibility of FORCE_NR_CPUS"), but with distro kernel configs often having EXPERT enabled, that turns out to not be much of a limit.
To quote the philosophers at Disney: "Everyone can be an expert. And when everyone's an expert, no one will be".
There's a runtime warning if you then set nr_cpus to anything but the forced number, but apparently that can be ignored too [1] and by then it's pretty much too late anyway.
If we had some real way to limit this to "embedded only", maybe it would be worth it, but let's see if anybody even notices that the option is gone. We need to simplify kernel configuration anyway.
--- lib/Kconfig | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
lib/Kconfig +1 -7
@@ -539,13 +539,7 @@ config CPUMASK_OFFSTACK stack overflow. config FORCE_NR_CPUS - bool "Set number of CPUs at compile time" - depends on SMP && EXPERT && !COMPILE_TEST - help - Say Yes if you have NR_CPUS set to an actual number of possible - CPUs in your system, not to a default value. This forces the core - code to rely on compile-time value and optimize kernel routines - better. + def_bool !SMP config CPU_RMAP bool
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/20 selftests: openvswitch: Set value to nla flags.
In reply to Sasha LevinFrom: Adrian Moreno <[email protected]>
[ Upstream commit a8763466669d21b570b26160d0a5e0a2ee529d22 ]
Netlink flags, although they don't have payload at the netlink level, are represented as having "True" as value in pyroute2.
Without it, trying to add a flow with a flag-type action (e.g: pop_vlan) fails with the following traceback:
Traceback (most recent call last):
File "[...]/ovs-dpctl.py", line 2498, in <module>
sys.exit(main(sys.argv))
^^^^^^^^^^^^^^
File "[...]/ovs-dpctl.py", line 2487, in main
ovsflow.add_flow(rep["dpifindex"], flow)
File "[...]/ovs-dpctl.py", line 2136, in add_flow
reply = self.nlm_request(
^^^^^^^^^^^^^^^^^ File "[...]/pyroute2/netlink/nlsocket.py", line 822, in nlm_request
return tuple(self._genlm_request(*argv, **kwarg))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/pyroute2/netlink/generic/__init__.py", line 126, innlm_request
return tuple(super().nlm_request(*argv, **kwarg))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/pyroute2/netlink/nlsocket.py", line 1124, in nlm_request
self.put(msg, msg_type, msg_flags, msg_seq=msg_seq)
File "[...]/pyroute2/netlink/nlsocket.py", line 389, in put
self.sendto_gate(msg, addr)
File "[...]/pyroute2/netlink/nlsocket.py", line 1056, in sendto_gate
msg.encode()
File "[...]/pyroute2/netlink/__init__.py", line 1245, in encode
offset = self.encode_nlas(offset)
^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/pyroute2/netlink/__init__.py", line 1560, in encode_nlas
nla_instance.setvalue(cell[1])
File "[...]/pyroute2/netlink/__init__.py", line 1265, in setvalue
nlv.setvalue(nla_tuple[1])
~~~~~~~~~^^^IndexError: list index out of range
--- tools/testing/selftests/net/openvswitch/ovs-dpctl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/openvswitch/ovs-dpctl.py +1 -1
@@ -531,7 +531,7 @@ class ovsactions(nla): for flat_act in parse_flat_map: if parse_starts_block(actstr, flat_act[0], False): actstr = actstr[len(flat_act[0]):] - self["attrs"].append([flat_act[1]]) + self["attrs"].append([flat_act[1], True]) actstr = actstr[strspn(actstr, ", ") :] parsed = True
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/20 drm/amdgpu: Indicate CU havest info to CP
In reply to Sasha LevinFrom: Harish Kasiviswanathan <[email protected]>
[ Upstream commit 49c9ffabde555c841392858d8b9e6cf58998a50c ]
To achieve full occupancy CP hardware needs to know if CUs in SE are symmetrically or asymmetrically harvested
v2: Reset is_symmetric_cus for each loop
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +13 -2
@@ -4187,9 +4187,10 @@ static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev, int xcc_istatic int gfx_v9_4_3_get_cu_info (struct amdgpu_device *adev,struct amdgpu_cu_info *cu_info) { -int i, j, k, counter, xcc_id, active_cu_number =0 ; -u32 mask, bitmap, ao_bitmap, ao_cu_mask =0 ; +int i, j, k, prev_counter, counter, xcc_id, active_cu_number =0 ; +u32 mask, bitmap, ao_bitmap, ao_cu_mask =0 , tmp;unsigned disable_masks[4 *4 ]; +bool is_symmetric_cus;if (!adev || !cu_info)return -EINVAL ;
@@ -4207,6 +4208,7 @@ static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev,mutex_lock (&adev->grbm_idx_mutex);for (xcc_id =0 ; xcc_id <NUM_XCC (adev->gfx.xcc_mask); xcc_id++) { + is_symmetric_cus = true;for (i =0 ; i < adev->gfx.config.max_shader_engines; i++) {for (j =0 ; j < adev->gfx.config.max_sh_per_se; j++) { mask =1 ;
@@ -4234,6 +4236,15 @@ static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev, ao_cu_mask |= (ao_bitmap << (i *16 + j *8 )); cu_info->ao_cu_bitmap[i][j] = ao_bitmap; } +if (i && is_symmetric_cus && prev_counter != counter) + is_symmetric_cus = false; + prev_counter = counter; + } +if (is_symmetric_cus) { + tmp =RREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_CPC_DEBUG); + tmp =REG_SET_FIELD (tmp,CP_CPC_DEBUG ,CPC_HARVESTING_RELAUNCH_DISABLE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_CPC_DEBUG ,CPC_HARVESTING_DISPATCH_DISABLE ,1 ); +WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_CPC_DEBUG, tmp); }gfx_v9_4_3_xcc_select_se_sh (adev,0xffffffff ,0xffffffff ,0xffffffff , xcc_id);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/20 drm/amd/display: Change dram_clock_latency to 34us for dcn351
In reply to Sasha LevinFrom: Daniel Miess <[email protected]>
[ Upstream commit c60e20f13c27662de36cd5538d6299760780db52 ]
[Why]
Intermittent underflow observed when using 4k144 display on dcn351
[How]
Update dram_clock_change_latency_us from 11.72us to 34us
--- drivers/gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c +1 -1
@@ -215,7 +215,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_51_soc = { .urgent_latency_pixel_data_only_us = 4.0, .urgent_latency_pixel_mixed_with_vm_data_us = 4.0, .urgent_latency_vm_data_only_us = 4.0, - .dram_clock_change_latency_us = 11.72, + .dram_clock_change_latency_us = 34, .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096, .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096, .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/20 drm/amd/display: change dram_clock_latency to 34us for dcn35
In reply to Sasha LevinFrom: Paul Hsieh <[email protected]>
[ Upstream commit 6071607bfefefc50a3907c0ba88878846960d29a ]
[Why & How]
Current DRAM setting would cause underflow on customer platform.
Modify dram_clock_change_latency_us from 11.72 to 34.0 us as per recommendation from HW team
--- drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c +1 -1
@@ -177,7 +177,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_5_soc = { .urgent_latency_pixel_data_only_us = 4.0, .urgent_latency_pixel_mixed_with_vm_data_us = 4.0, .urgent_latency_vm_data_only_us = 4.0, - .dram_clock_change_latency_us = 11.72, + .dram_clock_change_latency_us = 34.0, .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096, .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096, .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/20 drm/amdgpu: init TA fw for psp v14
In reply to Sasha LevinFrom: Likun Gao <[email protected]>
[ Upstream commit ed5a4484f074aa2bfb1dad99ff3628ea8da4acdc ]
Add support to init TA firmware for psp v14.
--- drivers/gpu/drm/amd/amdgpu/psp_v14_0.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/psp_v14_0.c +5 -0
@@ -32,7 +32,9 @@#include "mp/mp_14_0_2_sh_mask.h" MODULE_FIRMWARE ("amdgpu/psp_14_0_2_sos.bin" ); +MODULE_FIRMWARE ("amdgpu/psp_14_0_2_ta.bin" );MODULE_FIRMWARE ("amdgpu/psp_14_0_3_sos.bin" ); +MODULE_FIRMWARE ("amdgpu/psp_14_0_3_ta.bin" );/* For large FW files the time to complete can be very long */ #define USBC_PD_POLLING_LIMIT_S 240
@@ -64,6 +66,9 @@ static int psp_v14_0_init_microcode(struct psp_context *psp)case IP_VERSION (14 ,0 ,2 ):case IP_VERSION (14 ,0 ,3 ): err =psp_init_sos_microcode (psp, ucode_prefix); +if (err) +return err; + err =psp_init_ta_microcode (psp, ucode_prefix);if (err)return err;break ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/20 ALSA: hda: cs35l56: Select SERIAL_MULTI_INSTANTIATE
In reply to Sasha LevinFrom: Simon Trimmer <[email protected]>
[ Upstream commit 9b1effff19cdf2230d3ecb07ff4038a0da32e9cc ]
The ACPI IDs used in the CS35L56 HDA drivers are all handled by the serial multi-instantiate driver which starts multiple Linux device instances from a single ACPI Device() node.
As serial multi-instantiate is not an optional part of the system add it as a dependency in Kconfig so that it is not overlooked.
--- sound/pci/hda/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/Kconfig +2 -0
@@ -160,6 +160,7 @@ config SND_HDA_SCODEC_CS35L56_I2C depends on ACPI || COMPILE_TEST depends on SND_SOC select FW_CS_DSP + select SERIAL_MULTI_INSTANTIATE select SND_HDA_GENERIC select SND_SOC_CS35L56_SHARED select SND_HDA_SCODEC_CS35L56
@@ -176,6 +177,7 @@ config SND_HDA_SCODEC_CS35L56_SPI depends on ACPI || COMPILE_TEST depends on SND_SOC select FW_CS_DSP + select SERIAL_MULTI_INSTANTIATE select SND_HDA_GENERIC select SND_SOC_CS35L56_SHARED select SND_HDA_SCODEC_CS35L56
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 19/20 mips: fix compat_sys_lseek syscall
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 0d5679a0aae2d8cda72169452c32e5cb88a7ab33 ]
This is almost compatible, but passing a negative offset should result in a EINVAL error, but on mips o32 compat mode would seek to a large 32-bit byte offset.
Use compat_sys_lseek() to correctly sign-extend the argument.
--- arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/syscalls/syscall_o32.tbl +1 -1
@@ -27,7 +27,7 @@ 17 o32 break sys_ni_syscall # 18 was sys_stat 18 o32 unused18 sys_ni_syscall -19 o32 lseek sys_lseek +19 o32 lseek sys_lseek compat_sys_lseek 20 o32 getpid sys_getpid 21 o32 mount sys_mount 22 o32 umount sys_oldumount
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 20/20 closures: Change BUG_ON() to WARN_ON()
In reply to Sasha LevinFrom: Kent Overstreet <[email protected]>
[ Upstream commit 339b84ab6b1d66900c27bd999271cb2ae40ce812 ]
If a BUG_ON() can be hit in the wild, it shouldn't be a BUG_ON()
For reference, this has popped up once in the CI, and we'll need more info to debug it:
03240 ------------[ cut here ]------------
03240 kernel BUG at lib/closure.c:21!
03240 kernel BUG at lib/closure.c:21!
03240 Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
03240 Modules linked in:
03240 CPU: 15 PID: 40534 Comm: kworker/u80:1 Not tainted 6.10.0-rc4-ktest-ga56da69799bd #25570 03240 Hardware name: linux,dummy-virt (DT)
03240 Workqueue: btree_update btree_interior_update_work
03240 pstate: 00001005 (nzcv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--)
03240 pc : closure_put+0x224/0x2a0
03240 lr : closure_put+0x24/0x2a0
03240 sp : ffff0000d12071c0
03240 x29: ffff0000d12071c0 x28: dfff800000000000 x27: ffff0000d1207360
03240 x26: 0000000000000040 x25: 0000000000000040 x24: 0000000000000040
03240 x23: ffff0000c1f20180 x22: 0000000000000000 x21: ffff0000c1f20168
03240 x20: 0000000040000000 x19: ffff0000c1f20140 x18: 0000000000000001
03240 x17: 0000000000003aa0 x16: 0000000000003ad0 x15: 1fffe0001c326974
03240 x14: 0000000000000a1e x13: 0000000000000000 x12: 1fffe000183e402d
03240 x11: ffff6000183e402d x10: dfff800000000000 x9 : ffff6000183e402e
03240 x8 : 0000000000000001 x7 : 00009fffe7c1bfd3 x6 : ffff0000c1f2016b
03240 x5 : ffff0000c1f20168 x4 : ffff6000183e402e x3 : ffff800081391954
03240 x2 : 0000000000000001 x1 : 0000000000000000 x0 : 00000000a8000000
03240 Call trace:
03240 closure_put+0x224/0x2a0 03240 bch2_check_for_deadlock+0x910/0x1028 03240 bch2_six_check_for_deadlock+0x1c/0x30 03240 six_lock_slowpath.isra.0+0x29c/0xed0 03240 six_lock_ip_waiter+0xa8/0xf8 03240 __bch2_btree_node_lock_write+0x14c/0x298 03240 bch2_trans_lock_write+0x6d4/0xb10 03240 __bch2_trans_commit+0x135c/0x5520 03240 btree_interior_update_work+0x1248/0x1c10 03240 process_scheduled_works+0x53c/0xd90 03240 worker_thread+0x370/0x8c8 03240 kthread+0x258/0x2e8 03240 ret_from_fork+0x10/0x20
03240 Code: aa1303e0 d63f0020 a94363f7 17ffff8c (d4210000) 03240 ---[ end trace 0000000000000000 ]---
03240 Kernel panic - not syncing: Oops - BUG: Fatal exception 03240 SMP: stopping secondary CPUs
03241 SMP: failed to stop secondary CPUs 13,15
03241 Kernel Offset: disabled
03241 CPU features: 0x00,00000003,80000008,4240500b
03241 Memory Limit: none
03241 ---[ end Kernel panic - not syncing: Oops - BUG: Fatal exception ]--- 03246 ========= FAILED TIMEOUT copygc_torture_no_checksum in 7200s
--- lib/closure.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
lib/closure.c +8 -2
@@ -17,12 +17,18 @@ static inline void closure_put_after_sub(struct closure *cl, int flags) {int r = flags &CLOSURE_REMAINING_MASK ; -BUG_ON (flags &CLOSURE_GUARD_MASK ); -BUG_ON (!r && (flags & ~CLOSURE_DESTRUCTOR )); +if (WARN (flags &CLOSURE_GUARD_MASK , +"closure has guard bits set: %x (%u)" , + flags &CLOSURE_GUARD_MASK , (unsigned )__fls (r))) + r &= ~CLOSURE_GUARD_MASK ;if (!r) {smp_acquire__after_ctrl_dep (); +WARN (flags & ~CLOSURE_DESTRUCTOR , +"closure ref hit 0 with incorrect flags set: %x (%u)" , + flags & ~CLOSURE_DESTRUCTOR , (unsigned )__fls (flags)); + cl->closure_get_happened = false;if (cl->fn && !(flags &CLOSURE_DESTRUCTOR )) {
Signature · 1 line
2.43.0