libbpf: Initialize *nl_pid so gcc 10 is happy
Subsystems (10)
Sasha Levin
maintainerPATCH 1/26 libbpf: Initialize *nl_pid so gcc 10 is happy
From: Jeremy Cline <[email protected]>
[ Upstream commit 4734b0fefbbf98f8c119eb8344efa19dac82cd2c ]
Builds of Fedora's kernel-tools package started to fail with "may be used uninitialized" warnings for nl_pid in bpf_set_link_xdp_fd() and bpf_get_link_xdp_info() on the s390 architecture.
Although libbpf_netlink_open() always returns a negative number when it does not set *nl_pid, the compiler does not determine this and thus believes the variable might be used uninitialized. Assuage gcc's fears by explicitly initializing nl_pid.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1807781
--- tools/lib/bpf/netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/bpf/netlink.c +2 -2
@@ -137,7 +137,7 @@ int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags)struct ifinfomsg ifinfo;char attrbuf[64 ]; } req; -__u32 nl_pid; +__u32 nl_pid =0 ; sock =libbpf_netlink_open (&nl_pid);if (sock <0 )
@@ -254,7 +254,7 @@ int bpf_get_link_xdp_id(int ifindex, __u32 *prog_id, __u32 flags) {struct xdp_id_md xdp_id = {};int sock, ret; -__u32 nl_pid; +__u32 nl_pid =0 ;__u32 mask;if (flags & ~XDP_FLAGS_MASK )
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/26 net: fec: set GPR bit on suspend by DT configuration.
From: Martin Fuzzey <[email protected]>
[ Upstream commit da722186f6549d752ea5b5fbc18111833c81a133 ]
On some SoCs, such as the i.MX6, it is necessary to set a bit in the SoC level GPR register before suspending for wake on lan to work.
The fec platform callback sleep_mode_enable was intended to allow this but the platform implementation was NAK'd back in 2015 [1]
This means that, currently, wake on lan is broken on mainline for the i.MX6 at least.
So implement the required bit setting in the fec driver by itself by adding a new optional DT property indicating the GPR register and adding the offset and bit information to the driver.
[1] https://www.spinics.net/lists/netdev/msg310922.html
--- drivers/net/ethernet/freescale/fec.h | 7 + drivers/net/ethernet/freescale/fec_main.c | 149 +++++++++++++++++----- 2 files changed, 127 insertions(+), 29 deletions(-)
drivers/net/ethernet/freescale/fec.h +7 -0
@@ -488,6 +488,12 @@ struct fec_enet_priv_rx_q {struct sk_buff *rx_skbuff[RX_RING_SIZE ]; }; +struct fec_stop_mode_gpr { +struct regmap *gpr; +u8 reg; +u8 bit; +}; +/* The FEC buffer descriptors track the ring buffers. The rx_bd_base and * tx_bd_base always point to the base of the buffer descriptors. The * cur_rx and cur_tx point to the currently available buffer.
@@ -562,6 +568,7 @@ struct fec_enet_private {int hwts_tx_en;struct delayed_work time_keep;struct regulator *reg_phy; +struct fec_stop_mode_gpr stop_gpr;unsigned int tx_align;unsigned int rx_align;
drivers/net/ethernet/freescale/fec_main.c +120 -29
237 lines not on this page · raw message
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 3/26 x86: hyperv: report value of misc_features
In reply to Sasha LevinFrom: Olaf Hering <[email protected]>
[ Upstream commit 97d9f1c43bedd400301d6f1eff54d46e8c636e47 ]
A few kernel features depend on ms_hyperv.misc_features, but unlike its siblings ->features and ->hints, the value was never reported during boot.
--- arch/x86/kernel/cpu/mshyperv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/mshyperv.c +2 -2
@@ -227,8 +227,8 @@ static void __init ms_hyperv_init_platform(void) ms_hyperv.misc_features =cpuid_edx (HYPERV_CPUID_FEATURES ); ms_hyperv.hints =cpuid_eax (HYPERV_CPUID_ENLIGHTMENT_INFO ); -pr_info ("Hyper-V: features 0x%x, hints 0x%x\n" , - ms_hyperv.features, ms_hyperv.hints); +pr_info ("Hyper-V: features 0x%x, hints 0x%x, misc 0x%x\n" , + ms_hyperv.features, ms_hyperv.hints, ms_hyperv.misc_features); ms_hyperv.max_vp_index =cpuid_eax (HYPERV_CPUID_IMPLEMENT_LIMITS ); ms_hyperv.max_lp_index =cpuid_ebx (HYPERV_CPUID_IMPLEMENT_LIMITS );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/26 signal: check sig before setting info in kill_pid_usb_asyncio
In reply to Sasha LevinFrom: Zhiqiang Liu <[email protected]>
[ Upstream commit eaec2b0bd30690575c581eebffae64bfb7f684ac ]
In kill_pid_usb_asyncio, if signal is not valid, we do not need to set info struct.
--- kernel/signal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/signal.c +3 -3
@@ -1510,15 +1510,15 @@ int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr,unsigned long flags;int ret = -EINVAL ; +if (!valid_signal (sig)) +return ret; +clear_siginfo (&info); info.si_signo = sig; info.si_errno = errno; info.si_code =SI_ASYNCIO ; *((sigval_t *)&info.si_pid) = addr; -if (!valid_signal (sig)) -return ret; -rcu_read_lock (); p =pid_task (pid,PIDTYPE_PID );if (!p) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/26 afs: Fix length of dump of bad YFSFetchStatus record
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 3efe55b09a92a59ed8214db801683cf13c9742c4 ]
Fix the length of the dump of a bad YFSFetchStatus record. The function was copied from the AFS version, but the YFS variant contains bigger fields and extra information, so expand the dump to match.
--- fs/afs/yfsclient.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/afs/yfsclient.c +3 -3
@@ -165,15 +165,15 @@ static void xdr_dump_bad(const __be32 *bp)int i;pr_notice ("YFS XDR: Bad status record\n" ); -for (i =0 ; i <5 *4 *4 ; i +=16 ) { +for (i =0 ; i <6 *4 *4 ; i +=16 ) {memcpy (x, bp,16 ); bp +=4 ;pr_notice ("%03x: %08x %08x %08x %08x\n" , i,ntohl (x[0 ]),ntohl (x[1 ]),ntohl (x[2 ]),ntohl (x[3 ])); } -memcpy (x, bp,4 ); -pr_notice ("0x50: %08x\n" ,ntohl (x[0 ])); +memcpy (x, bp,8 ); +pr_notice ("0x60: %08x %08x\n" ,ntohl (x[0 ]),ntohl (x[1 ])); }/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/26 xfs: acquire superblock freeze protection on eofblocks scans
In reply to Sasha LevinFrom: Brian Foster <[email protected]>
[ Upstream commit 4b674b9ac852937af1f8c62f730c325fb6eadcdb ]
The filesystem freeze sequence in XFS waits on any background eofblocks or cowblocks scans to complete before the filesystem is quiesced. At this point, the freezer has already stopped the transaction subsystem, however, which means a truncate or cowblock cancellation in progress is likely blocked in transaction allocation. This results in a deadlock between freeze and the associated scanner.
Fix this problem by holding superblock write protection across calls into the block reapers. Since protection for background scans is acquired from the workqueue task context, trylock to avoid a similar deadlock between freeze and blocking on the write lock.
--- fs/xfs/xfs_icache.c | 10 ++++++++++ fs/xfs/xfs_ioctl.c | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-)
fs/xfs/xfs_icache.c +10 -0
@@ -907,7 +907,12 @@ xfs_eofblocks_worker( {struct xfs_mount *mp =container_of (to_delayed_work (work), struct xfs_mount, m_eofblocks_work); + +if (!sb_start_write_trylock (mp->m_super)) +return ;xfs_icache_free_eofblocks (mp,NULL ); +sb_end_write (mp->m_super); +xfs_queue_eofblocks (mp); }
@@ -934,7 +939,12 @@ xfs_cowblocks_worker( {struct xfs_mount *mp =container_of (to_delayed_work (work), struct xfs_mount, m_cowblocks_work); + +if (!sb_start_write_trylock (mp->m_super)) +return ;xfs_icache_free_cowblocks (mp,NULL ); +sb_end_write (mp->m_super); +xfs_queue_cowblocks (mp); }
fs/xfs/xfs_ioctl.c +4 -1
@@ -2401,7 +2401,10 @@ xfs_file_ioctl(if (error)return error; -return xfs_icache_free_eofblocks (mp, &keofb); +sb_start_write (mp->m_super); + error =xfs_icache_free_eofblocks (mp, &keofb); +sb_end_write (mp->m_super); +return error; }default :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 7/26 xfs: fix partially uninitialized structure in xfs_reflink_remap_extent
In reply to Sasha LevinFrom: "Darrick J. Wong" <[email protected]>
[ Upstream commit c142932c29e533ee892f87b44d8abc5719edceec ]
In the reflink extent remap function, it turns out that uirec (the block mapping corresponding only to the part of the passed-in mapping that got unmapped) was not fully initialized. Specifically, br_state was not being copied from the passed-in struct to the uirec. This could lead to unpredictable results such as the reflinked mapping being marked unwritten in the destination file.
--- fs/xfs/xfs_reflink.c | 1 + 1 file changed, 1 insertion(+)
fs/xfs/xfs_reflink.c +1 -0
@@ -1053,6 +1053,7 @@ xfs_reflink_remap_extent( uirec.br_startblock = irec->br_startblock + rlen; uirec.br_startoff = irec->br_startoff + rlen; uirec.br_blockcount = unmap_len - rlen; + uirec.br_state = irec->br_state; unmap_len = rlen;/* If this isn't a real mapping, we're done. */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/26 ALSA: hda: Release resources at error in delayed probe
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 2393e7555b531a534152ffe7bfd1862cacedaacb ]
snd-hda-intel driver handles the most of its probe task in the delayed work (either via workqueue or via firmware loader). When an error happens in the later delayed probe, we can't deregister the device itself because the probe callback already returned success and the device was bound. So, for now, we set hda->init_failed flag and make the rest untouched until the device gets really unbound. However, this leaves the device up running, keeping the resources without any use that prevents other operations.
In this patch, we release the resources at first when a probe error happens in the delayed probe stage, but keeps the top-level object, so that the PM and other ops can still refer to the object itself.
Also for simplicity, snd_hda_intel object is allocated via devm, so that we can get rid of the explicit kfree calls.
--- sound/pci/hda/hda_intel.c | 29 ++++++++++++++++------------- sound/pci/hda/hda_intel.h | 1 + 2 files changed, 17 insertions(+), 13 deletions(-)
sound/pci/hda/hda_intel.c +16 -13
@@ -1200,10 +1200,8 @@ static void azx_vs_set_state(struct pci_dev *pci,if (!disabled) {dev_info (chip->card->dev,"Start delayed initialization\n" ); -if (azx_probe_continue (chip) <0 ) { +if (azx_probe_continue (chip) <0 )dev_err (chip->card->dev,"initialization error\n" ); - hda->init_failed = true; - } } }else { dev_info(chip->card->dev, "%s via vga_switcheroo\n",
@@ -1336,12 +1334,15 @@ static int register_vga_switcheroo(struct azx *chip)/* * destructor */ -static int azx_free (struct azx *chip) +static void azx_free (struct azx *chip) {struct pci_dev *pci = chip->pci; struct hda_intel *hda = container_of(chip, struct hda_intel, chip);struct hdac_bus *bus =azx_bus (chip); +if (hda->freed) +return ; +if (azx_has_pm_runtime (chip) && chip->running)pm_runtime_get_noresume (&pci->dev); chip->running =0 ;
@@ -1385,9 +1386,8 @@ static int azx_free(struct azx *chip)if (chip->driver_caps &AZX_DCAPS_I915_COMPONENT )snd_hdac_i915_exit (bus); -kfree (hda); -return 0 ; + hda->freed =1 ; }static int azx_dev_disconnect (struct snd_device *device)
@@ -1403,7 +1403,8 @@ static int azx_dev_disconnect(struct snd_device *device)static int azx_dev_free (struct snd_device *device) { -return azx_free (device->device_data); +azx_free (device->device_data); +return 0 ; }#ifdef SUPPORT_VGA_SWITCHEROO
@@ -1717,7 +1718,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,if (err <0 )return err; - hda =kzalloc (sizeof (*hda),GFP_KERNEL ); + hda =devm_kzalloc (&pci->dev,sizeof (*hda),GFP_KERNEL );if (!hda) {pci_disable_device (pci);return -ENOMEM ;
@@ -1758,7 +1759,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, err =azx_bus_init (chip, model[dev]);if (err <0 ) { -kfree (hda);pci_disable_device (pci);return err; }
@@ -2306,13 +2306,16 @@ static int azx_probe_continue(struct azx *chip)pm_runtime_put_autosuspend (&pci->dev); out_free: -if (err <0 || !hda->need_i915_power) +if (err <0 ) { +azx_free (chip); +return err; + } + +if (!hda->need_i915_power)display_power (chip, false); -if (err <0 ) - hda->init_failed =1 ;complete_all (&hda->probe_wait);to_hda_bus (bus)->bus_probing =0 ; -return err; +return 0 ; }static void azx_remove (struct pci_dev *pci)
sound/pci/hda/hda_intel.h +1 -0
@@ -27,6 +27,7 @@ struct hda_intel { unsigned int use_vga_switcheroo:1; unsigned int vga_switcheroo_registered:1; unsigned int init_failed:1; /* delayed init failed */ + unsigned int freed:1; /* resources already released */ bool need_i915_power:1; /* the hda controller needs i915 power */ };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/26 ALSA: hda: Keep the controller initialization even if no codecs found
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 9479e75fca370a5220784f7596bf598c4dad0b9b ]
Currently, when the HD-audio controller driver doesn't detect any codecs, it tries to abort the probe. But this abort happens at the delayed probe, i.e. the primary probe call already returned success, hence the driver is never unbound until user does so explicitly. As a result, it may leave the HD-audio device in the running state without the runtime PM. More badly, if the device is a HD-audio bus that is tied with a GPU, GPU cannot reach to the full power down and consumes unnecessarily much power.
This patch changes the logic after no-codec situation; it continues probing without the further codec initialization but keep the controller driver running normally.
--- sound/pci/hda/hda_intel.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
sound/pci/hda/hda_intel.c +7 -5
@@ -1958,7 +1958,7 @@ static int azx_first_init(struct azx *chip)/* codec detection */ if (!azx_bus (chip)->codec_mask) {dev_err (card->dev,"no codecs found!\n" ); -return -ENODEV ; +/* keep running the rest for the runtime PM */ }if (azx_acquire_irq (chip,0 ) <0 )
@@ -2269,9 +2269,11 @@ static int azx_probe_continue(struct azx *chip)#endif /* create codec instances */ - err =azx_probe_codecs (chip, azx_max_codecs[chip->driver_type]); -if (err <0 ) - goto out_free; +if (bus->codec_mask) { + err =azx_probe_codecs (chip, azx_max_codecs[chip->driver_type]); +if (err <0 ) + goto out_free; + }#ifdef CONFIG_SND_HDA_PATCH_LOADER if (chip->fw) {
@@ -2285,7 +2287,7 @@ static int azx_probe_continue(struct azx *chip) #endif }#endif -if ((probe_only[dev] &1 ) ==0 ) { +if (bus->codec_mask && !(probe_only[dev] &1 )) { err =azx_codec_configure (chip);if (err <0 ) goto out_free;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 10/26 ALSA: hda: Skip controller resume if not needed
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit c4c8dd6ef807663e42a5f04ea77cd62029eb99fa ]
The HD-audio controller does system-suspend and resume operations by directly calling its helpers __azx_runtime_suspend() and __azx_runtime_resume(). However, in general, we don't have to resume always the device fully at the system resume; typically, if a device has been runtime-suspended, we can leave it to runtime resume.
Usually for achieving this, the driver would call pm_runtime_force_suspend() and pm_runtime_force_resume() pairs in the system suspend and resume ops. Unfortunately, this doesn't work for the resume path in our case. For handling the jack detection at the system resume, a child codec device may need the (literally) forcibly resume even if it's been runtime-suspended, and for that, the controller device must be also resumed even if it's been suspended.
This patch is an attempt to improve the situation. It replaces the direct __azx_runtime_suspend()/_resume() calls with with pm_runtime_force_suspend() and pm_runtime_force_resume() with a slight trick as we've done for the codec side. More exactly:
- azx_has_pm_runtime() check is dropped from azx_runtime_suspend() and azx_runtime_resume(), so that it can be properly executed from the system-suspend/resume path
- The WAKEEN handling depends on the card's power state now; it's set and cleared only for the runtime-suspend
- azx_resume() checks whether any codec may need the forcible resume beforehand. If the forcible resume is required, it does temporary PM refcount up/down for actually triggering the runtime resume.
- A new helper function, hda_codec_need_resume(), is introduced for checking whether the codec needs a forcible runtime-resume, and the existing code is rewritten with that.
--- include/sound/hda_codec.h | 5 +++++ sound/pci/hda/hda_codec.c | 2 +- sound/pci/hda/hda_intel.c | 38 +++++++++++++++++++++++++++----------- 3 files changed, 33 insertions(+), 12 deletions(-)
include/sound/hda_codec.h +5 -0
@@ -494,6 +494,11 @@ void snd_hda_update_power_acct(struct hda_codec *codec);static inline void snd_hda_set_power_save (struct hda_bus *bus,int delay) {}#endif +static inline bool hda_codec_need_resume (struct hda_codec *codec) +{ +return !codec->relaxed_resume && codec->jacktbl.used; +} +#ifdef CONFIG_SND_HDA_PATCH_LOADER /* * patch firmware
sound/pci/hda/hda_codec.c +1 -1
@@ -2948,7 +2948,7 @@ static int hda_codec_runtime_resume(struct device *dev)static int hda_codec_force_resume (struct device *dev) {struct hda_codec *codec =dev_to_hda_codec (dev); -bool forced_resume = !codec->relaxed_resume && codec->jacktbl.used; +bool forced_resume =hda_codec_need_resume (codec);int ret;/* The get/put pair below enforces the runtime resume even if the
sound/pci/hda/hda_intel.c +27 -11
@@ -1025,7 +1025,7 @@ static int azx_suspend(struct device *dev) chip = card->private_data; bus =azx_bus (chip);snd_power_change_state (card, SNDRV_CTL_POWER_D3hot); -__azx_runtime_suspend (chip); +pm_runtime_force_suspend (dev);if (bus->irq >=0 ) {free_irq (bus->irq, chip); bus->irq =-1 ;
@@ -1041,7 +1041,9 @@ static int azx_suspend(struct device *dev)static int azx_resume (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev); +struct hda_codec *codec;struct azx *chip; +bool forced_resume = false;if (!azx_is_pm_ready (card))return 0 ;
@@ -1052,7 +1054,20 @@ static int azx_resume(struct device *dev) chip->msi =0 ;if (azx_acquire_irq (chip,1 ) <0 )return -EIO ; -__azx_runtime_resume (chip, false); + +/* check for the forced resume */ +list_for_each_codec (codec, &chip->bus) { +if (hda_codec_need_resume (codec)) { + forced_resume = true; +break ; + } + } + +if (forced_resume) +pm_runtime_get_noresume (dev); +pm_runtime_force_resume (dev); +if (forced_resume) +pm_runtime_put (dev);snd_power_change_state (card,SNDRV_CTL_POWER_D0 );trace_azx_resume (chip);
@@ -1099,12 +1114,12 @@ static int azx_runtime_suspend(struct device *dev)if (!azx_is_pm_ready (card))return 0 ; chip = card->private_data; -if (!azx_has_pm_runtime (chip)) -return 0 ;/* enable controller wake up event */ -azx_writew (chip,WAKEEN ,azx_readw (chip,WAKEEN ) | -STATESTS_INT_MASK ); +if (snd_power_get_state (card) ==SNDRV_CTL_POWER_D0 ) { +azx_writew (chip,WAKEEN ,azx_readw (chip,WAKEEN ) | +STATESTS_INT_MASK ); + }__azx_runtime_suspend (chip);trace_azx_runtime_suspend (chip);
@@ -1115,17 +1130,18 @@ static int azx_runtime_resume(struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);struct azx *chip; +bool from_rt =snd_power_get_state (card) ==SNDRV_CTL_POWER_D0 ;if (!azx_is_pm_ready (card))return 0 ; chip = card->private_data; -if (!azx_has_pm_runtime (chip)) -return 0 ; -__azx_runtime_resume (chip, true); +__azx_runtime_resume (chip, from_rt);/* disable controller Wake Up event*/ -azx_writew (chip,WAKEEN ,azx_readw (chip,WAKEEN ) & - ~STATESTS_INT_MASK ); +if (from_rt) { +azx_writew (chip,WAKEEN ,azx_readw (chip,WAKEEN ) & + ~STATESTS_INT_MASK ); + }trace_azx_runtime_resume (chip);return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 11/26 ALSA: hda: Explicitly permit using autosuspend if runtime PM is supported
In reply to Sasha LevinFrom: Roy Spliet <[email protected]>
[ Upstream commit 3ba21113bd33d49f3c300a23fc08cf114c434995 ]
This fixes runtime PM not working after a suspend-to-RAM cycle at least for the codec-less HDA device found on NVIDIA GPUs.
--- sound/pci/hda/hda_intel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +3 -1
@@ -2320,8 +2320,10 @@ static int azx_probe_continue(struct azx *chip)set_default_power_save (chip); -if (azx_has_pm_runtime (chip)) +if (azx_has_pm_runtime (chip)) { +pm_runtime_use_autosuspend (&pci->dev);pm_runtime_put_autosuspend (&pci->dev); + } out_free:if (err <0 ) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/26 scsi: target: fix PR IN / READ FULL STATUS for FC
In reply to Sasha LevinFrom: Bodo Stroesser <[email protected]>
[ Upstream commit 8fed04eb79a74cbf471dfaa755900a51b37273ab ]
Creation of the response to READ FULL STATUS fails for FC based reservations. Reason is the too high loop limit (< 24) in fc_get_pr_transport_id(). The string representation of FC WWPN is 23 chars long only ("11:22:33:44:55:66:77:88"). So when i is 23, the loop body is executed a last time for the ending '\0' of the string and thus hex2bin() reports an error.
--- drivers/target/target_core_fabric_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_fabric_lib.c +1 -1
@@ -63,7 +63,7 @@ static int fc_get_pr_transport_id(* encoded TransportID. */ ptr = &se_nacl->initiatorname[0 ]; -for (i =0 ; i <24 ; ) { +for (i =0 ; i <23 ; ) {if (!strncmp (&ptr[i],":" ,1 )) { i++;continue ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 13/26 scsi: target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN
In reply to Sasha LevinFrom: Bodo Stroesser <[email protected]>
[ Upstream commit 066f79a5fd6d1b9a5cc57b5cd445b3e4bb68a5b2 ]
In case command ring buffer becomes inconsistent, tcmu sets device flag TCMU_DEV_BIT_BROKEN. If the bit is set, tcmu rejects new commands from LIO core with TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, and no longer processes completions from the ring. The reset_ring attribute can be used to completely clean up the command ring, so after reset_ring the ring no longer is inconsistent.
Therefore reset_ring also should reset bit TCMU_DEV_BIT_BROKEN to allow normal processing.
--- drivers/target/target_core_user.c | 1 + 1 file changed, 1 insertion(+)
drivers/target/target_core_user.c +1 -0
@@ -2073,6 +2073,7 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) mb->cmd_tail =0 ; mb->cmd_head =0 ;tcmu_flush_dcache_range (mb,sizeof (*mb)); +clear_bit (TCMU_DEV_BIT_BROKEN , &udev->flags);del_timer (&udev->cmd_timer);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 14/26 objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit bd841d6154f5f41f8a32d3c1b0bc229e326e640a ]
CONFIG_UBSAN_TRAP causes GCC to emit a UD2 whenever it encounters an unreachable code path. This includes __builtin_unreachable(). Because the BUG() macro uses __builtin_unreachable() after it emits its own UD2, this results in a double UD2. In this case objtool rightfully detects that the second UD2 is unreachable:
init/main.o: warning: objtool: repair_env_string()+0x1c8: unreachable instruction
We weren't able to figure out a way to get rid of the double UD2s, so just silence the warning.
--- tools/objtool/check.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
tools/objtool/check.c +15 -2
@@ -2306,14 +2306,27 @@ static bool ignore_unreachable_insn(struct instruction *insn) !strcmp(insn->sec->name, ".altinstr_aux"))return true; +if (!insn->func) +return false; + +/* +* CONFIG_UBSAN_TRAP inserts a UD2 when it sees +* __builtin_unreachable(). The BUG() macro has an unreachable() after +* the UD2, which causes GCC's undefined trap logic to emit another UD2 +* (or occasionally a JMP to UD2). +*/ +if (list_prev_entry (insn, list)->dead_end && + (insn->type ==INSN_BUG || + (insn->type ==INSN_JUMP_UNCONDITIONAL && + insn->jump_dest && insn->jump_dest->type ==INSN_BUG ))) +return true; +/* * Check if this (or a subsequent) instruction is related to * CONFIG_UBSAN or CONFIG_KASAN. * * End the search at 5 instructions to avoid going into the weeds. */ -if (!insn->func) -return false;for (i =0 ; i <5 ; i++) {if (is_kasan_insn (insn) ||is_ubsan_insn (insn))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 15/26 objtool: Support Clang non-section symbols in ORC dump
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 8782e7cab51b6bf01a5a86471dd82228af1ac185 ]
Historically, the relocation symbols for ORC entries have only been section symbols:
.text+0: sp:sp+8 bp:(und) type:call end:0
However, the Clang assembler is aggressive about stripping section symbols. In that case we will need to use function symbols:
freezing_slow_path+0: sp:sp+8 bp:(und) type:call end:0
In preparation for the generation of such entries in "objtool orc generate", add support for reading them in "objtool orc dump".
--- tools/objtool/orc_dump.c | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-)
tools/objtool/orc_dump.c +27 -17
@@ -66,7 +66,7 @@ int orc_dump(const char *_objname)char *name;size_t nr_sections;Elf64_Addr orc_ip_addr =0 ; -size_t shstrtab_idx; +size_t shstrtab_idx, strtab_idx =0 ;Elf *elf;Elf_Scn *scn;GElf_Shdr sh;
@@ -127,6 +127,8 @@ int orc_dump(const char *_objname)if (!strcmp (name,".symtab" )) { symtab = data; + }else if (!strcmp (name,".strtab" )) { + strtab_idx = i; }else if (!strcmp (name,".orc_unwind" )) { orc = data->d_buf; orc_size = sh.sh_size;
@@ -138,7 +140,7 @@ int orc_dump(const char *_objname) } } -if (!symtab || !orc || !orc_ip) +if (!symtab || !strtab_idx || !orc || !orc_ip)return 0 ;if (orc_size %sizeof (*orc) !=0 ) {
@@ -159,21 +161,29 @@ int orc_dump(const char *_objname)return -1 ; } - scn =elf_getscn (elf, sym.st_shndx); -if (!scn) { -WARN_ELF ("elf_getscn" ); -return -1 ; - } - -if (!gelf_getshdr (scn, &sh)) { -WARN_ELF ("gelf_getshdr" ); -return -1 ; - } - - name =elf_strptr (elf, shstrtab_idx, sh.sh_name); -if (!name || !*name) { -WARN_ELF ("elf_strptr" ); -return -1 ; +if (GELF_ST_TYPE (sym.st_info) ==STT_SECTION ) { + scn =elf_getscn (elf, sym.st_shndx); +if (!scn) { +WARN_ELF ("elf_getscn" ); +return -1 ; + } + +if (!gelf_getshdr (scn, &sh)) { +WARN_ELF ("gelf_getshdr" ); +return -1 ; + } + + name =elf_strptr (elf, shstrtab_idx, sh.sh_name); +if (!name) { +WARN_ELF ("elf_strptr" ); +return -1 ; + } + }else { + name =elf_strptr (elf, strtab_idx, sym.st_name); +if (!name) { +WARN_ELF ("elf_strptr" ); +return -1 ; + } }printf ("%s+%llx:" , name, (unsigned long long )rela.r_addend);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 16/26 xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status
In reply to Sasha LevinFrom: Juergen Gross <[email protected]>
[ Upstream commit 6b51fd3f65a22e3d1471b18a1d56247e246edd46 ]
xenbus_map_ring_valloc() maps a ring page and returns the status of the used grant (0 meaning success).
There are Xen hypervisors which might return the value 1 for the status of a failed grant mapping due to a bug. Some callers of xenbus_map_ring_valloc() test for errors by testing the returned status to be less than zero, resulting in no error detected and crashing later due to a not available ring page.
Set the return value of xenbus_map_ring_valloc() to GNTST_general_error in case the grant status reported by Xen is greater than zero.
This is part of XSA-316.
--- drivers/xen/xenbus/xenbus_client.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_client.c +8 -1
@@ -448,7 +448,14 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn);int xenbus_map_ring_valloc (struct xenbus_device *dev,grant_ref_t *gnt_refs,unsigned int nr_grefs,void **vaddr) { -return ring_ops->map (dev, gnt_refs, nr_grefs, vaddr); +int err; + + err = ring_ops->map (dev, gnt_refs, nr_grefs, vaddr); +/* Some hypervisors are buggy and can return 1. */ +if (err >0 ) + err = GNTST_general_error; + +return err; }EXPORT_SYMBOL_GPL (xenbus_map_ring_valloc);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 17/26 ALSA: hda: call runtime_allow() for all hda controllers
In reply to Sasha LevinFrom: Hui Wang <[email protected]>
[ Upstream commit 9a6418487b566503c772cb6e7d3d44e652b019b0 ]
Before the pci_driver->probe() is called, the pci subsystem calls runtime_forbid() and runtime_get_sync() on this pci dev, so only call runtime_put_autosuspend() is not enough to enable the runtime_pm on this device.
For controllers with vgaswitcheroo feature, the pci/quirks.c will call runtime_allow() for this dev, then the controllers could enter rt_idle/suspend/resume, but for non-vgaswitcheroo controllers like Intel hda controllers, the runtime_pm is not enabled because the runtime_allow() is not called.
Since it is no harm calling runtime_allow() twice, here let hda driver call runtime_allow() for all controllers. Then the runtime_pm is enabled on all controllers after the put_autosuspend() is called.
--- sound/pci/hda/hda_intel.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/hda_intel.c +1 -0
@@ -2322,6 +2322,7 @@ static int azx_probe_continue(struct azx *chip)if (azx_has_pm_runtime (chip)) {pm_runtime_use_autosuspend (&pci->dev); +pm_runtime_allow (&pci->dev);pm_runtime_put_autosuspend (&pci->dev); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 18/26 net: stmmac: socfpga: Allow all RGMII modes
In reply to Sasha LevinFrom: Atsushi Nemoto <[email protected]>
[ Upstream commit a7a0d6269652846671312b29992143f56e2866b8 ]
Allow all the RGMII modes to be used. (Not only "rgmii", "rgmii-id" but "rgmii-txid", "rgmii-rxid")
--- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +2 -0
@@ -241,6 +241,8 @@ static int socfpga_set_phy_mode_common(int phymode, u32 *val)switch (phymode) {case PHY_INTERFACE_MODE_RGMII :case PHY_INTERFACE_MODE_RGMII_ID : +case PHY_INTERFACE_MODE_RGMII_RXID : +case PHY_INTERFACE_MODE_RGMII_TXID : *val =SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII ;break ;case PHY_INTERFACE_MODE_MII :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 19/26 net/cxgb4: Check the return from t4_query_params properly
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit c799fca8baf18d1bbbbad6c3b736eefbde8bdb90 ]
Positive return values are also failures that don't set val, although this probably can't happen. Fixes gcc 10 warning:
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c: In function ‘t4_phy_fw_ver’:drivers/net/ethernet/chelsio/cxgb4/t4_hw.c:3747:14: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
3747 | *phy_fw_ver = val;
--- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1 -1
@@ -3748,7 +3748,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver) FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION)); ret =t4_query_params (adap, adap->mbox, adap->pf,0 ,1 , ¶m, &val); -if (ret <0 ) +if (ret)return ret; *phy_fw_ver = val;return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 20/26 mac80211: fix channel switch trigger from unknown mesh peer
In reply to Sasha LevinFrom: Tamizh chelvam <[email protected]>
[ Upstream commit 93e2d04a1888668183f3fb48666e90b9b31d29e6 ]
Previously mesh channel switch happens if beacon contains CSA IE without checking the mesh peer info. Due to that channel switch happens even if the beacon is not from its own mesh peer. Fixing that by checking if the CSA originated from the same mesh network before proceeding for channel switch.
--- net/mac80211/mesh.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/mac80211/mesh.c +7 -4
@@ -1257,15 +1257,15 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, sdata->u.mesh.mshcfg.rssi_threshold < rx_status->signal)mesh_neighbour_update (sdata, mgmt->sa, &elems, rx_status); + +if (ifmsh->csa_role !=IEEE80211_MESH_CSA_ROLE_INIT && + !sdata->vif.csa_active) +ieee80211_mesh_process_chnswitch (sdata, &elems, true); }if (ifmsh->sync_ops) ifmsh->sync_ops->rx_bcn_presp (sdata, stype, mgmt, &elems, rx_status); - -if (ifmsh->csa_role !=IEEE80211_MESH_CSA_ROLE_INIT && - !sdata->vif.csa_active) -ieee80211_mesh_process_chnswitch (sdata, &elems, true); }int ieee80211_mesh_finish_csa (struct ieee80211_sub_if_data *sdata)
@@ -1373,6 +1373,9 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata,ieee802_11_parse_elems (pos, len - baselen, true, &elems, mgmt->bssid,NULL ); +if (!mesh_matches_local (sdata, &elems)) +return ; + ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl;if (!--ifmsh->chsw_ttl) fwd_csa = false;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 21/26 arm64: Delete the space separator in __emit_inst
In reply to Sasha LevinFrom: Fangrui Song <[email protected]>
[ Upstream commit c9a4ef66450145a356a626c833d3d7b1668b3ded ]
In assembly, many instances of __emit_inst(x) expand to a directive. In a few places __emit_inst(x) is used as an assembler macro argument. For example, in arch/arm64/kvm/hyp/entry.S
ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
expands to the following by the C preprocessor:
alternative_insn nop, .inst (0xd500401f | ((0) << 16 | (4) << 5) | ((!!1) << 8)), 4, 1
Both comma and space are separators, with an exception that content inside a pair of parentheses/quotes is not split, so the clang integrated assembler splits the arguments to:
nop, .inst, (0xd500401f | ((0) << 16 | (4) << 5) | ((!!1) << 8)), 4, 1
GNU as preprocesses the input with do_scrub_chars(). Its arm64 backend (along with many other non-x86 backends) sees:
alternative_insn nop,.inst(0xd500401f|((0)<<16|(4)<<5)|((!!1)<<8)),4,1 # .inst(...) is parsed as one argument
while its x86 backend sees:
alternative_insn nop,.inst (0xd500401f|((0)<<16|(4)<<5)|((!!1)<<8)),4,1 # The extra space before '(' makes the whole .inst (...) parsed as two arguments
The non-x86 backend's behavior is considered unintentional
(https://sourceware.org/bugzilla/show_bug.cgi?id=25750).
So drop the space separator inside .inst (...) to make the clang integrated assembler work.
--- arch/arm64/include/asm/sysreg.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/include/asm/sysreg.h +3 -1
@@ -49,7 +49,9 @@#ifndef CONFIG_BROKEN_GAS_INST #ifdef __ASSEMBLY__ -#define __emit_inst (x) .inst (x) +// The space separator is omitted so that __emit_inst(x) can be parsed as +// either an assembler directive or an assembler macro argument. +#define __emit_inst (x) .inst(x)#else #define __emit_inst (x) ".inst " __stringify((x)) "\n\t"#endif
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 22/26 ext4: use matching invalidatepage in ext4_writepage
In reply to Sasha LevinFrom: yangerkun <[email protected]>
[ Upstream commit c2a559bc0e7ed5a715ad6b947025b33cb7c05ea7 ]
Run generic/388 with journal data mode sometimes may trigger the warning in ext4_invalidatepage. Actually, we should use the matching invalidatepage in ext4_writepage.
--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -2131,7 +2131,7 @@ static int ext4_writepage(struct page *page,bool keep_towrite = false;if (unlikely (ext4_forced_shutdown (EXT4_SB (inode->i_sb)))) { -ext4_invalidatepage (page,0 ,PAGE_SIZE ); + inode->i_mapping->a_ops->invalidatepage (page,0 ,PAGE_SIZE );unlock_page (page);return -EIO ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 23/26 ext4: increase wait time needed before reuse of deleted inode numbers
In reply to Sasha LevinFrom: Theodore Ts'o <[email protected]>
[ Upstream commit a17a9d935dc4a50acefaf319d58030f1da7f115a ]
Current wait times have proven to be too short to protect against inode reuses that lead to metadata inconsistencies.
Now that we will retry the inode allocation if we can't find any recently deleted inodes, it's a lot safer to increase the recently deleted time from 5 seconds to a minute.
Google-Bug-Id: 36602237
--- fs/ext4/ialloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ialloc.c +1 -1
@@ -660,7 +660,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent,* block has been written back to disk. (Yes, these values are * somewhat arbitrary...) */ -#define RECENTCY_MIN 5 +#define RECENTCY_MIN 60#define RECENTCY_DIRTY 300static int recently_deleted (struct super_block *sb,ext4_group_t group,int ino)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 24/26 ext4: convert BUG_ON's to WARN_ON's in mballoc.c
In reply to Sasha LevinFrom: Theodore Ts'o <[email protected]>
[ Upstream commit 907ea529fc4c3296701d2bfc8b831dd2a8121a34 ]
If the in-core buddy bitmap gets corrupted (or out of sync with the block bitmap), issue a WARN_ON and try to recover. In most cases this involves skipping trying to allocate out of a particular block group. We can end up declaring the file system corrupted, which is fair, since the file system probably should be checked before we proceed any further.
Google-Bug-Id: 34811296
Google-Bug-Id: 34639169
--- fs/ext4/mballoc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ext4/mballoc.c +4 -2
@@ -1936,7 +1936,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,int free; free = e4b->bd_info->bb_free; -BUG_ON (free <=0 ); +if (WARN_ON (free <=0 )) +return ; i = e4b->bd_info->bb_first_free;
@@ -1959,7 +1960,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, }mb_find_extent (e4b, i, ac->ac_g_ex.fe_len, &ex); -BUG_ON (ex.fe_len <=0 ); +if (WARN_ON (ex.fe_len <=0 )) +break ;if (free < ex.fe_len) {ext4_grp_locked_error (sb, e4b->bd_group,0 ,0 , "%d free clusters as per "
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 25/26 blk-mq: Put driver tag in blk_mq_dispatch_rq_list() when no budget
In reply to Sasha LevinFrom: John Garry <[email protected]>
[ Upstream commit 5fe56de799ad03e92d794c7936bf363922b571df ]
If in blk_mq_dispatch_rq_list() we find no budget, then we break of the dispatch loop, but the request may keep the driver tag, evaulated in 'nxt' in the previous loop iteration.
Fix by putting the driver tag for that request.
--- block/blk-mq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
block/blk-mq.c +3 -1
@@ -1232,8 +1232,10 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, rq = list_first_entry(list, struct request, queuelist); hctx = rq->mq_hctx; -if (!got_budget && !blk_mq_get_dispatch_budget (hctx)) +if (!got_budget && !blk_mq_get_dispatch_budget (hctx)) { +blk_mq_put_driver_tag (rq);break ; + }if (!blk_mq_get_driver_tag (rq)) {/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 26/26 hwmon: (jc42) Fix name to have no illegal characters
In reply to Sasha LevinFrom: Sascha Hauer <[email protected]>
[ Upstream commit c843b382e61b5f28a3d917712c69a344f632387c ]
The jc42 driver passes I2C client's name as hwmon device name. In case of device tree probed devices this ends up being part of the compatible string, "jc-42.4-temp". This name contains hyphens and the hwmon core doesn't like this:
jc42 2-0018: hwmon: 'jc-42.4-temp' is not a valid name attribute, please fix
This changes the name to "jc42" which doesn't have any illegal characters.
--- drivers/hwmon/jc42.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/jc42.c +1 -1
@@ -506,7 +506,7 @@ static int jc42_probe(struct i2c_client *client, const struct i2c_device_id *id) } data->config = config; - hwmon_dev =devm_hwmon_device_register_with_info (dev, client->name, + hwmon_dev =devm_hwmon_device_register_with_info (dev,"jc42" , data, &jc42_chip_info,NULL );return PTR_ERR_OR_ZERO (hwmon_dev);
Signature · 1 line
2.20.1