5.5.6-stable review
Subsystems (10)
Greg Kroah-Hartman
maintainerPATCH 193/399 drm/fbdev: Fallback to non tiled mode if all tiles not present
In reply to Greg Kroah-HartmanFrom: Manasi Navare <[email protected]>
[ Upstream commit f25c7a006cd1c07254780e3406e45cee4842b933 ]
In case of tiled displays, if we hotplug just one connector, fbcon currently just selects the preferred mode and if it is tiled mode then that becomes a problem if rest of the tiles are not present.
So in the fbdev driver on hotplug when we probe the client modeset, if we dont find all the connectors for all tiles, then on a connector with one tile, just fallback to the first available non tiled mode to display over a single connector.
On the hotplug of the consecutive tiled connectors, if the tiled mode no longer exists because of fbcon size limitation, then return no modes for consecutive tiles but retain the non tiled mode on the 0th tile.
Use the same logic in case of connected boot case as well. This has been tested with Dell UP328K tiled monitor.
v2:
* Set the modes on consecutive hotplugged tiles to no mode if tiled mode is pruned (Dave)
v1:
* Just handle the 1st connector hotplug case
* v1 Reviewed-by: Dave Airlie <[email protected]>
--- drivers/gpu/drm/drm_client_modeset.c | 72 ++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
drivers/gpu/drm/drm_client_modeset.c +72 -0
@@ -114,6 +114,33 @@ drm_client_find_modeset(struct drm_client_dev *client, struct drm_crtc *crtc)return NULL ; } +static struct drm_display_mode * +drm_connector_get_tiled_mode (struct drm_connector *connector) +{ +struct drm_display_mode *mode; + +list_for_each_entry (mode, &connector->modes, head) { +if (mode->hdisplay == connector->tile_h_size && + mode->vdisplay == connector->tile_v_size) +return mode; + } +return NULL ; +} + +static struct drm_display_mode * +drm_connector_fallback_non_tiled_mode (struct drm_connector *connector) +{ +struct drm_display_mode *mode; + +list_for_each_entry (mode, &connector->modes, head) { +if (mode->hdisplay == connector->tile_h_size && + mode->vdisplay == connector->tile_v_size) +continue ; +return mode; + } +return NULL ; +} +static struct drm_display_mode *drm_connector_has_preferred_mode (struct drm_connector *connector,int width,int height) {
@@ -348,8 +375,15 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,struct drm_connector *connector;u64 conn_configured =0 ;int tile_pass =0 ; +int num_tiled_conns =0 ;int i; +for (i =0 ; i < connector_count; i++) { +if (connectors[i]->has_tile && + connectors[i]->status == connector_status_connected) + num_tiled_conns++; + } + retry:for (i =0 ; i < connector_count; i++) { connector = connectors[i];
@@ -399,6 +433,28 @@ retry:list_for_each_entry (modes[i], &connector->modes, head)break ; } +/* +* In case of tiled mode if all tiles not present fallback to +* first available non tiled mode. +* After all tiles are present, try to find the tiled mode +* for all and if tiled mode not present due to fbcon size +* limitations, use first non tiled mode only for +* tile 0,0 and set to no mode for all other tiles. +*/ +if (connector->has_tile) { +if (num_tiled_conns < + connector->num_h_tile * connector->num_v_tile || + (connector->tile_h_loc ==0 && + connector->tile_v_loc ==0 && + !drm_connector_get_tiled_mode (connector))) { +DRM_DEBUG_KMS ("Falling back to non tiled mode on Connector %d\n" , + connector->base.id); + modes[i] =drm_connector_fallback_non_tiled_mode (connector); + }else { + modes[i] =drm_connector_get_tiled_mode (connector); + } + } +DRM_DEBUG_KMS ("found mode %s\n" , modes[i] ? modes[i]->name :"none" ); conn_configured |=BIT_ULL (i);
@@ -515,6 +571,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,bool fallback = true, ret = true;int num_connectors_enabled =0 ;int num_connectors_detected =0 ; +int num_tiled_conns =0 ;struct drm_modeset_acquire_ctx ctx;if (!drm_drv_uses_atomic_modeset (dev))
@@ -532,6 +589,11 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,memcpy (save_enabled, enabled, count); mask =GENMASK (count -1 ,0 ); conn_configured =0 ; +for (i =0 ; i < count; i++) { +if (connectors[i]->has_tile && + connectors[i]->status == connector_status_connected) + num_tiled_conns++; + } retry: conn_seq = conn_configured;for (i =0 ; i < count; i++) {
@@ -631,6 +693,16 @@ retry: connector->name); modes[i] = &connector->state->crtc->mode; } +/* +* In case of tiled modes, if all tiles are not present +* then fallback to a non tiled mode. +*/ +if (connector->has_tile && + num_tiled_conns < connector->num_h_tile * connector->num_v_tile) { +DRM_DEBUG_KMS ("Falling back to non tiled mode on Connector %d\n" , + connector->base.id); + modes[i] =drm_connector_fallback_non_tiled_mode (connector); + } crtcs[i] = new_crtc; DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 152/399 PCI: Add nr_devfns parameter to pci_add_dma_alias()
In reply to Greg Kroah-HartmanFrom: James Sewart <[email protected]>
[ Upstream commit 09298542cd891b43778db1f65aa3613aa5a562eb ]
Add a "nr_devfns" parameter to pci_add_dma_alias() so it can be used to create DMA aliases for a range of devfns.
[bhelgaas: incorporate nr_devfns fix from James, update quirk_pex_vca_alias() and setup_aliases()]
--- drivers/iommu/amd_iommu.c | 7 ++----- drivers/pci/pci.c | 22 +++++++++++++++++----- drivers/pci/quirks.c | 23 +++++++++-------------- include/linux/pci.h | 2 +- 4 files changed, 29 insertions(+), 25 deletions(-)
drivers/iommu/amd_iommu.c +2 -5
@@ -230,11 +230,8 @@ static struct pci_dev *setup_aliases(struct device *dev)*/ ivrs_alias = amd_iommu_alias_table[pci_dev_id (pdev)];if (ivrs_alias !=pci_dev_id (pdev) && -PCI_BUS_NUM (ivrs_alias) == pdev->bus->number) { -pci_add_dma_alias (pdev, ivrs_alias &0xff ); -pci_info (pdev,"Added PCI DMA alias %02x.%d\n" , -PCI_SLOT (ivrs_alias),PCI_FUNC (ivrs_alias)); - } +PCI_BUS_NUM (ivrs_alias) == pdev->bus->number) +pci_add_dma_alias (pdev, ivrs_alias &0xff ,1 );clone_aliases (pdev);
drivers/pci/pci.c +17 -5
@@ -5998,7 +5998,8 @@ EXPORT_SYMBOL_GPL(pci_pr3_present);/** * pci_add_dma_alias - Add a DMA devfn alias for a device * @dev: the PCI device for which alias is added -* @devfn: alias slot and function +* @devfn_from: alias slot and function +* @nr_devfns: number of subsequent devfns to alias * * This helper encodes an 8-bit devfn as a bit number in dma_alias_mask * which is used to program permissible bus-devfn source addresses for DMA
@@ -6014,8 +6015,13 @@ EXPORT_SYMBOL_GPL(pci_pr3_present);* cannot be left as a userspace activity). DMA aliases should therefore * be configured via quirks, such as the PCI fixup header quirk. */ -void pci_add_dma_alias (struct pci_dev *dev,u8 devfn) +void pci_add_dma_alias (struct pci_dev *dev,u8 devfn_from,unsigned nr_devfns) { +int devfn_to; + + nr_devfns =min (nr_devfns, (unsigned )MAX_NR_DEVFNS - devfn_from); + devfn_to = devfn_from + nr_devfns -1 ; +if (!dev->dma_alias_mask) dev->dma_alias_mask =bitmap_zalloc (MAX_NR_DEVFNS ,GFP_KERNEL );if (!dev->dma_alias_mask) {
@@ -6023,9 +6029,15 @@ void pci_add_dma_alias(struct pci_dev *dev, u8 devfn)return ; } -set_bit (devfn, dev->dma_alias_mask); -pci_info (dev,"Enabling fixed DMA alias to %02x.%d\n" , -PCI_SLOT (devfn),PCI_FUNC (devfn)); +bitmap_set (dev->dma_alias_mask, devfn_from, nr_devfns); + +if (nr_devfns ==1 ) +pci_info (dev,"Enabling fixed DMA alias to %02x.%d\n" , +PCI_SLOT (devfn_from),PCI_FUNC (devfn_from)); +else if (nr_devfns >1 ) +pci_info (dev,"Enabling fixed DMA alias for devfn range from %02x.%d to %02x.%d\n" , +PCI_SLOT (devfn_from),PCI_FUNC (devfn_from), +PCI_SLOT (devfn_to),PCI_FUNC (devfn_to)); }bool pci_devs_are_dma_aliases (struct pci_dev *dev1,struct pci_dev *dev2)
drivers/pci/quirks.c +9 -14
@@ -3927,7 +3927,7 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)static void quirk_dma_func0_alias (struct pci_dev *dev) {if (PCI_FUNC (dev->devfn) !=0 ) -pci_add_dma_alias (dev,PCI_DEVFN (PCI_SLOT (dev->devfn),0 )); +pci_add_dma_alias (dev,PCI_DEVFN (PCI_SLOT (dev->devfn),0 ),1 ); }/*
@@ -3941,7 +3941,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias);static void quirk_dma_func1_alias (struct pci_dev *dev) {if (PCI_FUNC (dev->devfn) !=1 ) -pci_add_dma_alias (dev,PCI_DEVFN (PCI_SLOT (dev->devfn),1 )); +pci_add_dma_alias (dev,PCI_DEVFN (PCI_SLOT (dev->devfn),1 ),1 ); }/*
@@ -4026,7 +4026,7 @@ static void quirk_fixed_dma_alias(struct pci_dev *dev) id =pci_match_id (fixed_dma_alias_tbl, dev);if (id) -pci_add_dma_alias (dev, id->driver_data); +pci_add_dma_alias (dev, id->driver_data,1 ); }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ADAPTEC2 ,0x0285 , quirk_fixed_dma_alias);
@@ -4067,9 +4067,9 @@ DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias);*/ static void quirk_mic_x200_dma_alias (struct pci_dev *pdev) { -pci_add_dma_alias (pdev,PCI_DEVFN (0x10 ,0x0 )); -pci_add_dma_alias (pdev,PCI_DEVFN (0x11 ,0x0 )); -pci_add_dma_alias (pdev,PCI_DEVFN (0x12 ,0x3 )); +pci_add_dma_alias (pdev,PCI_DEVFN (0x10 ,0x0 ),1 ); +pci_add_dma_alias (pdev,PCI_DEVFN (0x11 ,0x0 ),1 ); +pci_add_dma_alias (pdev,PCI_DEVFN (0x12 ,0x3 ),1 ); }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2260 , quirk_mic_x200_dma_alias);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2264 , quirk_mic_x200_dma_alias);
@@ -4093,13 +4093,8 @@ static void quirk_pex_vca_alias(struct pci_dev *pdev)const unsigned int num_pci_slots =0x20 ;unsigned int slot; -for (slot =0 ; slot < num_pci_slots; slot++) { -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x0 )); -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x1 )); -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x2 )); -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x3 )); -pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x4 )); - } +for (slot =0 ; slot < num_pci_slots; slot++) +pci_add_dma_alias (pdev,PCI_DEVFN (slot,0x0 ),5 ); }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2954 , quirk_pex_vca_alias);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x2955 , quirk_pex_vca_alias);
@@ -5334,7 +5329,7 @@ static void quirk_switchtec_ntb_dma_alias(struct pci_dev *pdev)pci_dbg (pdev,"Aliasing Partition %d Proxy ID %02x.%d\n" , pp,PCI_SLOT (devfn),PCI_FUNC (devfn)); -pci_add_dma_alias (pdev, devfn); +pci_add_dma_alias (pdev, devfn,1 ); } }
include/linux/pci.h +1 -1
@@ -2310,7 +2310,7 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev) }#endif -void pci_add_dma_alias (struct pci_dev *dev,u8 devfn); +void pci_add_dma_alias (struct pci_dev *dev,u8 devfn_from,unsigned nr_devfns);bool pci_devs_are_dma_aliases (struct pci_dev *dev1,struct pci_dev *dev2); int pci_for_each_dma_alias(struct pci_dev *pdev, int (*fn)(struct pci_dev *pdev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 203/399 clk: uniphier: Add SCSSI clock gate for each channel
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit 1ec09a2ec67a0baa46a3ccac041dbcdbc6db2cb9 ]
SCSSI has clock gates for each channel in the SoCs newer than Pro4, so this adds missing clock gates for channel 1, 2 and 3. And more, this moves MCSSI clock ID after SCSSI.
--- drivers/clk/uniphier/clk-uniphier-peri.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/clk/uniphier/clk-uniphier-peri.c +8 -5
@@ -18,8 +18,8 @@#define UNIPHIER_PERI_CLK_FI2C (idx, ch) \ UNIPHIER_CLK_GATE("i2c" #ch, (idx), "i2c", 0x24, 24 + (ch)) -#define UNIPHIER_PERI_CLK_SCSSI (idx) \ - UNIPHIER_CLK_GATE("scssi", (idx), "spi", 0x20, 17) +#define UNIPHIER_PERI_CLK_SCSSI (idx, ch) \ + UNIPHIER_CLK_GATE("scssi" #ch, (idx), "spi", 0x20, 17 + (ch))#define UNIPHIER_PERI_CLK_MCSSI (idx) \ UNIPHIER_CLK_GATE("mcssi", (idx), "spi", 0x24, 14)
@@ -35,7 +35,7 @@ const struct uniphier_clk_data uniphier_ld4_peri_clk_data[] = {UNIPHIER_PERI_CLK_I2C (6 ,2 ),UNIPHIER_PERI_CLK_I2C (7 ,3 ),UNIPHIER_PERI_CLK_I2C (8 ,4 ), - UNIPHIER_PERI_CLK_SCSSI(11), + UNIPHIER_PERI_CLK_SCSSI(11, 0), { /* sentinel */ } };
@@ -51,7 +51,10 @@ const struct uniphier_clk_data uniphier_pro4_peri_clk_data[] = {UNIPHIER_PERI_CLK_FI2C (8 ,4 ),UNIPHIER_PERI_CLK_FI2C (9 ,5 ),UNIPHIER_PERI_CLK_FI2C (10 ,6 ), -UNIPHIER_PERI_CLK_SCSSI (11 ), - UNIPHIER_PERI_CLK_MCSSI(12), +UNIPHIER_PERI_CLK_SCSSI (11 ,0 ), +UNIPHIER_PERI_CLK_SCSSI (12 ,1 ), +UNIPHIER_PERI_CLK_SCSSI (13 ,2 ), +UNIPHIER_PERI_CLK_SCSSI (14 ,3 ), + UNIPHIER_PERI_CLK_MCSSI(15), { /* sentinel */ } };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 205/399 ALSA: sh: Fix compile warning wrt const
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit f1dd4795b1523fbca7ab4344dd5a8bb439cc770d ]
A long-standing compile warning was seen during build test:
sound/sh/aica.c: In function 'load_aica_firmware':
sound/sh/aica.c:521:25: warning: passing argument 2 of 'spu_memload' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
--- sound/sh/aica.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/sh/aica.c +2 -2
@@ -101,10 +101,10 @@ static void spu_memset(u32 toi, u32 what, int length) }/* spu_memload - write to SPU address space */ -static void spu_memload (u32 toi,void *from,int length) +static void spu_memload (u32 toi,const void *from,int length) {unsigned long flags; -u32 *froml = from; +const u32 *froml = from;u32 __iomem *to = (u32 __iomem *) (SPU_MEMORY_BASE + toi);int i;u32 val;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 206/399 net: phy: fixed_phy: fix use-after-free when checking link GPIO
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit d266f19f3ae7fbcaf92229639b78d2110ae44f33 ]
If we fail to locate GPIO for any reason other than deferral or not-found-GPIO, we try to print device tree node info, however if might be freed already as we called of_node_put() on it.
--- drivers/net/phy/fixed_phy.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/phy/fixed_phy.c +2 -5
@@ -212,16 +212,13 @@ static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np)*/ gpiod =gpiod_get_from_of_node (fixed_link_node,"link-gpios" ,0 ,GPIOD_IN ,"mdio" ); -of_node_put (fixed_link_node); -if (IS_ERR (gpiod)) { -if (PTR_ERR (gpiod) == -EPROBE_DEFER ) -return gpiod; - +if (IS_ERR (gpiod) &&PTR_ERR (gpiod) != -EPROBE_DEFER ) {if (PTR_ERR (gpiod) != -ENOENT )pr_err ("error getting GPIO for fixed link %pOF, proceed without\n" , fixed_link_node); gpiod =NULL ; } +of_node_put (fixed_link_node);return gpiod; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 208/399 vfio/spapr/nvlink2: Skip unpinning pages on error exit
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
[ Upstream commit 338b4e10f939a71194d8ecef7ece205a942cec05 ]
The nvlink2 subdriver for IBM Witherspoon machines preregisters GPU memory in the IOMMI API so KVM TCE code can map this memory for DMA as well. This is done by mm_iommu_newdev() called from vfio_pci_nvgpu_regops::mmap.
In an unlikely event of failure the data->mem remains NULL and since mm_iommu_put() (which unregisters the region and unpins memory if that was regular memory) does not expect mem=NULL, it should not be called.
This adds a check to only call mm_iommu_put() for a valid data->mem.
--- drivers/vfio/pci/vfio_pci_nvlink2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/vfio/pci/vfio_pci_nvlink2.c +4 -2
@@ -97,8 +97,10 @@ static void vfio_pci_nvgpu_release(struct vfio_pci_device *vdev,/* If there were any mappings at all... */ if (data->mm) { - ret =mm_iommu_put (data->mm, data->mem); -WARN_ON (ret); +if (data->mem) { + ret =mm_iommu_put (data->mm, data->mem); +WARN_ON (ret); + }mmdrop (data->mm); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 209/399 ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isnt one.
In reply to Greg Kroah-HartmanFrom: Sam McNally <[email protected]>
[ Upstream commit d4b74e218a8d0d6cf58e546627ab9d4d4f2645ab ]
Some members of the Google_Hatch family include a rt5682 jack codec, but no speaker amplifier. This uses the same driver (sof_rt5682) as a combination of rt5682 jack codec and max98357a speaker amplifier. Within the sof_rt5682 driver, these cases are not currently distinguishable, relying on a DMI quirk to decide the configuration. This causes an incorrect configuration when only the rt5682 is present on a Google_Hatch device.
For CML, the jack codec is used as the primary key when matching, with a possible speaker amplifier described in quirk_data. The two cases of interest are the second and third 10EC5682 entries in snd_soc_acpi_intel_cml_machines[]. The second entry matches the combination of rt5682 and max98357a, resulting in the quirk_data field in the snd_soc_acpi_mach being non-null, pointing at max98357a_spk_codecs, the snd_soc_acpi_codecs for the matched speaker amplifier. The third entry matches just the rt5682, resulting in a null quirk_data.
The sof_rt5682 driver's DMI data matching identifies that a speaker amplifier is present for all Google_Hatch family devices. Detect cases where there is no speaker amplifier by checking for a null quirk_data in the snd_soc_acpi_mach and remove the speaker amplifier bit in that case.
--- sound/soc/intel/boards/sof_rt5682.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/soc/intel/boards/sof_rt5682.c +8 -1
@@ -603,6 +603,14 @@ static int sof_audio_probe(struct platform_device *pdev)dmi_check_system (sof_rt5682_quirk_table); + mach = (&pdev->dev)->platform_data; + +/* A speaker amp might not be present when the quirk claims one is. +* Detect this via whether the machine driver match includes quirk_data. +*/ +if ((sof_rt5682_quirk &SOF_SPEAKER_AMP_PRESENT ) && !mach->quirk_data) + sof_rt5682_quirk &= ~SOF_SPEAKER_AMP_PRESENT ; +if (soc_intel_is_byt () ||soc_intel_is_cht ()) { is_legacy_cpu =1 ; dmic_be_num =0 ;
@@ -663,7 +671,6 @@ static int sof_audio_probe(struct platform_device *pdev)INIT_LIST_HEAD (&ctx->hdmi_pcm_list); sof_audio_card_rt5682.dev = &pdev->dev; - mach = (&pdev->dev)->platform_data;/* set platform name for each dailink */ ret = snd_soc_fixup_dai_links_platform_name(&sof_audio_card_rt5682,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 210/399 x86/unwind/orc: Fix !CONFIG_MODULES build warning
In reply to Greg Kroah-HartmanFrom: Shile Zhang <[email protected]>
[ Upstream commit 22a7fa8848c5e881d87ef2f7f3c2ea77b286e6f9 ]
To fix follwowing warning due to ORC sort moved to build time:
arch/x86/kernel/unwind_orc.c:210:12: warning: ‘orc_sort_cmp’ defined but not used [-Wunused-function] arch/x86/kernel/unwind_orc.c:190:13: warning: ‘orc_sort_swap’ defined but not used [-Wunused-function]
--- arch/x86/kernel/unwind_orc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/unwind_orc.c +2 -1
@@ -187,6 +187,8 @@ static struct orc_entry *orc_find(unsigned long ip)return orc_ftrace_find (ip); } +#ifdef CONFIG_MODULES +static void orc_sort_swap (void *_a,void *_b,int size) {struct orc_entry *orc_a, *orc_b;
@@ -229,7 +231,6 @@ static int orc_sort_cmp(const void *_a, const void *_b)return orc_a->sp_reg ==ORC_REG_UNDEFINED && !orc_a->end ?-1 :1 ; } -#ifdef CONFIG_MODULES void unwind_module_init (struct module *mod,void *_orc_ip,size_t orc_ip_size,void *_orc,size_t orc_size) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 194/399 pinctrl: sh-pfc: sh7269: Fix CAN function GPIOs
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 02aeb2f21530c98fc3ca51028eda742a3fafbd9f ]
pinmux_func_gpios[] contains a hole due to the missing function GPIO definition for the "CTX0&CTX1" signal, which is the logical "AND" of the first two CAN outputs.
A closer look reveals other issues:
- Some functionality is available on alternative pins, but the PINMUX_DATA() entries is using the wrong marks,
- Several configurations are missing.
Fix this by:
- Renaming CTX0CTX1CTX2_MARK, CRX0CRX1_PJ22_MARK, and CRX0CRX1CRX2_PJ20_MARK to CTX0_CTX1_CTX2_MARK, CRX0_CRX1_PJ22_MARK, resp. CRX0_CRX1_CRX2_PJ20_MARK for consistency with the corresponding enum IDs,
- Adding all missing enum IDs and marks,
- Use the right (*_PJ2x) variants for alternative pins,
- Adding all missing configurations to pinmux_data[],
- Adding all missing function GPIO definitions to pinmux_func_gpios[].
See SH7268 Group, SH7269 Group User’s Manual: Hardware, Rev. 2.00:
[1] Table 1.4 List of Pins
[2] Figure 23.29 Connection Example when Using Channels 0 and 1 as One Channel (64 Mailboxes × 1 Channel) and Channel 2 as One Channel (32 Mailboxes × 1 Channel),
[3] Figure 23.30 Connection Example when Using Channels 0, 1, and 2 as One Channel (96 Mailboxes × 1 Channel),
[4] Table 48.3 Multiplexed Pins (Port B),
[5] Table 48.4 Multiplexed Pins (Port C),
[6] Table 48.10 Multiplexed Pins (Port J),
[7] Section 48.2.4 Port B Control Registers 0 to 5 (PBCR0 to PBCR5).
--- arch/sh/include/cpu-sh2a/cpu/sh7269.h | 11 ++++++-- drivers/pinctrl/sh-pfc/pfc-sh7269.c | 39 ++++++++++++++++++--------- 2 files changed, 36 insertions(+), 14 deletions(-)
arch/sh/include/cpu-sh2a/cpu/sh7269.h +9 -2
@@ -78,8 +78,15 @@ enum {GPIO_FN_WDTOVF ,/* CAN */ -GPIO_FN_CTX1 ,GPIO_FN_CRX1 ,GPIO_FN_CTX0 ,GPIO_FN_CTX0_CTX1 , -GPIO_FN_CRX0 ,GPIO_FN_CRX0_CRX1 ,GPIO_FN_CRX0_CRX1_CRX2 , +GPIO_FN_CTX2 ,GPIO_FN_CRX2 , +GPIO_FN_CTX1 ,GPIO_FN_CRX1 , +GPIO_FN_CTX0 ,GPIO_FN_CRX0 , +GPIO_FN_CTX0_CTX1 ,GPIO_FN_CRX0_CRX1 , +GPIO_FN_CTX0_CTX1_CTX2 ,GPIO_FN_CRX0_CRX1_CRX2 , +GPIO_FN_CTX2_PJ21 ,GPIO_FN_CRX2_PJ20 , +GPIO_FN_CTX1_PJ23 ,GPIO_FN_CRX1_PJ22 , +GPIO_FN_CTX0_CTX1_PJ23 ,GPIO_FN_CRX0_CRX1_PJ22 , +GPIO_FN_CTX0_CTX1_CTX2_PJ21 ,GPIO_FN_CRX0_CRX1_CRX2_PJ20 ,/* DMAC */ GPIO_FN_TEND0, GPIO_FN_DACK0, GPIO_FN_DREQ0,
drivers/pinctrl/sh-pfc/pfc-sh7269.c +27 -12
@@ -737,13 +737,12 @@ enum {CRX0_MARK ,CTX0_MARK ,CRX1_MARK ,CTX1_MARK ,CRX2_MARK ,CTX2_MARK , -CRX0_CRX1_MARK , -CRX0_CRX1_CRX2_MARK , -CTX0CTX1CTX2_MARK , +CRX0_CRX1_MARK ,CTX0_CTX1_MARK , +CRX0_CRX1_CRX2_MARK ,CTX0_CTX1_CTX2_MARK ,CRX1_PJ22_MARK ,CTX1_PJ23_MARK ,CRX2_PJ20_MARK ,CTX2_PJ21_MARK , -CRX0CRX1_PJ22_MARK , -CRX0CRX1CRX2_PJ20_MARK , +CRX0_CRX1_PJ22_MARK ,CTX0_CTX1_PJ23_MARK , +CRX0_CRX1_CRX2_PJ20_MARK ,CTX0_CTX1_CTX2_PJ21_MARK ,/* VDC */ DV_CLK_MARK,
@@ -821,6 +820,7 @@ static const u16 pinmux_data[] = {PINMUX_DATA (CS3_MARK ,PC8MD_001 ),PINMUX_DATA (TXD7_MARK ,PC8MD_010 ),PINMUX_DATA (CTX1_MARK ,PC8MD_011 ), +PINMUX_DATA (CTX0_CTX1_MARK ,PC8MD_100 ),PINMUX_DATA (PC7_DATA ,PC7MD_000 ), PINMUX_DATA(CKE_MARK, PC7MD_001),
@@ -833,11 +833,12 @@ static const u16 pinmux_data[] = {PINMUX_DATA (CAS_MARK ,PC6MD_001 ),PINMUX_DATA (SCK7_MARK ,PC6MD_010 ),PINMUX_DATA (CTX0_MARK ,PC6MD_011 ), +PINMUX_DATA (CTX0_CTX1_CTX2_MARK ,PC6MD_100 ),PINMUX_DATA (PC5_DATA ,PC5MD_000 ),PINMUX_DATA (RAS_MARK ,PC5MD_001 ),PINMUX_DATA (CRX0_MARK ,PC5MD_011 ), -PINMUX_DATA (CTX0CTX1CTX2_MARK ,PC5MD_100 ), +PINMUX_DATA (CTX0_CTX1_CTX2_MARK ,PC5MD_100 ),PINMUX_DATA (IRQ0_PC_MARK ,PC5MD_101 ), PINMUX_DATA(PC4_DATA, PC4MD_00),
@@ -1289,30 +1290,32 @@ static const u16 pinmux_data[] = {PINMUX_DATA (LCD_DATA23_PJ23_MARK ,PJ23MD_010 ),PINMUX_DATA (LCD_TCON6_MARK ,PJ23MD_011 ),PINMUX_DATA (IRQ3_PJ_MARK ,PJ23MD_100 ), -PINMUX_DATA (CTX1_MARK ,PJ23MD_101 ), +PINMUX_DATA (CTX1_PJ23_MARK ,PJ23MD_101 ), +PINMUX_DATA (CTX0_CTX1_PJ23_MARK ,PJ23MD_110 ),PINMUX_DATA (PJ22_DATA ,PJ22MD_000 ),PINMUX_DATA (DV_DATA22_MARK ,PJ22MD_001 ),PINMUX_DATA (LCD_DATA22_PJ22_MARK ,PJ22MD_010 ),PINMUX_DATA (LCD_TCON5_MARK ,PJ22MD_011 ),PINMUX_DATA (IRQ2_PJ_MARK ,PJ22MD_100 ), -PINMUX_DATA (CRX1_MARK ,PJ22MD_101 ), -PINMUX_DATA (CRX0_CRX1_MARK ,PJ22MD_110 ), +PINMUX_DATA (CRX1_PJ22_MARK ,PJ22MD_101 ), +PINMUX_DATA (CRX0_CRX1_PJ22_MARK ,PJ22MD_110 ),PINMUX_DATA (PJ21_DATA ,PJ21MD_000 ),PINMUX_DATA (DV_DATA21_MARK ,PJ21MD_001 ),PINMUX_DATA (LCD_DATA21_PJ21_MARK ,PJ21MD_010 ),PINMUX_DATA (LCD_TCON4_MARK ,PJ21MD_011 ),PINMUX_DATA (IRQ1_PJ_MARK ,PJ21MD_100 ), -PINMUX_DATA (CTX2_MARK ,PJ21MD_101 ), +PINMUX_DATA (CTX2_PJ21_MARK ,PJ21MD_101 ), +PINMUX_DATA (CTX0_CTX1_CTX2_PJ21_MARK ,PJ21MD_110 ),PINMUX_DATA (PJ20_DATA ,PJ20MD_000 ),PINMUX_DATA (DV_DATA20_MARK ,PJ20MD_001 ),PINMUX_DATA (LCD_DATA20_PJ20_MARK ,PJ20MD_010 ),PINMUX_DATA (LCD_TCON3_MARK ,PJ20MD_011 ),PINMUX_DATA (IRQ0_PJ_MARK ,PJ20MD_100 ), -PINMUX_DATA (CRX2_MARK ,PJ20MD_101 ), -PINMUX_DATA (CRX0CRX1CRX2_PJ20_MARK ,PJ20MD_110 ), +PINMUX_DATA (CRX2_PJ20_MARK ,PJ20MD_101 ), +PINMUX_DATA (CRX0_CRX1_CRX2_PJ20_MARK ,PJ20MD_110 ),PINMUX_DATA (PJ19_DATA ,PJ19MD_000 ), PINMUX_DATA(DV_DATA19_MARK, PJ19MD_001),
@@ -1663,12 +1666,24 @@ static const struct pinmux_func pinmux_func_gpios[] = {GPIO_FN (WDTOVF ),/* CAN */ +GPIO_FN (CTX2 ), +GPIO_FN (CRX2 ),GPIO_FN (CTX1 ),GPIO_FN (CRX1 ),GPIO_FN (CTX0 ),GPIO_FN (CRX0 ), +GPIO_FN (CTX0_CTX1 ),GPIO_FN (CRX0_CRX1 ), +GPIO_FN (CTX0_CTX1_CTX2 ),GPIO_FN (CRX0_CRX1_CRX2 ), +GPIO_FN (CTX2_PJ21 ), +GPIO_FN (CRX2_PJ20 ), +GPIO_FN (CTX1_PJ23 ), +GPIO_FN (CRX1_PJ22 ), +GPIO_FN (CTX0_CTX1_PJ23 ), +GPIO_FN (CRX0_CRX1_PJ22 ), +GPIO_FN (CTX0_CTX1_CTX2_PJ21 ), +GPIO_FN (CRX0_CRX1_CRX2_PJ20 ),/* DMAC */ GPIO_FN(TEND0),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 213/399 iommu/vt-d: Avoid sending invalid page response
In reply to Greg Kroah-HartmanFrom: Jacob Pan <[email protected]>
[ Upstream commit 5f75585e19cc7018bf2016aa771632081ee2f313 ]
Page responses should only be sent when last page in group (LPIG) or private data is present in the page request. This patch avoids sending invalid descriptors.
--- drivers/iommu/intel-svm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iommu/intel-svm.c +3 -4
@@ -654,11 +654,10 @@ static irqreturn_t prq_event_thread(int irq, void *d)if (req->priv_data_present)memcpy (&resp.qw2, req->priv_data,sizeof (req->priv_data)); + resp.qw2 =0 ; + resp.qw3 =0 ; +qi_submit_sync (&resp, iommu); } - resp.qw2 =0 ; - resp.qw3 =0 ; -qi_submit_sync (&resp, iommu); - head = (head +sizeof (*req)) &PRQ_RING_MASK ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 215/399 mlx5: work around high stack usage with gcc
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 42ae1a5c76691928ed217c7e40269db27f5225e9 ]
In some configurations, gcc tries too hard to optimize this code:
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c: In function 'mlx5e_grp_sw_update_stats':drivers/net/ethernet/mellanox/mlx5/core/en_stats.c:302:1: error: the frame size of 1336 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
As was stated in the bug report, the reason is that gcc runs into a corner case in the register allocator that is rather hard to fix in a good way.
As there is an easy way to work around it, just add a comment and the barrier that stops gcc from trying to overoptimize the function.
--- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +3 -0
@@ -297,6 +297,9 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) s->tx_tls_drop_bypass_req += sq_stats->tls_drop_bypass_req;#endif s->tx_cqes += sq_stats->cqes; + +/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657 */ +barrier (); } } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 217/399 drm: remove the newline for CRC source name.
In reply to Greg Kroah-HartmanFrom: Dingchen Zhang <[email protected]>
[ Upstream commit 72a848f5c46bab4c921edc9cbffd1ab273b2be17 ]
userspace may transfer a newline, and this terminating newline is replaced by a '\0' to avoid followup issues.
'len-1' is the index to replace the newline of CRC source name.
v3: typo fix (Sam)
v2: update patch subject, body and format. (Sam)
--- drivers/gpu/drm/drm_debugfs_crc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_debugfs_crc.c +2 -2
@@ -140,8 +140,8 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf,if (IS_ERR (source))return PTR_ERR (source); -if (source[len] =='\n' ) - source[len] ='\0' ; +if (source[len -1 ] =='\n' ) + source[len -1 ] ='\0' ; ret = crtc->funcs->verify_crc_source (crtc, source, &values_cnt);if (ret)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 218/399 usb: dwc3: use proper initializers for property entries
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 5eb5afb07853d6e90d3a2b230c825e028e948f79 ]
We should not be reaching into property entries and initialize them by hand, but rather use proper initializer macros. This way we can alter internal representation of property entries with no visible changes to their users.
--- drivers/usb/dwc3/host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/dwc3/host.c +3 -3
@@ -88,10 +88,10 @@ int dwc3_host_init(struct dwc3 *dwc)memset (props,0 ,sizeof (struct property_entry ) *ARRAY_SIZE (props));if (dwc->usb3_lpm_capable) - props[prop_idx++].name ="usb3-lpm-capable" ; + props[prop_idx++] =PROPERTY_ENTRY_BOOL ("usb3-lpm-capable" );if (dwc->usb2_lpm_disable) - props[prop_idx++].name ="usb2-lpm-disable" ; + props[prop_idx++] =PROPERTY_ENTRY_BOOL ("usb2-lpm-disable" );/** * WORKAROUND: dwc3 revisions <=3.00a have a limitation
@@ -103,7 +103,7 @@ int dwc3_host_init(struct dwc3 *dwc)* This following flag tells XHCI to do just that. */ if (dwc->revision <=DWC3_REVISION_300A ) - props[prop_idx++].name ="quirk-broken-port-ped" ; + props[prop_idx++] =PROPERTY_ENTRY_BOOL ("quirk-broken-port-ped" );if (prop_idx) { ret =platform_device_add_properties (xhci, props);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 195/399 reset: uniphier: Add SCSSI reset control for each channel
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit f4aec227e985e31d2fdc5608daf48e3de19157b7 ]
SCSSI has reset controls for each channel in the SoCs newer than Pro4, so this adds missing reset controls for channel 1, 2 and 3. And more, this moves MCSSI reset ID after SCSSI.
--- drivers/reset/reset-uniphier.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/reset/reset-uniphier.c +8 -5
@@ -193,8 +193,8 @@ static const struct uniphier_reset_data uniphier_pro5_sd_reset_data[] = {#define UNIPHIER_PERI_RESET_FI2C (id, ch) \ UNIPHIER_RESETX((id), 0x114, 24 + (ch)) -#define UNIPHIER_PERI_RESET_SCSSI (id) \ - UNIPHIER_RESETX((id), 0x110, 17) +#define UNIPHIER_PERI_RESET_SCSSI (id, ch) \ + UNIPHIER_RESETX((id), 0x110, 17 + (ch))#define UNIPHIER_PERI_RESET_MCSSI (id) \ UNIPHIER_RESETX((id), 0x114, 14)
@@ -209,7 +209,7 @@ static const struct uniphier_reset_data uniphier_ld4_peri_reset_data[] = {UNIPHIER_PERI_RESET_I2C (6 ,2 ),UNIPHIER_PERI_RESET_I2C (7 ,3 ),UNIPHIER_PERI_RESET_I2C (8 ,4 ), -UNIPHIER_PERI_RESET_SCSSI (11 ), +UNIPHIER_PERI_RESET_SCSSI (11 ,0 ), UNIPHIER_RESET_END, };
@@ -225,8 +225,11 @@ static const struct uniphier_reset_data uniphier_pro4_peri_reset_data[] = {UNIPHIER_PERI_RESET_FI2C (8 ,4 ),UNIPHIER_PERI_RESET_FI2C (9 ,5 ),UNIPHIER_PERI_RESET_FI2C (10 ,6 ), -UNIPHIER_PERI_RESET_SCSSI (11 ), -UNIPHIER_PERI_RESET_MCSSI (12 ), +UNIPHIER_PERI_RESET_SCSSI (11 ,0 ), +UNIPHIER_PERI_RESET_SCSSI (12 ,1 ), +UNIPHIER_PERI_RESET_SCSSI (13 ,2 ), +UNIPHIER_PERI_RESET_SCSSI (14 ,3 ), +UNIPHIER_PERI_RESET_MCSSI (15 ), UNIPHIER_RESET_END, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 221/399 udf: Fix free space reporting for metadata and virtual partitions
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit a4a8b99ec819ca60b49dc582a4287ef03411f117 ]
Free space on filesystems with metadata or virtual partition maps currently gets misreported. This is because these partitions are just remapped onto underlying real partitions from which keep track of free blocks. Take this remapping into account when counting free blocks as well.
--- fs/udf/super.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
fs/udf/super.c +17 -5
@@ -2491,17 +2491,29 @@ static unsigned int udf_count_free_table(struct super_block *sb,static unsigned int udf_count_free (struct super_block *sb) {unsigned int accum =0 ; -struct udf_sb_info *sbi; +struct udf_sb_info *sbi =UDF_SB (sb);struct udf_part_map *map; +unsigned int part = sbi->s_partition; +int ptype = sbi->s_partmaps[part].s_partition_type; + +if (ptype ==UDF_METADATA_MAP25 ) { + part = sbi->s_partmaps[part].s_type_specific.s_metadata. + s_phys_partition_ref; + }else if (ptype ==UDF_VIRTUAL_MAP15 || ptype ==UDF_VIRTUAL_MAP20 ) { +/* +* Filesystems with VAT are append-only and we cannot write to +* them. Let's just report 0 here. +*/ +return 0 ; + } - sbi =UDF_SB (sb);if (sbi->s_lvid_bh) {struct logicalVolIntegrityDesc *lvid = (struct logicalVolIntegrityDesc *) sbi->s_lvid_bh->b_data; -if (le32_to_cpu (lvid->numOfPartitions) > sbi->s_partition) { +if (le32_to_cpu (lvid->numOfPartitions) > part) { accum =le32_to_cpu ( - lvid->freeSpaceTable[sbi->s_partition]); + lvid->freeSpaceTable[part]);if (accum ==0xFFFFFFFF ) accum =0 ; }
@@ -2510,7 +2522,7 @@ static unsigned int udf_count_free(struct super_block *sb)if (accum)return accum; - map = &sbi->s_partmaps[sbi->s_partition]; + map = &sbi->s_partmaps[part];if (map->s_partition_flags &UDF_PART_FLAG_UNALLOC_BITMAP ) { accum +=udf_count_free_bitmap (sb, map->s_uspace.s_bitmap);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 222/399 selftests: Uninitialized variable in test_cgcore_proc_migration()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 192c197cbca599321de95a4cf15c2fa0681140d3 ]
The "c_threads" variable is used in the error handling code before it has been initialized
--- tools/testing/selftests/cgroup/test_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/cgroup/test_core.c +1 -1
@@ -369,7 +369,7 @@ static void *dummy_thread_fn(void *arg)static int test_cgcore_proc_migration (const char *root) {int ret =KSFT_FAIL ; -int t, c_threads, n_threads =13 ; +int t, c_threads =0 , n_threads =13 ;char *src =NULL , *dst =NULL ;pthread_t threads[n_threads];
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 223/399 kunit: remove timeout dependence on sysctl_hung_task_timeout_seconds
In reply to Greg Kroah-HartmanFrom: Alan Maguire <[email protected]>
[ Upstream commit 1c024d45151b51c8f8d4749e65958b0bcf3e7c52 ]
In discussion of how to handle timeouts, it was noted that if sysctl_hung_task_timeout_seconds is exceeded for a kunit test, the test task will be killed and an oops generated. This should suffice as a means of debugging such timeout issues for now.
Hence remove use of sysctl_hung_task_timeout_secs, which has the added benefit of avoiding the need to export that symbol from the core kernel.
--- lib/kunit/try-catch.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-)
lib/kunit/try-catch.c +4 -18
@@ -12,7 +12,6 @@#include <linux/completion.h> #include <linux/kernel.h> #include <linux/kthread.h> -#include <linux/sched/sysctl.h> void __noreturn kunit_try_catch_throw (struct kunit_try_catch *try_catch) {
@@ -31,8 +30,6 @@ static int kunit_generic_run_threadfn_adapter(void *data)static unsigned long kunit_test_timeout (void ) { -unsigned long timeout_msecs; -/* * TODO([email protected]): We should probably have some type of * variable timeout here. The only question is what that timeout value
@@ -49,22 +46,11 @@ static unsigned long kunit_test_timeout(void)* * For more background on this topic, see: * https://mike-bland.com/2011/11/01/small-medium-large.html +* +* If tests timeout due to exceeding sysctl_hung_task_timeout_secs, +* the task will be killed and an oops generated. */ -if (sysctl_hung_task_timeout_secs) { -/* -* If sysctl_hung_task is active, just set the timeout to some -* value less than that. -* -* In regards to the above TODO, if we decide on variable -* timeouts, this logic will likely need to change. -*/ - timeout_msecs = (sysctl_hung_task_timeout_secs -1 ) * -MSEC_PER_SEC ; - }else { - timeout_msecs =300 *MSEC_PER_SEC ;/* 5 min */ - } - -return timeout_msecs; +return 300 *MSEC_PER_SEC ;/* 5 min */ }void kunit_try_catch_run (struct kunit_try_catch *try_catch,void *context)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 224/399 drm/mediatek: Add gamma property according to hardware capability
In reply to Greg Kroah-HartmanFrom: Yongqiang Niu <[email protected]>
[ Upstream commit 4cebc1de506fa753301266a5a23bb21bca52ad3a ]
If there is no gamma function in the crtc
display path, don't add gamma property
for crtc
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +8 -2
@@ -641,6 +641,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,int pipe = priv->num_pipes;int ret;int i; +uint gamma_lut_size =0 ;if (!path)return 0 ;
@@ -691,6 +692,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, } mtk_crtc->ddp_comp[i] = comp; + +if (comp->funcs && comp->funcs->gamma_set) + gamma_lut_size =MTK_LUT_SIZE ; }for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++)
@@ -711,8 +715,10 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, NULL, pipe);if (ret <0 )return ret; -drm_mode_crtc_set_gamma_size (&mtk_crtc->base,MTK_LUT_SIZE ); -drm_crtc_enable_color_mgmt (&mtk_crtc->base,0 , false,MTK_LUT_SIZE ); + +if (gamma_lut_size) +drm_mode_crtc_set_gamma_size (&mtk_crtc->base, gamma_lut_size); +drm_crtc_enable_color_mgmt (&mtk_crtc->base,0 , false, gamma_lut_size); priv->num_pipes++;return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 226/399 IB/hfi1: Add software counter for ctxt0 seq drop
In reply to Greg Kroah-HartmanFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit 5ffd048698ea5139743acd45e8ab388a683642b8 ]
All other code paths increment some form of drop counter.
This was missed in the original implementation.
--- drivers/infiniband/hw/hfi1/chip.c | 10 ++++++++++ drivers/infiniband/hw/hfi1/chip.h | 1 + drivers/infiniband/hw/hfi1/driver.c | 1 + drivers/infiniband/hw/hfi1/hfi.h | 2 ++ 4 files changed, 14 insertions(+)
drivers/infiniband/hw/hfi1/chip.c +10 -0
@@ -1685,6 +1685,14 @@ static u64 access_sw_pio_drain(const struct cntr_entry *entry,return dd->verbs_dev.n_piodrain; } +static u64 access_sw_ctx0_seq_drop (const struct cntr_entry *entry, +void *context,int vl,int mode,u64 data) +{ +struct hfi1_devdata *dd = context; + +return dd->ctx0_seq_drop; +} +static u64 access_sw_vtx_wait (const struct cntr_entry *entry,void *context,int vl,int mode,u64 data) {
@@ -4249,6 +4257,8 @@ static struct cntr_entry dev_cntrs[DEV_CNTR_LAST] = { access_sw_cpu_intr), [C_SW_CPU_RCV_LIM ] =CNTR_ELEM ("RcvLimit" ,0 ,0 ,CNTR_NORMAL , access_sw_cpu_rcv_limit), +[C_SW_CTX0_SEQ_DROP ] =CNTR_ELEM ("SeqDrop0" ,0 ,0 ,CNTR_NORMAL , + access_sw_ctx0_seq_drop), [C_SW_VTX_WAIT ] =CNTR_ELEM ("vTxWait" ,0 ,0 ,CNTR_NORMAL , access_sw_vtx_wait), [C_SW_PIO_WAIT] = CNTR_ELEM("PioWait", 0, 0, CNTR_NORMAL,
drivers/infiniband/hw/hfi1/chip.h +1 -0
@@ -926,6 +926,7 @@ enum {C_DC_PG_STS_TX_MBE_CNT ,C_SW_CPU_INTR ,C_SW_CPU_RCV_LIM , +C_SW_CTX0_SEQ_DROP ,C_SW_VTX_WAIT ,C_SW_PIO_WAIT , C_SW_PIO_DRAIN,
drivers/infiniband/hw/hfi1/driver.c +1 -0
@@ -734,6 +734,7 @@ static noinline int skip_rcv_packet(struct hfi1_packet *packet, int thread) {int ret; + packet->rcd->dd->ctx0_seq_drop++;/* Set up for the next packet */ packet->rhqoff += packet->rsize;if (packet->rhqoff >= packet->maxcnt)
drivers/infiniband/hw/hfi1/hfi.h +2 -0
@@ -1153,6 +1153,8 @@ struct hfi1_devdata {char *boardname;/* human readable board info */ +u64 ctx0_seq_drop; +/* reset value */ u64 z_int_counter;u64 z_rcv_limit;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 227/399 IB/hfi1: Add RcvShortLengthErrCnt to hfi1stats
In reply to Greg Kroah-HartmanFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit 2c9d4e26d1ab27ceae2ded2ffe930f8e5f5b2a89 ]
This counter, RxShrErr, is required for error analysis and debug.
--- drivers/infiniband/hw/hfi1/chip.c | 1 + drivers/infiniband/hw/hfi1/chip.h | 1 + drivers/infiniband/hw/hfi1/chip_registers.h | 1 + 3 files changed, 3 insertions(+)
drivers/infiniband/hw/hfi1/chip.c +1 -0
@@ -4114,6 +4114,7 @@ def_access_ibp_counter(rc_crwaits);static struct cntr_entry dev_cntrs[DEV_CNTR_LAST ] = { [C_RCV_OVF ] =RXE32_DEV_CNTR_ELEM (RcvOverflow,RCV_BUF_OVFL_CNT ,CNTR_SYNTH ), [C_RX_LEN_ERR ] =RXE32_DEV_CNTR_ELEM (RxLenErr,RCV_LENGTH_ERR_CNT ,CNTR_SYNTH ), +[C_RX_SHORT_ERR ] =RXE32_DEV_CNTR_ELEM (RxShrErr,RCV_SHORT_ERR_CNT ,CNTR_SYNTH ), [C_RX_ICRC_ERR ] =RXE32_DEV_CNTR_ELEM (RxICrcErr,RCV_ICRC_ERR_CNT ,CNTR_SYNTH ), [C_RX_EBP ] =RXE32_DEV_CNTR_ELEM (RxEbpCnt,RCV_EBP_CNT ,CNTR_SYNTH ), [C_RX_TID_FULL] = RXE32_DEV_CNTR_ELEM(RxTIDFullEr, RCV_TID_FULL_ERR_CNT,
drivers/infiniband/hw/hfi1/chip.h +1 -0
@@ -859,6 +859,7 @@ static inline int idx_from_vl(int vl)enum {C_RCV_OVF =0 ,C_RX_LEN_ERR , +C_RX_SHORT_ERR ,C_RX_ICRC_ERR ,C_RX_EBP ,C_RX_TID_FULL ,
drivers/infiniband/hw/hfi1/chip_registers.h +1 -0
@@ -381,6 +381,7 @@#define DC_LCB_STS_LINK_TRANSFER_ACTIVE (DC_LCB_CSRS + 0x000000000468)#define DC_LCB_STS_ROUND_TRIP_LTP_CNT (DC_LCB_CSRS + 0x0000000004B0)#define RCV_LENGTH_ERR_CNT 0 +#define RCV_SHORT_ERR_CNT 2#define RCV_ICRC_ERR_CNT 6#define RCV_EBP_CNT 9#define RCV_BUF_OVFL_CNT 10
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 228/399 soc/tegra: fuse: Correct straps address for older Tegra124 device trees
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 2d9ea1934f8ef0dfb862d103389562cc28b4fc03 ]
Trying to read out Chip ID before APBMISC registers are mapped won't succeed, in a result Tegra124 gets a wrong address for the HW straps register if machine uses an old outdated device tree.
--- drivers/soc/tegra/fuse/tegra-apbmisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/tegra/fuse/tegra-apbmisc.c +1 -1
@@ -123,7 +123,7 @@ void __init tegra_init_apbmisc(void) apbmisc.flags =IORESOURCE_MEM ;/* strapping options */ -if (tegra_get_chip_id () ==TEGRA124 ) { +if (of_machine_is_compatible ("nvidia,tegra124" )) { straps.start =0x7000e864 ; straps.end =0x7000e867 ; }else {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 229/399 efi/x86: Dont panic or BUG() on non-critical error conditions
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit e2d68a955e49d61fd0384f23e92058dc9b79be5e ]
The logic in __efi_enter_virtual_mode() does a number of steps in sequence, all of which may fail in one way or the other. In most cases, we simply print an error and disable EFI runtime services support, but in some cases, we BUG() or panic() and bring down the system when encountering conditions that we could easily handle in the same way.
While at it, replace a pointless page-to-virt-phys conversion with one that goes straight from struct page to physical.
--- arch/x86/platform/efi/efi.c | 28 ++++++++++++++-------------- arch/x86/platform/efi/efi_64.c | 9 +++++---- 2 files changed, 19 insertions(+), 18 deletions(-)
arch/x86/platform/efi/efi.c +14 -14
@@ -1000,16 +1000,14 @@ static void __init __efi_enter_virtual_mode(void)if (efi_alloc_page_tables ()) {pr_err ("Failed to allocate EFI page tables\n" ); -clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); -return ; + goto err; }efi_merge_regions (); new_memmap =efi_map_regions (&count, &pg_shift);if (!new_memmap) {pr_err ("Error reallocating memory, EFI runtime non-functional!\n" ); -clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); -return ; + goto err; } pa =__pa (new_memmap);
@@ -1023,8 +1021,7 @@ static void __init __efi_enter_virtual_mode(void)if (efi_memmap_init_late (pa, efi.memmap.desc_size * count)) {pr_err ("Failed to remap late EFI memory map\n" ); -clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); -return ; + goto err; }if (efi_enabled (EFI_DBG )) {
@@ -1032,12 +1029,11 @@ static void __init __efi_enter_virtual_mode(void)efi_print_memmap (); } -BUG_ON (!efi.systab); +if (WARN_ON (!efi.systab)) + goto err; -if (efi_setup_page_tables (pa,1 << pg_shift)) { -clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); -return ; - } +if (efi_setup_page_tables (pa,1 << pg_shift)) + goto err;efi_sync_low_kernel_mappings ();
@@ -1057,9 +1053,9 @@ static void __init __efi_enter_virtual_mode(void) }if (status !=EFI_SUCCESS ) { -pr_alert ("Unable to switch EFI into virtual mode (status=%lx)!\n" , - status); -panic ("EFI call to SetVirtualAddressMap() failed!" ); +pr_err ("Unable to switch EFI into virtual mode (status=%lx)!\n" , + status); + goto err; }efi_free_boot_services ();
@@ -1088,6 +1084,10 @@ static void __init __efi_enter_virtual_mode(void)/* clean DUMMY object */ efi_delete_dummy_variable (); +return ; + +err: +clear_bit (EFI_RUNTIME_SERVICES , &efi.flags); }void __init efi_enter_virtual_mode (void )
arch/x86/platform/efi/efi_64.c +5 -4
@@ -392,11 +392,12 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)return 0 ; page =alloc_page (GFP_KERNEL |__GFP_DMA32); -if (!page) -panic ("Unable to allocate EFI runtime stack < 4GB\n" ); +if (!page) { +pr_err ("Unable to allocate EFI runtime stack < 4GB\n" ); +return 1 ; + } - efi_scratch.phys_stack =virt_to_phys (page_address (page)); - efi_scratch.phys_stack +=PAGE_SIZE ;/* stack grows down */ + efi_scratch.phys_stack =page_to_phys (page +1 );/* stack grows down */ npages = (_etext - _text) >>PAGE_SHIFT ; text =__pa (_text);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 230/399 rcu: Use WRITE_ONCE() for assignments to ->pprev for hlist_nulls
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit 860c8802ace14c646864795e057349c9fb2d60ad ]
Eric Dumazet supplied a KCSAN report of a bug that forces use of hlist_unhashed_lockless() from sk_unhashed():
------------------------------------------------------------------------
BUG: KCSAN: data-race in inet_unhash / inet_unhash
write to 0xffff8880a69a0170 of 8 bytes by interrupt on cpu 1:
__hlist_nulls_del include/linux/list_nulls.h:88 [inline] hlist_nulls_del_init_rcu include/linux/rculist_nulls.h:36 [inline] __sk_nulls_del_node_init_rcu include/net/sock.h:676 [inline] inet_unhash+0x38f/0x4a0 net/ipv4/inet_hashtables.c:612 tcp_set_state+0xfa/0x3e0 net/ipv4/tcp.c:2249 tcp_done+0x93/0x1e0 net/ipv4/tcp.c:3854 tcp_write_err+0x7e/0xc0 net/ipv4/tcp_timer.c:56 tcp_retransmit_timer+0x9b8/0x16d0 net/ipv4/tcp_timer.c:479 tcp_write_timer_handler+0x42d/0x510 net/ipv4/tcp_timer.c:599 tcp_write_timer+0xd1/0xf0 net/ipv4/tcp_timer.c:619 call_timer_fn+0x5f/0x2f0 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0xc0c/0xcd0 kernel/time/timer.c:1786 __do_softirq+0x115/0x33f kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0xbb/0xe0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0xe6/0x280 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830 native_safe_halt+0xe/0x10 arch/x86/kernel/paravirt.c:71 arch_cpu_idle+0x1f/0x30 arch/x86/kernel/process.c:571 default_idle_call+0x1e/0x40 kernel/sched/idle.c:94 cpuidle_idle_call kernel/sched/idle.c:154 [inline] do_idle+0x1af/0x280 kernel/sched/idle.c:263 cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:355 start_secondary+0x208/0x260 arch/x86/kernel/smpboot.c:264 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241
read to 0xffff8880a69a0170 of 8 bytes by interrupt on cpu 0:
sk_unhashed include/net/sock.h:607 [inline] inet_unhash+0x3d/0x4a0 net/ipv4/inet_hashtables.c:592 tcp_set_state+0xfa/0x3e0 net/ipv4/tcp.c:2249 tcp_done+0x93/0x1e0 net/ipv4/tcp.c:3854 tcp_write_err+0x7e/0xc0 net/ipv4/tcp_timer.c:56 tcp_retransmit_timer+0x9b8/0x16d0 net/ipv4/tcp_timer.c:479 tcp_write_timer_handler+0x42d/0x510 net/ipv4/tcp_timer.c:599 tcp_write_timer+0xd1/0xf0 net/ipv4/tcp_timer.c:619 call_timer_fn+0x5f/0x2f0 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0xc0c/0xcd0 kernel/time/timer.c:1786 __do_softirq+0x115/0x33f kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0xbb/0xe0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0xe6/0x280 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830 native_safe_halt+0xe/0x10 arch/x86/kernel/paravirt.c:71 arch_cpu_idle+0x1f/0x30 arch/x86/kernel/process.c:571 default_idle_call+0x1e/0x40 kernel/sched/idle.c:94 cpuidle_idle_call kernel/sched/idle.c:154 [inline] do_idle+0x1af/0x280 kernel/sched/idle.c:263 cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:355 rest_init+0xec/0xf6 init/main.c:452 arch_call_rest_init+0x17/0x37 start_kernel+0x838/0x85e init/main.c:786 x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:490 x86_64_start_kernel+0x72/0x76 arch/x86/kernel/head64.c:471 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.0-rc6+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine,
BIOS Google 01/01/2011
------------------------------------------------------------------------
This commit therefore replaces C-language assignments with WRITE_ONCE() in include/linux/list_nulls.h and include/linux/rculist_nulls.h.
--- include/linux/list_nulls.h | 8 ++++---- include/linux/rculist_nulls.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
include/linux/list_nulls.h +4 -4
@@ -72,10 +72,10 @@ static inline void hlist_nulls_add_head(struct hlist_nulls_node *n,struct hlist_nulls_node *first = h->first; n->next = first; - n->pprev = &h->first; +WRITE_ONCE (n->pprev, &h->first); h->first = n;if (!is_a_nulls (first)) - first->pprev = &n->next; +WRITE_ONCE (first->pprev, &n->next); }static inline void __hlist_nulls_del (struct hlist_nulls_node *n)
@@ -85,13 +85,13 @@ static inline void __hlist_nulls_del(struct hlist_nulls_node *n)WRITE_ONCE (*pprev, next);if (!is_a_nulls (next)) - next->pprev = pprev; +WRITE_ONCE (next->pprev, pprev); }static inline void hlist_nulls_del (struct hlist_nulls_node *n) {__hlist_nulls_del (n); - n->pprev =LIST_POISON2 ; +WRITE_ONCE (n->pprev,LIST_POISON2 ); }/**
include/linux/rculist_nulls.h +4 -4
@@ -34,7 +34,7 @@ static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n) {if (!hlist_nulls_unhashed (n)) {__hlist_nulls_del (n); - n->pprev =NULL ; +WRITE_ONCE (n->pprev,NULL ); } }
@@ -66,7 +66,7 @@ static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n)static inline void hlist_nulls_del_rcu (struct hlist_nulls_node *n) {__hlist_nulls_del (n); - n->pprev =LIST_POISON2 ; +WRITE_ONCE (n->pprev,LIST_POISON2 ); }/**
@@ -94,10 +94,10 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,struct hlist_nulls_node *first = h->first; n->next = first; - n->pprev = &h->first; +WRITE_ONCE (n->pprev, &h->first);rcu_assign_pointer (hlist_nulls_first_rcu (h), n);if (!is_a_nulls (first)) - first->pprev = &n->next; +WRITE_ONCE (first->pprev, &n->next); }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 196/399 ASoC: soc-topology: fix endianness issues
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 72bbeda0222bcd382ee33b3aff71346074410c21 ]
Sparse complains about a series of easy warnings, fix.
--- sound/soc/soc-topology.c | 42 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
sound/soc/soc-topology.c +22 -20
@@ -604,9 +604,11 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, ext_ops = tplg->bytes_ext_ops; num_ops = tplg->bytes_ext_ops_count;for (i =0 ; i < num_ops; i++) { -if (!sbe->put && ext_ops[i].id == be->ext_ops.put) +if (!sbe->put && + ext_ops[i].id ==le32_to_cpu (be->ext_ops.put)) sbe->put = ext_ops[i].put; -if (!sbe->get && ext_ops[i].id == be->ext_ops.get) +if (!sbe->get && + ext_ops[i].id ==le32_to_cpu (be->ext_ops.get)) sbe->get = ext_ops[i].get; }
@@ -621,11 +623,11 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, num_ops = tplg->io_ops_count;for (i =0 ; i < num_ops; i++) { -if (k->put ==NULL && ops[i].id == hdr->ops.put) +if (k->put ==NULL && ops[i].id ==le32_to_cpu (hdr->ops.put)) k->put = ops[i].put; -if (k->get ==NULL && ops[i].id == hdr->ops.get) +if (k->get ==NULL && ops[i].id ==le32_to_cpu (hdr->ops.get)) k->get = ops[i].get; -if (k->info ==NULL && ops[i].id == hdr->ops.info) +if (k->info ==NULL && ops[i].id ==le32_to_cpu (hdr->ops.info)) k->info = ops[i].info; }
@@ -638,11 +640,11 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, num_ops =ARRAY_SIZE (io_ops);for (i =0 ; i < num_ops; i++) { -if (k->put ==NULL && ops[i].id == hdr->ops.put) +if (k->put ==NULL && ops[i].id ==le32_to_cpu (hdr->ops.put)) k->put = ops[i].put; -if (k->get ==NULL && ops[i].id == hdr->ops.get) +if (k->get ==NULL && ops[i].id ==le32_to_cpu (hdr->ops.get)) k->get = ops[i].get; -if (k->info ==NULL && ops[i].id == hdr->ops.info) +if (k->info ==NULL && ops[i].id ==le32_to_cpu (hdr->ops.info)) k->info = ops[i].info; }
@@ -931,7 +933,7 @@ static int soc_tplg_denum_create_texts(struct soc_enum *se,if (se->dobj.control.dtexts ==NULL )return -ENOMEM ; -for (i =0 ; i < ec->items; i++) { +for (i =0 ; i <le32_to_cpu (ec->items); i++) {if (strnlen (ec->texts[i],SNDRV_CTL_ELEM_ID_NAME_MAXLEN ) ==SNDRV_CTL_ELEM_ID_NAME_MAXLEN ) {
@@ -1325,7 +1327,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create(if (kc[i].name ==NULL ) goto err_sm; kc[i].iface =SNDRV_CTL_ELEM_IFACE_MIXER ; - kc[i].access = mc->hdr.access; + kc[i].access =le32_to_cpu (mc->hdr.access);/* we only support FL/FR channel mapping atm */ sm->reg = tplc_chan_get_reg(tplg, mc->channel,
@@ -1337,10 +1339,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create( sm->rshift =tplc_chan_get_shift (tplg, mc->channel,SNDRV_CHMAP_FR ); - sm->max = mc->max; - sm->min = mc->min; - sm->invert = mc->invert; - sm->platform_max = mc->platform_max; + sm->max =le32_to_cpu (mc->max); + sm->min =le32_to_cpu (mc->min); + sm->invert =le32_to_cpu (mc->invert); + sm->platform_max =le32_to_cpu (mc->platform_max); sm->dobj.index = tplg->index;INIT_LIST_HEAD (&sm->dobj.list);
@@ -1401,7 +1403,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create( goto err_se; tplg->pos += (sizeof (struct snd_soc_tplg_enum_control ) + - ec->priv.size); +le32_to_cpu (ec->priv.size));dev_dbg (tplg->dev," adding DAPM widget enum control %s\n" , ec->hdr.name);
@@ -1411,7 +1413,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create(if (kc[i].name ==NULL ) goto err_se; kc[i].iface =SNDRV_CTL_ELEM_IFACE_MIXER ; - kc[i].access = ec->hdr.access; + kc[i].access =le32_to_cpu (ec->hdr.access);/* we only support FL/FR channel mapping atm */ se->reg =tplc_chan_get_reg (tplg, ec->channel,SNDRV_CHMAP_FL );
@@ -1420,8 +1422,8 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create( se->shift_r =tplc_chan_get_shift (tplg, ec->channel,SNDRV_CHMAP_FR ); - se->items = ec->items; - se->mask = ec->mask; + se->items =le32_to_cpu (ec->items); + se->mask =le32_to_cpu (ec->mask); se->dobj.index = tplg->index;switch (le32_to_cpu (ec->hdr.ops.info)) {
@@ -1523,9 +1525,9 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create(if (kc[i].name ==NULL ) goto err_sbe; kc[i].iface =SNDRV_CTL_ELEM_IFACE_MIXER ; - kc[i].access = be->hdr.access; + kc[i].access =le32_to_cpu (be->hdr.access); - sbe->max = be->max; + sbe->max =le32_to_cpu (be->max);INIT_LIST_HEAD (&sbe->dobj.list);/* map standard io handlers and check for external handlers */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 232/399 bnxt: Detach page from page pool before sending up the stack
In reply to Greg Kroah-HartmanFrom: Jonathan Lemon <[email protected]>
[ Upstream commit 3071c51783b39d6a676d02a9256c3b3f87804285 ]
When running in XDP mode, pages come from the page pool, and should be freed back to the same pool or specifically detached. Currently, when the driver re-initializes, the page pool destruction is delayed forever since it thinks there are oustanding pages.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -0
@@ -944,6 +944,7 @@ static struct sk_buff *bnxt_rx_page_skb(struct bnxt *bp, dma_addr -= bp->rx_dma_offset;dma_unmap_page_attrs (&bp->pdev->dev, dma_addr,PAGE_SIZE , bp->rx_dir,DMA_ATTR_WEAK_ORDERING ); +page_pool_release_page (rxr->page_pool, page);if (unlikely (!payload)) payload =eth_get_headlen (bp->dev, data_ptr, len);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 197/399 fbdev: fix numbering of fbcon options
In reply to Greg Kroah-HartmanFrom: Peter Rosin <[email protected]>
[ Upstream commit fd933c00ebe220060e66fb136a7050a242456566 ]
Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count...
One! Two! Five!
--- Documentation/fb/fbcon.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/fb/fbcon.rst +4 -4
@@ -127,7 +127,7 @@ C. Boot options is typically located on the same video card. Thus, the consoles that are controlled by the VGA console will be garbled. -4. fbcon=rotate:<n> +5. fbcon=rotate:<n> This option changes the orientation angle of the console display. The value 'n' accepts the following:
@@ -152,21 +152,21 @@ C. Boot options Actually, the underlying fb driver is totally ignorant of console rotation. -5. fbcon=margin:<color> +6. fbcon=margin:<color> This option specifies the color of the margins. The margins are the leftover area at the right and the bottom of the screen that are not used by text. By default, this area will be black. The 'color' value is an integer number that depends on the framebuffer driver being used. -6. fbcon=nodefer +7. fbcon=nodefer If the kernel is compiled with deferred fbcon takeover support, normally the framebuffer contents, left in place by the firmware/bootloader, will be preserved until there actually is some text is output to the console. This option causes fbcon to bind immediately to the fbdev device. -7. fbcon=logo-pos:<location> +8. fbcon=logo-pos:<location> The only possible 'location' is 'center' (without quotes), and when given, the bootup logo is moved from the default top-left corner
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 198/399 RDMA/rxe: Fix error type of mmap_offset
In reply to Greg Kroah-HartmanFrom: Jiewei Ke <[email protected]>
[ Upstream commit 6ca18d8927d468c763571f78c9a7387a69ffa020 ]
The type of mmap_offset should be u64 instead of int to match the type of mminfo.offset. If otherwise, after we create several thousands of CQs, it will run into overflow issues.
--- drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_verbs.h +1 -1
@@ -408,7 +408,7 @@ struct rxe_dev {struct list_head pending_mmaps;spinlock_t mmap_offset_lock;/* guard mmap_offset */ -int mmap_offset; +u64 mmap_offset;atomic64_t stats_counters[RXE_NUM_OF_COUNTERS ];
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 199/399 ice: add extra check for null Rx descriptor
In reply to Greg Kroah-HartmanFrom: Mitch Williams <[email protected]>
[ Upstream commit 1f45ebe0d8fbe6178670b663005f38ef8535db5d ]
In the case where the hardware gives us a null Rx descriptor, it is theoretically possible that we could call one of our skb-construction functions with no data pointer, which would cause a panic.
In real life, this will never happen - we only get null RX descriptors as the final descriptor in a chain of otherwise-valid descriptors. When this happens, the skb will be extant and we'll just call ice_add_rx_frag(), which can deal with empty data buffers.
Unfortunately, Coverity does not have intimate knowledge of our hardware, so we must add a check here.
--- drivers/net/ethernet/intel/ice/ice_txrx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ice/ice_txrx.c +8 -5
@@ -1071,13 +1071,16 @@ static int ice_clean_rx_irq(struct ice_ring *rx_ring, int budget)ice_put_rx_buf (rx_ring, rx_buf);continue ; construct_skb: -if (skb) +if (skb) {ice_add_rx_frag (rx_ring, rx_buf, skb, size); -else if (ice_ring_uses_build_skb (rx_ring)) - skb =ice_build_skb (rx_ring, rx_buf, &xdp); -else + }else if (likely (xdp.data)) { +if (ice_ring_uses_build_skb (rx_ring)) + skb =ice_build_skb (rx_ring, rx_buf, &xdp); +else + skb =ice_construct_skb (rx_ring, rx_buf, &xdp); + }else { skb =ice_construct_skb (rx_ring, rx_buf, &xdp); - + }/* exit if we failed to retrieve a buffer */ if (!skb) { rx_ring->rx_stats.alloc_buf_failed++;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 200/399 clk: sunxi-ng: add mux and pll notifiers for A64 CPU clock
In reply to Greg Kroah-HartmanFrom: Icenowy Zheng <[email protected]>
[ Upstream commit ec97faff743b398e21f74a54c81333f3390093aa ]
The A64 PLL_CPU clock has the same instability if some factor changed without the PLL gated like other SoCs with sun6i-style CCU, e.g. A33, H3.
Add the mux and pll notifiers for A64 CPU clock to workaround the problem.
--- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun50i-a64.c +27 -1
@@ -921,11 +921,26 @@ static const struct sunxi_ccu_desc sun50i_a64_ccu_desc = { .num_resets = ARRAY_SIZE(sun50i_a64_ccu_resets), }; +static struct ccu_pll_nb sun50i_a64_pll_cpu_nb = { + .common = &pll_cpux_clk.common, +/* copy from pll_cpux_clk */ + .enable =BIT (31 ), + .lock =BIT (28 ), +}; + +static struct ccu_mux_nb sun50i_a64_cpu_nb = { + .common = &cpux_clk.common, + .cm = &cpux_clk.mux, + .delay_us =1 ,/* > 8 clock cycles at 24 MHz */ + .bypass_index =1 ,/* index of 24 MHz oscillator */ +}; +static int sun50i_a64_ccu_probe (struct platform_device *pdev) {struct resource *res;void __iomem *reg;u32 val; +int ret; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); reg =devm_ioremap_resource (&pdev->dev, res);
@@ -939,7 +954,18 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev)writel (0x515 , reg +SUN50I_A64_PLL_MIPI_REG ); -return sunxi_ccu_probe (pdev->dev.of_node, reg, &sun50i_a64_ccu_desc); + ret =sunxi_ccu_probe (pdev->dev.of_node, reg, &sun50i_a64_ccu_desc); +if (ret) +return ret; + +/* Gate then ungate PLL CPU after any rate changes */ +ccu_pll_notifier_register (&sun50i_a64_pll_cpu_nb); + +/* Reparent CPU during PLL CPU rate changes */ +ccu_mux_notifier_register (pll_cpux_clk.common.hw.clk, + &sun50i_a64_cpu_nb); + +return 0 ; }static const struct of_device_id sun50i_a64_ccu_ids[] = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 234/399 wan: ixp4xx_hss: fix compile-testing on 64-bit
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 504c28c853ec5c626900b914b5833daf0581a344 ]
Change the driver to use portable integer types to avoid warnings during compile testing:
drivers/net/wan/ixp4xx_hss.c:863:21: error: cast to 'u32 *' (aka 'unsigned int *') from smaller integer type 'int' [-Werror,-Wint-to-pointer-cast]
memcpy_swab32(mem, (u32 *)((int)skb->data & ~3), bytes / 4);
^
drivers/net/wan/ixp4xx_hss.c:979:12: error: incompatible pointer types passing 'u32 *' (aka 'unsigned int *') to parameter of type 'dma_addr_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
&port->desc_tab_phys)))
^~~~~~~~~~~~~~~~~~~~
include/linux/dmapool.h:27:20: note: passing argument to parameter 'handle' here
dma_addr_t *handle);
^--- drivers/net/wan/ixp4xx_hss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wan/ixp4xx_hss.c +2 -2
@@ -258,7 +258,7 @@ struct port {struct hss_plat_info *plat;buffer_t *rx_buff_tab[RX_DESCS ], *tx_buff_tab[TX_DESCS ];struct desc *desc_tab;/* coherent */ -u32 desc_tab_phys; +dma_addr_t desc_tab_phys;unsigned int id;unsigned int clock_type, clock_rate, loopback;unsigned int initialized, carrier;
@@ -858,7 +858,7 @@ static int hss_hdlc_xmit(struct sk_buff *skb, struct net_device *dev) dev->stats.tx_dropped++; return NETDEV_TX_OK; } -memcpy_swab32 (mem, (u32 *)((int )skb->data & ~3 ), bytes /4 ); +memcpy_swab32 (mem, (u32 *)((uintptr_t )skb->data & ~3 ), bytes /4 );dev_kfree_skb (skb);#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 192/399 PM / devfreq: rk3399_dmc: Add COMPILE_TEST and HAVE_ARM_SMCCC dependency
In reply to Greg Kroah-HartmanFrom: Chanwoo Choi <[email protected]>
[ Upstream commit eff5d31f7407fa9d31fb840106f1593399457298 ]
To build test, add COMPILE_TEST depedency to both ARM_RK3399_DMC_DEVFREQ and DEVFREQ_EVENT_ROCKCHIP_DFI configuration. And ARM_RK3399_DMC_DEVFREQ used the SMCCC interface so that add HAVE_ARM_SMCCC dependency to prevent the build break.
--- drivers/devfreq/Kconfig | 3 ++- drivers/devfreq/event/Kconfig | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/devfreq/Kconfig +2 -1
@@ -115,7 +115,8 @@ config ARM_TEGRA20_DEVFREQ config ARM_RK3399_DMC_DEVFREQ tristate "ARM RK3399 DMC DEVFREQ Driver" - depends on ARCH_ROCKCHIP + depends on (ARCH_ROCKCHIP && HAVE_ARM_SMCCC) || \ + (COMPILE_TEST && HAVE_ARM_SMCCC) select DEVFREQ_EVENT_ROCKCHIP_DFI select DEVFREQ_GOV_SIMPLE_ONDEMAND select PM_DEVFREQ_EVENT
drivers/devfreq/event/Kconfig +1 -1
@@ -34,7 +34,7 @@ config DEVFREQ_EVENT_EXYNOS_PPMU config DEVFREQ_EVENT_ROCKCHIP_DFI tristate "ROCKCHIP DFI DEVFREQ event Driver" - depends on ARCH_ROCKCHIP + depends on ARCH_ROCKCHIP || COMPILE_TEST help This add the devfreq-event driver for Rockchip SoC. It provides DFI (DDR Monitor Module) driver to count ddr load.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 244/399 RDMA/uverbs: Remove needs_kfree_rcu from uverbs_obj_type_class
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 8bdf9dd984c18375d1090ddeb1792511f619c5c1 ]
After device disassociation the uapi_objects are destroyed and freed, however it is still possible that core code can be holding a kref on the uobject. When it finally goes to uverbs_uobject_free() via the kref_put() it can trigger a use-after-free on the uapi_object.
Since needs_kfree_rcu is a micro optimization that only benefits file uobjects, just get rid of it. There is no harm in using kfree_rcu even if it isn't required, and the number of involved objects is small.
--- drivers/infiniband/core/rdma_core.c | 23 +---------------------- include/rdma/uverbs_types.h | 1 - 2 files changed, 1 insertion(+), 23 deletions(-)
drivers/infiniband/core/rdma_core.c +1 -22
@@ -49,13 +49,7 @@ void uverbs_uobject_get(struct ib_uobject *uobject)static void uverbs_uobject_free (struct kref *ref) { -struct ib_uobject *uobj = - container_of(ref, struct ib_uobject, ref); - -if (uobj->uapi_object->type_class->needs_kfree_rcu) -kfree_rcu (uobj, rcu); -else -kfree (uobj); + kfree_rcu(container_of(ref, struct ib_uobject, ref), rcu); }void uverbs_uobject_put (struct ib_uobject *uobject)
@@ -744,20 +738,6 @@ const struct uverbs_obj_type_class uverbs_idr_class = { .lookup_put = lookup_put_idr_uobject, .destroy_hw = destroy_hw_idr_uobject, .remove_handle = remove_handle_idr_uobject, -/* -* When we destroy an object, we first just lock it for WRITE and -* actually DESTROY it in the finalize stage. So, the problematic -* scenario is when we just started the finalize stage of the -* destruction (nothing was executed yet). Now, the other thread -* fetched the object for READ access, but it didn't lock it yet. -* The DESTROY thread continues and starts destroying the object. -* When the other thread continue - without the RCU, it would -* access freed memory. However, the rcu_read_lock delays the free -* until the rcu_read_lock of the READ operation quits. Since the -* exclusive lock of the object is still taken by the DESTROY flow, the -* READ operation will get -EBUSY and it'll just bail out. -*/ - .needs_kfree_rcu = true, };EXPORT_SYMBOL (uverbs_idr_class);
@@ -920,7 +900,6 @@ const struct uverbs_obj_type_class uverbs_fd_class = { .lookup_put = lookup_put_fd_uobject, .destroy_hw = destroy_hw_fd_uobject, .remove_handle = remove_handle_fd_uobject, - .needs_kfree_rcu = false, };EXPORT_SYMBOL (uverbs_fd_class);
include/rdma/uverbs_types.h +0 -1
@@ -98,7 +98,6 @@ struct uverbs_obj_type_class {enum rdma_remove_reason why, struct uverbs_attr_bundle *attrs);void (*remove_handle)(struct ib_uobject *uobj); -u8 needs_kfree_rcu; };struct uverbs_obj_type {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 245/399 tty: synclinkmp: Adjust indentation in several functions
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 1feedf61e7265128244f6993f23421f33dd93dbc ]
Clang warns:
../drivers/tty/synclinkmp.c:1456:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
if (C_CRTSCTS(tty)) {
^
../drivers/tty/synclinkmp.c:1453:2: note: previous statement is here
if (I_IXOFF(tty))
^
../drivers/tty/synclinkmp.c:2473:8: warning: misleading indentation;
statement is not part of the previous 'if' [-Wmisleading-indentation]
info->port.tty->hw_stopped = 0;
^../drivers/tty/synclinkmp.c:2471:7: note: previous statement is here
if ( debug_level >= DEBUG_LEVEL_ISR ) ^../drivers/tty/synclinkmp.c:2482:8: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
info->port.tty->hw_stopped = 1;
^../drivers/tty/synclinkmp.c:2480:7: note: previous statement is here
if ( debug_level >= DEBUG_LEVEL_ISR ) ^../drivers/tty/synclinkmp.c:2809:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
^
../drivers/tty/synclinkmp.c:2807:2: note: previous statement is here
if (I_INPCK(info->port.tty))
^
../drivers/tty/synclinkmp.c:3246:3: warning: misleading indentation;
statement is not part of the previous 'else' [-Wmisleading-indentation]
set_signals(info);
^
../drivers/tty/synclinkmp.c:3244:2: note: previous statement is here
else
^5 warnings generated.
The indentation on these lines is not at all consistent, tabs and spaces are mixed together. Convert to just using tabs to be consistent with the Linux kernel coding style and eliminate these warnings from clang.
--- drivers/tty/synclinkmp.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/tty/synclinkmp.c +12 -12
@@ -1453,10 +1453,10 @@ static void throttle(struct tty_struct * tty)if (I_IXOFF (tty))send_xchar (tty,STOP_CHAR (tty)); -if (C_CRTSCTS (tty)) { +if (C_CRTSCTS (tty)) {spin_lock_irqsave (&info->lock,flags); info->serial_signals &= ~SerialSignal_RTS; -set_signals (info); +set_signals (info);spin_unlock_irqrestore (&info->lock,flags); } }
@@ -1482,10 +1482,10 @@ static void unthrottle(struct tty_struct * tty)send_xchar (tty,START_CHAR (tty)); } -if (C_CRTSCTS (tty)) { +if (C_CRTSCTS (tty)) {spin_lock_irqsave (&info->lock,flags); info->serial_signals |= SerialSignal_RTS; -set_signals (info); +set_signals (info);spin_unlock_irqrestore (&info->lock,flags); } }
@@ -2470,7 +2470,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status )if (status & SerialSignal_CTS) {if ( debug_level >=DEBUG_LEVEL_ISR )printk ("CTS tx start..." ); - info->port.tty->hw_stopped =0 ; + info->port.tty->hw_stopped =0 ;tx_start (info); info->pending_bh |=BH_TRANSMIT ;return ;
@@ -2479,7 +2479,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status )if (!(status & SerialSignal_CTS)) {if ( debug_level >=DEBUG_LEVEL_ISR )printk ("CTS tx stop..." ); - info->port.tty->hw_stopped =1 ; + info->port.tty->hw_stopped =1 ;tx_stop (info); } }
@@ -2806,8 +2806,8 @@ static void change_params(SLMP_INFO *info) info->read_status_mask2 =OVRN ;if (I_INPCK (info->port.tty)) info->read_status_mask2 |=PE |FRME ; -if (I_BRKINT (info->port.tty) ||I_PARMRK (info->port.tty)) - info->read_status_mask1 |=BRKD ; +if (I_BRKINT (info->port.tty) ||I_PARMRK (info->port.tty)) + info->read_status_mask1 |=BRKD ;if (I_IGNPAR (info->port.tty)) info->ignore_status_mask2 |=PE |FRME ;if (I_IGNBRK (info->port.tty)) {
@@ -3177,7 +3177,7 @@ static int tiocmget(struct tty_struct *tty)unsigned long flags;spin_lock_irqsave (&info->lock,flags); -get_signals (info); +get_signals (info);spin_unlock_irqrestore (&info->lock,flags); result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS : 0) |
@@ -3215,7 +3215,7 @@ static int tiocmset(struct tty_struct *tty, info->serial_signals &= ~SerialSignal_DTR;spin_lock_irqsave (&info->lock,flags); -set_signals (info); +set_signals (info);spin_unlock_irqrestore (&info->lock,flags);return 0 ;
@@ -3227,7 +3227,7 @@ static int carrier_raised(struct tty_port *port)unsigned long flags;spin_lock_irqsave (&info->lock,flags); -get_signals (info); +get_signals (info);spin_unlock_irqrestore (&info->lock,flags);return (info->serial_signals & SerialSignal_DCD) ?1 :0 ;
@@ -3243,7 +3243,7 @@ static void dtr_rts(struct tty_port *port, int on) info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; else info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); -set_signals (info); +set_signals (info);spin_unlock_irqrestore (&info->lock,flags); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 246/399 tty: synclink_gt: Adjust indentation in several functions
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 446e76873b5e4e70bdee5db2f2a894d5b4a7d081 ]
Clang warns:
../drivers/tty/synclink_gt.c:1337:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
if (C_CRTSCTS(tty)) {
^
../drivers/tty/synclink_gt.c:1335:2: note: previous statement is here
if (I_IXOFF(tty))
^
../drivers/tty/synclink_gt.c:2563:3: warning: misleading indentation;
statement is not part of the previous 'if' [-Wmisleading-indentation]
if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
^
../drivers/tty/synclink_gt.c:2561:2: note: previous statement is here
if (I_INPCK(info->port.tty))
^
../drivers/tty/synclink_gt.c:3221:3: warning: misleading indentation;
statement is not part of the previous 'else' [-Wmisleading-indentation]
set_signals(info);
^
../drivers/tty/synclink_gt.c:3219:2: note: previous statement is here
else
^3 warnings generated.
The indentation on these lines is not at all consistent, tabs and spaces are mixed together. Convert to just using tabs to be consistent with the Linux kernel coding style and eliminate these warnings from clang.
--- drivers/tty/synclink_gt.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/tty/synclink_gt.c +9 -9
@@ -1334,10 +1334,10 @@ static void throttle(struct tty_struct * tty)DBGINFO (("%s throttle\n" , info->device_name));if (I_IXOFF (tty))send_xchar (tty,STOP_CHAR (tty)); -if (C_CRTSCTS (tty)) { +if (C_CRTSCTS (tty)) {spin_lock_irqsave (&info->lock,flags); info->signals &= ~SerialSignal_RTS; -set_signals (info); +set_signals (info);spin_unlock_irqrestore (&info->lock,flags); } }
@@ -1359,10 +1359,10 @@ static void unthrottle(struct tty_struct * tty)else send_xchar (tty,START_CHAR (tty)); } -if (C_CRTSCTS (tty)) { +if (C_CRTSCTS (tty)) {spin_lock_irqsave (&info->lock,flags); info->signals |= SerialSignal_RTS; -set_signals (info); +set_signals (info);spin_unlock_irqrestore (&info->lock,flags); } }
@@ -2560,8 +2560,8 @@ static void change_params(struct slgt_info *info) info->read_status_mask =IRQ_RXOVER ;if (I_INPCK (info->port.tty)) info->read_status_mask |=MASK_PARITY |MASK_FRAMING ; -if (I_BRKINT (info->port.tty) ||I_PARMRK (info->port.tty)) - info->read_status_mask |=MASK_BREAK ; +if (I_BRKINT (info->port.tty) ||I_PARMRK (info->port.tty)) + info->read_status_mask |=MASK_BREAK ;if (I_IGNPAR (info->port.tty)) info->ignore_status_mask |=MASK_PARITY |MASK_FRAMING ;if (I_IGNBRK (info->port.tty)) {
@@ -3192,7 +3192,7 @@ static int tiocmset(struct tty_struct *tty, info->signals &= ~SerialSignal_DTR;spin_lock_irqsave (&info->lock,flags); -set_signals (info); +set_signals (info);spin_unlock_irqrestore (&info->lock,flags);return 0 ; }
@@ -3203,7 +3203,7 @@ static int carrier_raised(struct tty_port *port) struct slgt_info *info = container_of(port, struct slgt_info, port);spin_lock_irqsave (&info->lock,flags); -get_signals (info); +get_signals (info);spin_unlock_irqrestore (&info->lock,flags);return (info->signals & SerialSignal_DCD) ?1 :0 ; }
@@ -3218,7 +3218,7 @@ static void dtr_rts(struct tty_port *port, int on) info->signals |= SerialSignal_RTS | SerialSignal_DTR; else info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); -set_signals (info); +set_signals (info);spin_unlock_irqrestore (&info->lock,flags); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 248/399 misc: xilinx_sdfec: fix xsdfec_poll()s return type
In reply to Greg Kroah-HartmanFrom: Luc Van Oostenryck <[email protected]>
[ Upstream commit fa4e7fc1386078edcfddd8848cb0374f4af74fe7 ]
xsdfec_poll() is defined as returning 'unsigned int' but the .poll method is declared as returning '__poll_t', a bitwise type.
Fix this by using the proper return type and using the EPOLL constants instead of the POLL ones, as required for __poll_t.
--- drivers/misc/xilinx_sdfec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/misc/xilinx_sdfec.c +5 -5
@@ -1025,25 +1025,25 @@ static long xsdfec_dev_compat_ioctl(struct file *file, unsigned int cmd, }#endif -static unsigned int xsdfec_poll (struct file *file,poll_table *wait) +static __poll_t xsdfec_poll (struct file *file,poll_table *wait) { -unsigned int mask =0 ; +__poll_t mask =0 ;struct xsdfec_dev *xsdfec; xsdfec = container_of(file->private_data, struct xsdfec_dev, miscdev);if (!xsdfec) -return POLLNVAL |POLLHUP ; +return EPOLLNVAL |EPOLLHUP ;poll_wait (file, &xsdfec->waitq, wait);/* XSDFEC ISR detected an error */ spin_lock_irqsave (&xsdfec->error_data_lock, xsdfec->flags);if (xsdfec->state_updated) - mask |=POLLIN |POLLPRI ; + mask |=EPOLLIN |EPOLLPRI ;if (xsdfec->stats_updated) - mask |=POLLIN |POLLRDNORM ; + mask |=EPOLLIN |EPOLLRDNORM ;spin_unlock_irqrestore (&xsdfec->error_data_lock, xsdfec->flags);return mask;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 250/399 driver core: platform: Prevent resouce overflow from causing infinite loops
In reply to Greg Kroah-HartmanFrom: Simon Schwartz <[email protected]>
[ Upstream commit 39cc539f90d035a293240c9443af50be55ee81b8 ]
num_resources in the platform_device struct is declared as a u32. The for loops that iterate over num_resources use an int as the counter, which can cause infinite loops on architectures with smaller ints. Change the loop counters to u32.
--- drivers/base/platform.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/base/platform.c +6 -4
@@ -27,6 +27,7 @@#include <linux/limits.h> #include <linux/property.h> #include <linux/kmemleak.h> +#include <linux/types.h> #include "base.h" #include "power/power.h"
@@ -48,7 +49,7 @@ EXPORT_SYMBOL_GPL(platform_bus);struct resource *platform_get_resource (struct platform_device *dev,unsigned int type,unsigned int num) { -int i; +u32 i;for (i =0 ; i < dev->num_resources; i++) {struct resource *r = &dev->resource[i];
@@ -255,7 +256,7 @@ struct resource *platform_get_resource_byname(struct platform_device *dev,unsigned int type, const char *name) { - int i; + u32 i;for (i =0 ; i < dev->num_resources; i++) {struct resource *r = &dev->resource[i];
@@ -501,7 +502,8 @@ EXPORT_SYMBOL_GPL(platform_device_add_properties);*/ int platform_device_add (struct platform_device *pdev) { -int i, ret; +u32 i; +int ret;if (!pdev)return -EINVAL ;
@@ -590,7 +592,7 @@ EXPORT_SYMBOL_GPL(platform_device_add);*/ void platform_device_del (struct platform_device *pdev) { -int i; +u32 i;if (!IS_ERR_OR_NULL (pdev)) {device_del (&pdev->dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 252/399 ASoC: SOF: Intel: hda-dai: fix compilation warning in pcm_prepare
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit d873997192ddcacb5333575502be2f91ea4b47b8 ]
Fix GCC warning with W=1, previous cleanup did not remove unnecessary variable.
sound/soc/sof/intel/hda-dai.c: In function ‘hda_link_pcm_prepare’:
sound/soc/sof/intel/hda-dai.c:265:31: warning: variable ‘hda_stream’ set but not used [-Wunused-but-set-variable]
265 | struct sof_intel_hda_stream *hda_stream;
| ^~~~~~~~~~--- sound/soc/sof/intel/hda-dai.c | 3 --- 1 file changed, 3 deletions(-)
sound/soc/sof/intel/hda-dai.c +0 -3
@@ -261,14 +261,11 @@ static int hda_link_pcm_prepare(struct snd_pcm_substream *substream, {struct hdac_ext_stream *link_dev =snd_soc_dai_get_dma_data (dai, substream); -struct sof_intel_hda_stream *hda_stream;struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component);struct snd_soc_pcm_runtime *rtd =snd_pcm_substream_chip (substream);int stream = substream->stream; - hda_stream =hstream_to_sof_hda_stream (link_dev); -if (link_dev->link_prepared)return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 235/399 clocksource: davinci: only enable clockevents once tim34 is initialized
In reply to Greg Kroah-HartmanFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit cea931c25104e6bddc42eb067f58193f355dbdd7 ]
The DM365 platform has a strange quirk (only present when using ancient u-boot - mainline u-boot v2013.01 and later works fine) where if we enable the second half of the timer in periodic mode before we do its initialization - the time won't start flowing and we can't boot.
When using more recent u-boot, we can enable the timer, then reinitialize it and all works fine.
To work around this issue only enable clockevents once tim34 is initialized i.e. move clockevents_config_and_register() below tim34 initialization.
--- drivers/clocksource/timer-davinci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clocksource/timer-davinci.c +4 -4
@@ -302,10 +302,6 @@ int __init davinci_timer_register(struct clk *clk,return rv; } -clockevents_config_and_register (&clockevent->dev, tick_rate, -DAVINCI_TIMER_MIN_DELTA , -DAVINCI_TIMER_MAX_DELTA ); - davinci_clocksource.dev.rating =300 ; davinci_clocksource.dev.read = davinci_clocksource_read; davinci_clocksource.dev.mask =
@@ -323,6 +319,10 @@ int __init davinci_timer_register(struct clk *clk,davinci_clocksource_init_tim34 (base); } +clockevents_config_and_register (&clockevent->dev, tick_rate, +DAVINCI_TIMER_MIN_DELTA , +DAVINCI_TIMER_MAX_DELTA ); + rv =clocksource_register_hz (&davinci_clocksource.dev, tick_rate);if (rv) {pr_err ("Unable to register clocksource" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 253/399 bpf: Return -EBADRQC for invalid map type in __bpf_tx_xdp_map
In reply to Greg Kroah-HartmanFrom: Li RongQing <[email protected]>
[ Upstream commit 0a29275b6300f39f78a87f2038bbfe5bdbaeca47 ]
A negative value should be returned if map->map_type is invalid although that is impossible now, but if we run into such situation in future, then xdpbuff could be leaked.
Daniel Borkmann suggested:
-EBADRQC should be returned to stay consistent with generic XDP for the tracepoint output and not to be confused with -EOPNOTSUPP from other locations like dev_map_enqueue() when ndo_xdp_xmit is missing and such.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -3543,7 +3543,7 @@ static int __bpf_tx_xdp_map(struct net_device *dev_rx, void *fwd,return err; }default : -break ; +return -EBADRQC ; }return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 254/399 vme: bridges: reduce stack usage
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7483e7a939c074d887450ef1c4d9ccc5909405f8 ]
With CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3, the stack usage in vme_fake grows above the warning limit:
drivers/vme/bridges/vme_fake.c: In function 'fake_master_read':drivers/vme/bridges/vme_fake.c:610:1: error: the frame size of 1160 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] drivers/vme/bridges/vme_fake.c: In function 'fake_master_write':drivers/vme/bridges/vme_fake.c:797:1: error: the frame size of 1160 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
The problem is that in some configurations, each call to fake_vmereadX() puts another variable on the stack.
Reduce the amount of inlining to get back to the previous state, with no function using more than 200 bytes each.
--- drivers/vme/bridges/vme_fake.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/vme/bridges/vme_fake.c +18 -12
@@ -414,8 +414,9 @@ static void fake_lm_check(struct fake_driver *bridge, unsigned long long addr, } } -static u8 fake_vmeread8 (struct fake_driver *bridge,unsigned long long addr, -u32 aspace,u32 cycle) +static noinline_for_stack u8 fake_vmeread8(struct fake_driver *bridge, +unsigned long long addr, +u32 aspace,u32 cycle) {u8 retval =0xff ;int i;
@@ -446,8 +447,9 @@ static u8 fake_vmeread8(struct fake_driver *bridge, unsigned long long addr,return retval; } -static u16 fake_vmeread16 (struct fake_driver *bridge,unsigned long long addr, -u32 aspace,u32 cycle) +static noinline_for_stack u16 fake_vmeread16(struct fake_driver *bridge, +unsigned long long addr, +u32 aspace,u32 cycle) {u16 retval =0xffff ;int i;
@@ -478,8 +480,9 @@ static u16 fake_vmeread16(struct fake_driver *bridge, unsigned long long addr,return retval; } -static u32 fake_vmeread32 (struct fake_driver *bridge,unsigned long long addr, -u32 aspace,u32 cycle) +static noinline_for_stack u32 fake_vmeread32(struct fake_driver *bridge, +unsigned long long addr, +u32 aspace,u32 cycle) {u32 retval =0xffffffff ;int i;
@@ -609,8 +612,9 @@ out:return retval; } -static void fake_vmewrite8 (struct fake_driver *bridge,u8 *buf, -unsigned long long addr,u32 aspace,u32 cycle) +static noinline_for_stack void fake_vmewrite8(struct fake_driver *bridge, +u8 *buf,unsigned long long addr, +u32 aspace,u32 cycle) {int i;unsigned long long start, end, offset;
@@ -639,8 +643,9 @@ static void fake_vmewrite8(struct fake_driver *bridge, u8 *buf, } -static void fake_vmewrite16 (struct fake_driver *bridge,u16 *buf, -unsigned long long addr,u32 aspace,u32 cycle) +static noinline_for_stack void fake_vmewrite16(struct fake_driver *bridge, +u16 *buf,unsigned long long addr, +u32 aspace,u32 cycle) {int i;unsigned long long start, end, offset;
@@ -669,8 +674,9 @@ static void fake_vmewrite16(struct fake_driver *bridge, u16 *buf, } -static void fake_vmewrite32 (struct fake_driver *bridge,u32 *buf, -unsigned long long addr,u32 aspace,u32 cycle) +static noinline_for_stack void fake_vmewrite32(struct fake_driver *bridge, +u32 *buf,unsigned long long addr, +u32 aspace,u32 cycle) {int i;unsigned long long start, end, offset;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 255/399 MIPS: ralink: dts: gardena_smart_gateway_mt7688: Limit UART1
In reply to Greg Kroah-HartmanFrom: Reto Schneider <[email protected]>
[ Upstream commit e8c192011c920517e5578d51c7aff0ecadd25de3 ]
The radio module asserts CTS when its RX buffer has 10 bytes left. Putting just 8 instead of 16 bytes into the UART1 TX buffer on the Linux side ensures to not overflow the RX buffer on the radio module side.
--- arch/mips/boot/dts/ralink/gardena_smart_gateway_mt7688.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/boot/dts/ralink/gardena_smart_gateway_mt7688.dts +3 -0
@@ -177,6 +177,9 @@ pinctrl-names = "default"; pinctrl-0 = <&pinmux_i2s_gpio>; /* GPIO0..3 */ + fifo-size = <8>; + tx-threshold = <8>; + rts-gpios = <&gpio 1 GPIO_ACTIVE_LOW>; cts-gpios = <&gpio 2 GPIO_ACTIVE_LOW>; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 256/399 drm/nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3613a9bea95a1470dd42e4ed1cc7d86ebe0a2dc0 ]
We accidentally set "psb" which is a no-op instead of "*psb" so it generates a static checker warning. We should probably set it before the first error return so that it's always initialized.
--- drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c +2 -3
@@ -108,6 +108,7 @@ gm20b_secboot_new(struct nvkm_device *device, int index,struct gm200_secboot *gsb;struct nvkm_acr *acr; + *psb =NULL ; acr =acr_r352_new (BIT (NVKM_SECBOOT_FALCON_FECS ) |BIT (NVKM_SECBOOT_FALCON_PMU ));if (IS_ERR (acr))
@@ -116,10 +117,8 @@ gm20b_secboot_new(struct nvkm_device *device, int index, acr->optional_falcons =BIT (NVKM_SECBOOT_FALCON_PMU ); gsb =kzalloc (sizeof (*gsb),GFP_KERNEL ); -if (!gsb) { - psb =NULL ; +if (!gsb)return -ENOMEM ; - } *psb = &gsb->base; ret =nvkm_secboot_ctor (&gm20b_secboot, acr, device, index, &gsb->base);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 257/399 drm/nouveau/gr/gk20a,gm200-: add terminators to method lists read from fw
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit 7adc77aa0e11f25b0e762859219c70852cd8d56f ]
Method init is typically ordered by class in the FW image as ThreeD, TwoD, Compute.
Due to a bug in parsing the FW into our internal format, we've been accidentally sending Twod + Compute methods to the ThreeD class, as well as Compute methods to the TwoD class - oops.
--- .../gpu/drm/nouveau/nvkm/engine/gr/gk20a.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c +11 -10
@@ -143,23 +143,24 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name, nent = (fuc.size /sizeof (struct gk20a_fw_av )); - pack =vzalloc ((sizeof (*pack) * max_classes) + - (sizeof (*init) * (nent +1 ))); + pack =vzalloc ((sizeof (*pack) * (max_classes +1 )) + + (sizeof (*init) * (nent + max_classes +1 )));if (!pack) { ret = -ENOMEM ; goto end; } - init = (void *)(pack + max_classes); + init = (void *)(pack + max_classes +1 ); -for (i =0 ; i < nent; i++) { -struct gf100_gr_init *ent = &init[i]; +for (i =0 ; i < nent; i++, init++) {struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc.data)[i];u32 class = av->addr &0xffff ;u32 addr = (av->addr &0xffff0000 ) >>14 ;if (prevclass != class) { - pack[classidx].init = ent; +if (prevclass)/* Add terminator to the method list. */ + init++; + pack[classidx].init = init; pack[classidx].type = class; prevclass = class;if (++classidx >= max_classes) {
@@ -169,10 +170,10 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name, } } - ent->addr = addr; - ent->data = av->data; - ent->count =1 ; - ent->pitch =1 ; + init->addr = addr; + init->data = av->data; + init->count =1 ; + init->pitch =1 ; } *ppack = pack;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 259/399 drm/nouveau/drm/ttm: Remove set but not used variable mem
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 2e4534a22794746b11a794b2229b8d58797eccce ]
drivers/gpu/drm/nouveau/nouveau_ttm.c: In function nouveau_vram_manager_new:drivers/gpu/drm/nouveau/nouveau_ttm.c:66:22: warning: variable mem set but not used [-Wunused-but-set-variable] drivers/gpu/drm/nouveau/nouveau_ttm.c: In function nouveau_gart_manager_new:drivers/gpu/drm/nouveau/nouveau_ttm.c:106:22: warning: variable mem set but not used [-Wunused-but-set-variable]
They are not used any more, so remove it.
--- drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/nouveau/nouveau_ttm.c +0 -4
@@ -63,14 +63,12 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, {struct nouveau_bo *nvbo =nouveau_bo (bo);struct nouveau_drm *drm =nouveau_bdev (bo->bdev); -struct nouveau_mem *mem;int ret;if (drm->client.device.info.ram_size ==0 )return -ENOMEM ; ret =nouveau_mem_new (&drm->master, nvbo->kind, nvbo->comp, reg); - mem =nouveau_mem (reg);if (ret)return ret;
@@ -103,11 +101,9 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man, {struct nouveau_bo *nvbo =nouveau_bo (bo);struct nouveau_drm *drm =nouveau_bdev (bo->bdev); -struct nouveau_mem *mem;int ret; ret =nouveau_mem_new (&drm->master, nvbo->kind, nvbo->comp, reg); - mem =nouveau_mem (reg);if (ret)return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 260/399 drm/nouveau/fault/gv100-: fix memory leak on module unload
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit 633cc9beeb6f9b5fa2f17a2a9d0e2790cb6c3de7 ]
--- drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c +1 -0
@@ -146,6 +146,7 @@ nvkm_fault_dtor(struct nvkm_subdev *subdev)struct nvkm_fault *fault =nvkm_fault (subdev);int i; +nvkm_notify_fini (&fault->nrpfb);nvkm_event_fini (&fault->event);for (i =0 ; i < fault->buffer_nr; i++) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 261/399 dm thin: dont allow changing data device during thin-pool reload
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 873937e75f9a8ea231a502c3d29d9cb6ad91b3ef ]
The existing code allows changing the data device when the thin-pool target is reloaded.
This capability is not required and only complicates device lifetime guarantees. This can cause crashes like the one reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=1788596
where the kernel tries to issue a flush bio located in a structure that was already freed.
Take the first step to simplifying the thin-pool's data device lifetime by disallowing changing it. Like the thin-pool's metadata device, the data device is now set in pool_create() and it cannot be changed for a given thin-pool.
--- drivers/md/dm-thin.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/md/dm-thin.c +13 -5
@@ -231,6 +231,7 @@ struct pool {struct dm_target *ti;/* Only set if a pool target is bound */ struct mapped_device *pool_md; +struct block_device *data_dev;struct block_device *md_dev;struct dm_pool_metadata *pmd;
@@ -2933,6 +2934,7 @@ static struct kmem_cache *_new_mapping_cache;static struct pool *pool_create (struct mapped_device *pool_md,struct block_device *metadata_dev, +struct block_device *data_dev,unsigned long block_size,int read_only,char **error) {
@@ -3040,6 +3042,7 @@ static struct pool *pool_create(struct mapped_device *pool_md, pool->last_commit_jiffies = jiffies; pool->pool_md = pool_md; pool->md_dev = metadata_dev; + pool->data_dev = data_dev;__pool_table_insert (pool);return pool;
@@ -3081,6 +3084,7 @@ static void __pool_dec(struct pool *pool)static struct pool *__pool_find (struct mapped_device *pool_md,struct block_device *metadata_dev, +struct block_device *data_dev,unsigned long block_size,int read_only,char **error,int *created) {
@@ -3091,19 +3095,23 @@ static struct pool *__pool_find(struct mapped_device *pool_md, *error ="metadata device already in use by a pool" ;return ERR_PTR (-EBUSY ); } +if (pool->data_dev != data_dev) { + *error ="data device already in use by a pool" ; +return ERR_PTR (-EBUSY ); + }__pool_inc (pool); }else { pool =__pool_table_lookup (pool_md);if (pool) { -if (pool->md_dev != metadata_dev) { +if (pool->md_dev != metadata_dev || pool->data_dev != data_dev) { *error ="different pool cannot replace a pool" ;return ERR_PTR (-EINVAL ); }__pool_inc (pool); }else { - pool =pool_create (pool_md, metadata_dev, block_size, read_only, error); + pool =pool_create (pool_md, metadata_dev, data_dev, block_size, read_only, error); *created =1 ; } }
@@ -3356,7 +3364,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) goto out; } - pool =__pool_find (dm_table_get_md (ti->table), metadata_dev->bdev, + pool =__pool_find (dm_table_get_md (ti->table), metadata_dev->bdev, data_dev->bdev, block_size, pf.mode ==PM_READ_ONLY , &ti->error, &pool_created);if (IS_ERR (pool)) { r =PTR_ERR (pool);
@@ -4098,7 +4106,7 @@ static struct target_type pool_target = { .name = "thin-pool", .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | DM_TARGET_IMMUTABLE, - .version = {1, 21, 0}, + .version = {1, 22, 0}, .module = THIS_MODULE, .ctr = pool_ctr, .dtr = pool_dtr,
@@ -4475,7 +4483,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits)static struct target_type thin_target = { .name ="thin" , - .version = {1 ,21 ,0 }, + .version = {1 ,22 ,0 }, .module =THIS_MODULE , .ctr = thin_ctr, .dtr = thin_dtr,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 262/399 gpiolib: Set lockdep class for hierarchical irq domains
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit c34f6dc8c9e6bbe9fba1d53acd6d9a3889599da3 ]
I see the following lockdep splat in the qcom pinctrl driver when attempting to suspend the device.
============================================
WARNING: possible recursive locking detected
5.4.2 #2 Tainted: G S
--------------------------------------------
cat/6536 is trying to acquire lock:
ffffff814787ccc0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x64/0x94
but task is already holding lock:
ffffff81436740c0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x64/0x94
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&irq_desc_lock_class);
lock(&irq_desc_lock_class);
*** DEADLOCK ***
May be due to missing lock nesting notation
7 locks held by cat/6536:
#0: ffffff8140e0c420 (sb_writers#7){.+.+}, at: vfs_write+0xc8/0x19c #1: ffffff8121eec480 (&of->mutex){+.+.}, at: kernfs_fop_write+0x128/0x1f4 #2: ffffff8147cad668 (kn->count#263){.+.+}, at: kernfs_fop_write+0x130/0x1f4 #3: ffffffd011446000 (system_transition_mutex){+.+.}, at: pm_suspend+0x108/0x354 #4: ffffff814302b970 (&dev->mutex){....}, at: __device_suspend+0x16c/0x420 #5: ffffff81436740c0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x64/0x94 #6: ffffff81479b8c10 (&pctrl->lock){....}, at: msm_gpio_irq_set_wake+0x48/0x7c
stack backtrace: CPU: 4 PID: 6536 Comm: cat Tainted: G S 5.4.2 #2 Call trace: dump_backtrace+0x0/0x174 show_stack+0x20/0x2c dump_stack+0xdc/0x144 __lock_acquire+0x52c/0x2268 lock_acquire+0x1dc/0x220 _raw_spin_lock_irqsave+0x64/0x80 __irq_get_desc_lock+0x64/0x94 irq_set_irq_wake+0x40/0x144 msm_gpio_irq_set_wake+0x5c/0x7c set_irq_wake_real+0x40/0x5c irq_set_irq_wake+0x70/0x144 cros_ec_rtc_suspend+0x38/0x4c platform_pm_suspend+0x34/0x60 dpm_run_callback+0x64/0xcc __device_suspend+0x314/0x420 dpm_suspend+0xf8/0x298 dpm_suspend_start+0x84/0xb4 suspend_devices_and_enter+0xbc/0x628 pm_suspend+0x214/0x354 state_store+0xb0/0x108 kobj_attr_store+0x14/0x24 sysfs_kf_write+0x4c/0x64 kernfs_fop_write+0x158/0x1f4 __vfs_write+0x54/0x18c vfs_write+0xdc/0x19c ksys_write+0x7c/0xe4 __arm64_sys_write+0x20/0x2c el0_svc_common+0xa8/0x160 el0_svc_compat_handler+0x2c/0x38 el0_svc_compat+0x8/0x10
This is because the msm_gpio_irq_set_wake() function calls irq_set_irq_wake() as a backup in case the irq comes in during the path to idle. Given that we're calling irqchip functions from within an irqchip we need to set the lockdep class to be different for this child controller vs. the default one that the parent irqchip gets.
This used to be done before this driver was converted to hierarchical irq domains in commit e35a6ae0eb3a ("pinctrl/msm: Setup GPIO chip in hierarchy") via the gpiochip_irq_map() function. With hierarchical irq domains this function has been replaced by gpiochip_hierarchy_irq_domain_alloc(). Therefore, set the lockdep class like was done previously in the irq domain path so we can avoid this lockdep warning.
--- drivers/gpio/gpiolib.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpiolib.c +1 -0
@@ -2053,6 +2053,7 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d, parent_type);chip_info (gc,"alloc_irqs_parent for %d parent hwirq %d\n" , irq, parent_hwirq); +irq_set_lockdep_class (irq, gc->irq.lock_key, gc->irq.request_key); ret =irq_domain_alloc_irqs_parent (d, irq,1 , &parent_fwspec);if (ret) chip_err(gc,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 264/399 perf/imx_ddr: Fix cpu hotplug state cleanup
In reply to Greg Kroah-HartmanFrom: Leonard Crestez <[email protected]>
[ Upstream commit 9ee68b314e9aa63ed11b98beb8a68810b8234dcf ]
This driver allocates a dynamic cpu hotplug state but never releases it. If reloaded in a loop it will quickly trigger a WARN message:
"No more dynamic states available for CPU hotplug"
Fix by calling cpuhp_remove_multi_state on remove like several other perf pmu drivers.
Also fix the cleanup logic on probe error paths: add the missing cpuhp_remove_multi_state call and properly check the return value from cpuhp_state_add_instant_nocalls.
--- drivers/perf/fsl_imx8_ddr_perf.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/perf/fsl_imx8_ddr_perf.c +11 -5
@@ -633,13 +633,17 @@ static int ddr_perf_probe(struct platform_device *pdev)if (ret <0 ) {dev_err (&pdev->dev,"cpuhp_setup_state_multi failed\n" ); - goto ddr_perf_err; + goto cpuhp_state_err; } pmu->cpuhp_state = ret;/* Register the pmu instance for cpu hotplug */ -cpuhp_state_add_instance_nocalls (pmu->cpuhp_state, &pmu->node); + ret =cpuhp_state_add_instance_nocalls (pmu->cpuhp_state, &pmu->node); +if (ret) { +dev_err (&pdev->dev,"Error %d registering hotplug\n" , ret); + goto cpuhp_instance_err; + }/* Request irq */ irq =of_irq_get (np,0 );
@@ -673,9 +677,10 @@ static int ddr_perf_probe(struct platform_device *pdev)return 0 ; ddr_perf_err: -if (pmu->cpuhp_state) -cpuhp_state_remove_instance_nocalls (pmu->cpuhp_state, &pmu->node); - +cpuhp_state_remove_instance_nocalls (pmu->cpuhp_state, &pmu->node); +cpuhp_instance_err: +cpuhp_remove_multi_state (pmu->cpuhp_state); +cpuhp_state_err:ida_simple_remove (&ddr_ida, pmu->id);dev_warn (&pdev->dev,"i.MX8 DDR Perf PMU failed (%d), disabled\n" , ret);return ret;
@@ -686,6 +691,7 @@ static int ddr_perf_remove(struct platform_device *pdev)struct ddr_pmu *pmu =platform_get_drvdata (pdev);cpuhp_state_remove_instance_nocalls (pmu->cpuhp_state, &pmu->node); +cpuhp_remove_multi_state (pmu->cpuhp_state);irq_set_affinity_hint (pmu->irq,NULL );perf_pmu_unregister (&pmu->pmu);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 265/399 usb: musb: omap2430: Get rid of musb .set_vbus for omap2430 glue
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 91b6dec32e5c25fbdbb564d1e5af23764ec17ef1 ]
We currently have musb_set_vbus() called from two different paths. Mostly it gets called from the USB PHY via omap_musb_set_mailbox(), but in some cases it can get also called from musb_stage0_irq() rather via .set_vbus:
(musb_set_host [musb_hdrc])
(omap2430_musb_set_vbus [omap2430])
(musb_stage0_irq [musb_hdrc])
(musb_interrupt [musb_hdrc])
(omap2430_musb_interrupt [omap2430])
This is racy and will not work with introducing generic helper functions for musb_set_host() and musb_set_peripheral(). We want to get rid of the busy loops in favor of usleep_range().
Let's just get rid of .set_vbus for omap2430 glue layer and let the PHY code handle VBUS with musb_set_vbus(). Note that in the follow-up patch we can completely remove omap2430_musb_set_vbus(), but let's do it in a separate patch as this change may actually turn out to be needed as a fix.
--- drivers/usb/musb/omap2430.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/musb/omap2430.c +0 -2
@@ -361,8 +361,6 @@ static const struct musb_platform_ops omap2430_ops = { .init = omap2430_musb_init, .exit = omap2430_musb_exit, - .set_vbus = omap2430_musb_set_vbus, - .enable = omap2430_musb_enable, .disable = omap2430_musb_disable,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 266/399 kbuild: remove *.tmp file when filechk fails
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 88fe89a47153facd8cb2d06d5c8727f7224c43c2 ]
Bartosz Golaszewski reports that when "make {menu,n,g,x}config" fails due to missing packages, a temporary file is left over, which is not ignored by git.
For example, if GTK+ is not installed:
$ make gconfig
*
* Unable to find the GTK+ installation. Please make sure that
* the GTK+ 2.0 development package is correctly installed.
* You need gtk+-2.0 gmodule-2.0 libglade-2.0
*
scripts/kconfig/Makefile:208: recipe for target 'scripts/kconfig/gconf-cfg' failed
make[1]: *** [scripts/kconfig/gconf-cfg] Error 1
Makefile:567: recipe for target 'gconfig' failed
make: *** [gconfig] Error 2
$ git status
HEAD detached at v5.4
Untracked files:
(use "git add <file>..." to include in what will be committed) scripts/kconfig/gconf-cfg.tmp
nothing added to commit but untracked files present (use "git add" to track)
This is because the check scripts are run with filechk, which misses to clean up the temporary file on failure.
When the line
{ $(filechk_$(1)); } > [email protected];... fails, it exits immediately due to the 'set -e'. Use trap to make sure to delete the temporary file on exit.
For extra safety, I replaced [email protected] with $(dot-target).tmp to make it a hidden file.
--- scripts/Kbuild.include | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
scripts/Kbuild.include +7 -8
@@ -55,14 +55,13 @@ kecho := $($(quiet)kecho) # - stdin is piped in from the first prerequisite ($<) so one has # to specify a valid file as first prerequisite (often the kbuild file) define filechk - $(Q)set -e; \ - mkdir -p $(dir $@); \ - { $(filechk_$(1)); } > [email protected]; \ - if [ -r $@ ] && cmp -s $@ [email protected]; then \ - rm -f [email protected]; \ - else \ - $(kecho) ' UPD $@'; \ - mv -f [email protected] $@; \ + $(Q)set -e; \ + mkdir -p $(dir $@); \ + trap "rm -f $(dot-target).tmp" EXIT; \ + { $(filechk_$(1)); } > $(dot-target).tmp; \ + if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then \ + $(kecho) ' UPD $@'; \ + mv -f $(dot-target).tmp $@; \ fi endef
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 267/399 iommu/arm-smmu-v3: Use WRITE_ONCE() when changing validity of an STE
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
[ Upstream commit d71e01716b3606a6648df7e5646ae12c75babde4 ]
If, for some bizarre reason, the compiler decided to split up the write of STE DWORD 0, we could end up making a partial structure valid.
Although this probably won't happen, follow the example of the context-descriptor code and use WRITE_ONCE() to ensure atomicity of the write.
--- drivers/iommu/arm-smmu-v3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/arm-smmu-v3.c +2 -1
@@ -1643,7 +1643,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, STRTAB_STE_1_EATS_TRANS));arm_smmu_sync_ste_for_sid (smmu, sid); - dst[0 ] =cpu_to_le64 (val); +/* See comment in arm_smmu_write_ctx_desc() */ +WRITE_ONCE (dst[0 ],cpu_to_le64 (val));arm_smmu_sync_ste_for_sid (smmu, sid);/* It's likely that we'll want to use the new STE soon */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 268/399 ALSA: usb-audio: unlock on error in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit a3afa29942b84b4e2548beacccc3a68b8d77e3dc ]
We need to unlock before we returning on this error path.
--- sound/usb/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/card.c +1 -1
@@ -602,7 +602,7 @@ static int usb_audio_probe(struct usb_interface *intf,if (! chip) { err =snd_usb_apply_boot_quirk_once (dev, intf, quirk, id);if (err <0 ) -return err; + goto __error;/* it's a fresh one. * now look for an empty slot and create a new card instance
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 269/399 f2fs: set I_LINKABLE early to avoid wrong access by vfs
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit 5b1dbb082f196278f82b6a15a13848efacb9ff11 ]
This patch moves setting I_LINKABLE early in rename2(whiteout) to avoid the below warning.
[ 3189.163385] WARNING: CPU: 3 PID: 59523 at fs/inode.c:358 inc_nlink+0x32/0x40 [ 3189.246979] Call Trace: [ 3189.248707] f2fs_init_inode_metadata+0x2d6/0x440 [f2fs] [ 3189.251399] f2fs_add_inline_entry+0x162/0x8c0 [f2fs] [ 3189.254010] f2fs_add_dentry+0x69/0xe0 [f2fs] [ 3189.256353] f2fs_do_add_link+0xc5/0x100 [f2fs] [ 3189.258774] f2fs_rename2+0xabf/0x1010 [f2fs] [ 3189.261079] vfs_rename+0x3f8/0xaa0 [ 3189.263056] ? tomoyo_path_rename+0x44/0x60 [ 3189.265283] ? do_renameat2+0x49b/0x550 [ 3189.267324] do_renameat2+0x49b/0x550 [ 3189.269316] __x64_sys_renameat2+0x20/0x30 [ 3189.271441] do_syscall_64+0x5a/0x230 [ 3189.273410] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 3189.275848] RIP: 0033:0x7f270b4d9a49
--- fs/f2fs/namei.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
fs/f2fs/namei.c +13 -14
@@ -797,6 +797,7 @@ static int __f2fs_tmpfile(struct inode *dir, struct dentry *dentry,if (whiteout) {f2fs_i_links_write (inode, false); + inode->i_state |=I_LINKABLE ; *whiteout = inode; }else {d_tmpfile (dentry, inode);
@@ -867,6 +868,12 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, F2FS_I(old_dentry->d_inode)->i_projid)))return -EXDEV ; +if (flags &RENAME_WHITEOUT ) { + err =f2fs_create_whiteout (old_dir, &whiteout); +if (err) +return err; + } + err =dquot_initialize (old_dir);if (err) goto out;
@@ -898,17 +905,11 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, } } -if (flags &RENAME_WHITEOUT ) { - err =f2fs_create_whiteout (old_dir, &whiteout); -if (err) - goto out_dir; - } -if (new_inode) { err = -ENOTEMPTY ;if (old_dir_entry && !f2fs_empty_dir (new_inode)) - goto out_whiteout; + goto out_dir; err = -ENOENT ; new_entry = f2fs_find_entry(new_dir, &new_dentry->d_name,
@@ -916,7 +917,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,if (!new_entry) {if (IS_ERR (new_page)) err =PTR_ERR (new_page); - goto out_whiteout; + goto out_dir; }f2fs_balance_fs (sbi, true);
@@ -948,7 +949,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, err =f2fs_add_link (new_dentry, old_inode);if (err) {f2fs_unlock_op (sbi); - goto out_whiteout; + goto out_dir; }if (old_dir_entry)
@@ -972,7 +973,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,if (IS_ERR (old_page)) err =PTR_ERR (old_page);f2fs_unlock_op (sbi); - goto out_whiteout; + goto out_dir; } } }
@@ -991,7 +992,6 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,f2fs_delete_entry (old_entry, old_page, old_dir,NULL );if (whiteout) { - whiteout->i_state |=I_LINKABLE ;set_inode_flag (whiteout,FI_INC_LINK ); err =f2fs_add_link (old_dentry, whiteout);if (err)
@@ -1027,15 +1027,14 @@ put_out_dir:f2fs_unlock_op (sbi);if (new_page)f2fs_put_page (new_page,0 ); -out_whiteout: -if (whiteout) -iput (whiteout); out_dir:if (old_dir_entry)f2fs_put_page (old_dir_page,0 ); out_old:f2fs_put_page (old_page,0 ); out: +if (whiteout) +iput (whiteout);return err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 270/399 f2fs: free sysfs kobject
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
[ Upstream commit 820d366736c949ffe698d3b3fe1266a91da1766d ]
Detected kmemleak.
--- fs/f2fs/sysfs.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/sysfs.c +1 -0
@@ -786,4 +786,5 @@ void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)remove_proc_entry (sbi->sb->s_id, f2fs_proc_root); }kobject_del (&sbi->s_kobj); +kobject_put (&sbi->s_kobj); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 271/399 scsi: ufs: pass device information to apply_dev_quirks
In reply to Greg Kroah-HartmanFrom: Stanley Chu <[email protected]>
[ Upstream commit c40ad6b7fcd35bc4d36db820c7737e1aa18d5d41 ]
Pass UFS device information to vendor-specific variant callback "apply_dev_quirks" because some platform vendors need to know such information to apply special handling or quirks in specific devices.
At the same time, modify existing vendor implementations according to the new interface for those vendor drivers which will be built-in or built as a module alone with UFS core driver.
[mkp: clarified commit desc]
--- drivers/scsi/ufs/ufs-qcom.c | 3 ++- drivers/scsi/ufs/ufshcd.c | 8 ++++---- drivers/scsi/ufs/ufshcd.h | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +2 -1
@@ -949,7 +949,8 @@ out:return err; } -static int ufs_qcom_apply_dev_quirks (struct ufs_hba *hba) +static int ufs_qcom_apply_dev_quirks (struct ufs_hba *hba, +struct ufs_dev_desc *card) {int err =0 ;
drivers/scsi/ufs/ufshcd.c +4 -4
@@ -6798,7 +6798,8 @@ out:return ret; } -static void ufshcd_tune_unipro_params (struct ufs_hba *hba) +static void ufshcd_tune_unipro_params (struct ufs_hba *hba, +struct ufs_dev_desc *card) {if (ufshcd_is_unipro_pa_params_tuning_req (hba)) {ufshcd_tune_pa_tactivate (hba);
@@ -6812,7 +6813,7 @@ static void ufshcd_tune_unipro_params(struct ufs_hba *hba)if (hba->dev_quirks &UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE )ufshcd_quirk_tune_host_pa_tactivate (hba); -ufshcd_vops_apply_dev_quirks (hba); +ufshcd_vops_apply_dev_quirks (hba, card); }static void ufshcd_clear_dbg_ufs_stats (struct ufs_hba *hba)
@@ -6975,10 +6976,9 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) }ufs_fixup_device_setup (hba, &card); +ufshcd_tune_unipro_params (hba, &card);ufs_put_device_desc (&card); -ufshcd_tune_unipro_params (hba); -/* UFS device is also active now */ ufshcd_set_ufs_dev_active (hba);ufshcd_force_reset_auto_bkops (hba);
drivers/scsi/ufs/ufshcd.h +4 -3
@@ -322,7 +322,7 @@ struct ufs_hba_variant_ops {void (*setup_task_mgmt)(struct ufs_hba *,int ,u8 );void (*hibern8_notify)(struct ufs_hba *,enum uic_cmd_dme ,enum ufs_notify_change_status ); -int (*apply_dev_quirks)(struct ufs_hba *); +int (*apply_dev_quirks)(struct ufs_hba *,struct ufs_dev_desc *);int (*suspend)(struct ufs_hba *,enum ufs_pm_op );int (*resume)(struct ufs_hba *,enum ufs_pm_op );void (*dbg_register_dump)(struct ufs_hba *hba);
@@ -1057,10 +1057,11 @@ static inline void ufshcd_vops_hibern8_notify(struct ufs_hba *hba,return hba->vops->hibern8_notify (hba, cmd, status); } -static inline int ufshcd_vops_apply_dev_quirks (struct ufs_hba *hba) +static inline int ufshcd_vops_apply_dev_quirks (struct ufs_hba *hba, +struct ufs_dev_desc *card) {if (hba->vops && hba->vops->apply_dev_quirks) -return hba->vops->apply_dev_quirks (hba); +return hba->vops->apply_dev_quirks (hba, card);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 237/399 arm64: dts: rockchip: fix dwmmc clock name for rk3308
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit 2be6a280144e521248a4bdefb691a0a97e604294 ]
An experimental test with the command below gives this error:rk3308-evb.dt.yaml: dwmmc@ff480000: clock-names:2:
'ciu-drive' was expected
'ciu-drv' is not a valid dwmmc clock name,
so fix this by changing it to 'ciu-drive'.
make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
--- arch/arm64/boot/dts/rockchip/rk3308.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3308.dtsi +3 -3
@@ -591,7 +591,7 @@ bus-width = <4>; clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>, <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>; - clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; pinctrl-names = "default";
@@ -606,7 +606,7 @@ bus-width = <8>; clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>, <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>; - clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; status = "disabled";
@@ -619,7 +619,7 @@ bus-width = <4>; clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>, <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>; - clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; pinctrl-names = "default";
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 238/399 arm64: dts: rockchip: add reg property to brcmf sub-nodes
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit 96ff264bccb22175bbe2185a1eb5204ca3c5f03f ]
An experimental test with the command below gives this error:rk3399-firefly.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required propertyrk3399-orangepi.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required property rk3399-khadas-edge.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required property rk3399-khadas-edge-captain.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required property rk3399-khadas-edge-v.dt.yaml: dwmmc@fe310000: wifi@1:
'reg' is a required property
So fix this by adding a reg property to the brcmf sub node. Also add #address-cells and #size-cells to prevent more warnings.
make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
--- arch/arm64/boot/dts/rockchip/rk3399-firefly.dts | 3 +++ arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi | 3 +++ arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts | 3 +++ 3 files changed, 9 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-firefly.dts +3 -0
@@ -669,9 +669,12 @@ vqmmc-supply = &vcc1v8_s3; /* IO line */ vmmc-supply = &vcc_sdio; /* card's power */ + #address-cells = <1>; + #size-cells = <0>; status = "okay"; brcmf: wifi@1 { + reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&gpio0>; interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +3 -0
@@ -654,9 +654,12 @@ sd-uhs-sdr104; vqmmc-supply = <&vcc1v8_s3>; vmmc-supply = <&vccio_sd>; + #address-cells = <1>; + #size-cells = <0>; status = "okay"; brcmf: wifi@1 { + reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&gpio0>; interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +3 -0
@@ -648,9 +648,12 @@ pinctrl-names = "default"; pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; sd-uhs-sdr104; + #address-cells = <1>; + #size-cells = <0>; status = "okay"; brcmf: wifi@1 { + reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&gpio0>; interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 239/399 ARM: dts: rockchip: add reg property to brcmf sub node for rk3188-bqedison2qc
In reply to Greg Kroah-HartmanFrom: Johan Jonker <[email protected]>
[ Upstream commit cf206bca178cd5b5a436494b2e0cea75295944f4 ]
An experimental test with the command below gives this error:rk3188-bqedison2qc.dt.yaml: dwmmc@10218000: wifi@1:
'reg' is a required property
So fix this by adding a reg property to the brcmf sub node. Also add #address-cells and #size-cells to prevent more warnings.
make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
--- arch/arm/boot/dts/rk3188-bqedison2qc.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/rk3188-bqedison2qc.dts +3 -0
@@ -466,9 +466,12 @@ pinctrl-names = "default"; pinctrl-0 = <&sd1_clk>, <&sd1_cmd>, <&sd1_bus4>; vmmcq-supply = <&vccio_wl>; + #address-cells = <1>; + #size-cells = <0>; status = "okay"; brcmf: wifi@1 { + reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&gpio3>; interrupts = <RK_PD2 GPIO_ACTIVE_HIGH>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 241/399 ASoC: txx9: Remove unused rtd variable
In reply to Greg Kroah-HartmanFrom: Paul Burton <[email protected]>
[ Upstream commit ec0f6a4c4a987aa20b2e77e0db2ae555276e45e6 ]
Commit a857e073ffc6 ("ASoC: txx9: txx9aclc: remove snd_pcm_ops") removed the last use of the rtd variable but didn't remove its definition, leading to the following warning/error for MIPS rbtx49xx_defconfig builds:
sound/soc/txx9/txx9aclc.c: In function 'txx9aclc_pcm_hw_params':sound/soc/txx9/txx9aclc.c:54:30: error: unused variable 'rtd'
[-Werror=unused-variable]
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
^~~Resolve this by removing the unused variable.
--- sound/soc/txx9/txx9aclc.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/txx9/txx9aclc.c +0 -1
@@ -51,7 +51,6 @@ static int txx9aclc_pcm_hw_params(struct snd_soc_component *component,struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime;struct txx9aclc_dmadata *dmadata = runtime->private_data;int ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 242/399 ASoC: atmel: fix build error with CONFIG_SND_ATMEL_SOC_DMA=m
In reply to Greg Kroah-HartmanFrom: Chen Zhou <[email protected]>
[ Upstream commit 8fea78029f5e6ed734ae1957bef23cfda1af4354 ]
If CONFIG_SND_ATMEL_SOC_DMA=m, build error:
sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_set_audio':
(.text+0x7cd): undefined reference to `atmel_pcm_dma_platform_register'
Function atmel_pcm_dma_platform_register is defined under CONFIG SND_ATMEL_SOC_DMA, so select SND_ATMEL_SOC_DMA in CONFIG SND_ATMEL_SOC_SSC, same to CONFIG_SND_ATMEL_SOC_PDC.
--- sound/soc/atmel/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/atmel/Kconfig +2 -0
@@ -19,6 +19,8 @@ config SND_ATMEL_SOC_DMA config SND_ATMEL_SOC_SSC tristate + select SND_ATMEL_SOC_DMA + select SND_ATMEL_SOC_PDC config SND_ATMEL_SOC_SSC_PDC tristate "SoC PCM DAI support for AT91 SSC controller using PDC"
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 233/399 x86/nmi: Remove irq_work from the long duration NMI handler
In reply to Greg Kroah-HartmanFrom: Changbin Du <[email protected]>
[ Upstream commit 248ed51048c40d36728e70914e38bffd7821da57 ]
First, printk() is NMI-context safe now since the safe printk() has been implemented and it already has an irq_work to make NMI-context safe.
Second, this NMI irq_work actually does not work if a NMI handler causes panic by watchdog timeout. It has no chance to run in such case, while the safe printk() will flush its per-cpu buffers before panicking.
While at it, repurpose the irq_work callback into a function which concentrates the NMI duration checking and makes the code easier to follow.
[ bp: Massage. ]
--- arch/x86/include/asm/nmi.h | 1 - arch/x86/kernel/nmi.c | 20 +++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-)
arch/x86/include/asm/nmi.h +0 -1
@@ -41,7 +41,6 @@ struct nmiaction {struct list_head list;nmi_handler_t handler;u64 max_duration; -struct irq_work irq_work;unsigned long flags;const char *name; };
arch/x86/kernel/nmi.c +9 -11
@@ -104,18 +104,22 @@ static int __init nmi_warning_debugfs(void) }fs_initcall (nmi_warning_debugfs); -static void nmi_max_handler (struct irq_work *w) +static void nmi_check_duration (struct nmiaction *action,u64 duration) { - struct nmiaction *a = container_of(w, struct nmiaction, irq_work); +u64 whole_msecs =READ_ONCE (action->max_duration);int remainder_ns, decimal_msecs; -u64 whole_msecs =READ_ONCE (a->max_duration); + +if (duration < nmi_longest_ns || duration < action->max_duration) +return ; + + action->max_duration = duration; remainder_ns =do_div (whole_msecs, (1000 *1000 )); decimal_msecs = remainder_ns /1000 ;printk_ratelimited (KERN_INFO "INFO: NMI handler (%ps) took too long to run: %lld.%03d msecs\n" , - a->handler, whole_msecs, decimal_msecs); + action->handler, whole_msecs, decimal_msecs); }static int nmi_handle (unsigned int type,struct pt_regs *regs)
@@ -142,11 +146,7 @@ static int nmi_handle(unsigned int type, struct pt_regs *regs) delta =sched_clock () - delta;trace_nmi_handler (a->handler, (int )delta, thishandled); -if (delta < nmi_longest_ns || delta < a->max_duration) -continue ; - - a->max_duration = delta; -irq_work_queue (&a->irq_work); +nmi_check_duration (a, delta); }rcu_read_unlock ();
@@ -164,8 +164,6 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action)if (!action->handler)return -EINVAL ; -init_irq_work (&action->irq_work, nmi_max_handler); -raw_spin_lock_irqsave (&desc->lock, flags);/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 274/399 crypto: hisilicon - Update debugfs usage of SEC V2
In reply to Greg Kroah-HartmanFrom: Zaibo Xu <[email protected]>
[ Upstream commit ca0d158dc9e5dc0902c1d507d82178d97f6f5709 ]
Applied some advices of Marco Elver on atomic usage of Debugfs, which is carried out by basing on Arnd Bergmann's fixing patch.
--- drivers/crypto/hisilicon/sec2/sec.h | 2 +- drivers/crypto/hisilicon/sec2/sec_crypto.c | 8 ++++---- drivers/crypto/hisilicon/sec2/sec_main.c | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-)
drivers/crypto/hisilicon/sec2/sec.h +1 -1
@@ -40,7 +40,7 @@ struct sec_req {int req_id;/* Status of the SEC request */ -atomic_t fake_busy; +bool fake_busy; };/**
drivers/crypto/hisilicon/sec2/sec_crypto.c +4 -4
@@ -141,7 +141,7 @@ static int sec_bd_send(struct sec_ctx *ctx, struct sec_req *req)return -ENOBUFS ;if (!ret) { -if (atomic_read (&req->fake_busy)) +if (req->fake_busy) ret = -EBUSY ;else ret = -EINPROGRESS ;
@@ -641,7 +641,7 @@ static void sec_skcipher_callback(struct sec_ctx *ctx, struct sec_req *req)if (ctx->c_ctx.c_mode ==SEC_CMODE_CBC && req->c_req.encrypt)sec_update_iv (req); -if (atomic_cmpxchg (&req->fake_busy,1 ,0 ) !=1 ) +if (req->fake_busy) sk_req->base.complete (&sk_req->base, -EINPROGRESS ); sk_req->base.complete (&sk_req->base, req->err_type);
@@ -672,9 +672,9 @@ static int sec_request_init(struct sec_ctx *ctx, struct sec_req *req) }if (ctx->fake_req_limit <=atomic_inc_return (&qp_ctx->pending_reqs)) -atomic_set (&req->fake_busy,1 ); + req->fake_busy = true;else -atomic_set (&req->fake_busy,0 ); + req->fake_busy = false; ret = ctx->req_op->get_res (ctx, req);if (ret) {
drivers/crypto/hisilicon/sec2/sec_main.c +9 -9
@@ -608,13 +608,13 @@ static const struct file_operations sec_dbg_fops = { .write = sec_debug_write, }; -static int debugfs_atomic64_t_get (void *data,u64 *val) +static int sec_debugfs_atomic64_get (void *data,u64 *val) { - *val =atomic64_read ((atomic64_t *)data); -return 0 ; + *val =atomic64_read ((atomic64_t *)data); +return 0 ; } -DEFINE_DEBUGFS_ATTRIBUTE (fops_atomic64_t_ro, debugfs_atomic64_t_get,NULL , -"%lld\n" ); +DEFINE_DEBUGFS_ATTRIBUTE (sec_atomic64_ops, sec_debugfs_atomic64_get, +NULL ,"%lld\n" );static int sec_core_debug_init (struct sec_dev *sec) {
@@ -636,11 +636,11 @@ static int sec_core_debug_init(struct sec_dev *sec)debugfs_create_regset32 ("regs" ,0444 , tmp_d, regset); -debugfs_create_file ("send_cnt" ,0444 , tmp_d, &dfx->send_cnt, - &fops_atomic64_t_ro); +debugfs_create_file ("send_cnt" ,0444 , tmp_d, + &dfx->send_cnt, &sec_atomic64_ops); -debugfs_create_file ("recv_cnt" ,0444 , tmp_d, &dfx->recv_cnt, - &fops_atomic64_t_ro); +debugfs_create_file ("recv_cnt" ,0444 , tmp_d, + &dfx->recv_cnt, &sec_atomic64_ops);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 284/399 staging: wfx: fix possible overflow on jiffies comparaison
In reply to Greg Kroah-HartmanFrom: Jérôme Pouiller <[email protected]>
[ Upstream commit def39be019b6494acd3570ce6f3f11ba1c3203a3 ]
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It is recommended to use function time_*() to compare jiffies.
--- drivers/staging/wfx/data_tx.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wfx/data_tx.c +5 -9
@@ -282,8 +282,7 @@ void wfx_tx_policy_init(struct wfx_vif *wvif)static int wfx_alloc_link_id (struct wfx_vif *wvif,const u8 *mac) {int i, ret =0 ; -unsigned long max_inactivity =0 ; -unsigned long now = jiffies; +unsigned long oldest;spin_lock_bh (&wvif->ps_state_lock);for (i =0 ; i <WFX_MAX_STA_IN_AP_MODE ; ++i) {
@@ -292,13 +291,10 @@ static int wfx_alloc_link_id(struct wfx_vif *wvif, const u8 *mac)break ; }else if (wvif->link_id_db[i].status !=WFX_LINK_HARD && !wvif->wdev->tx_queue_stats.link_map_cache[i +1 ]) { -unsigned long inactivity = - now - wvif->link_id_db[i].timestamp; - -if (inactivity < max_inactivity) -continue ; - max_inactivity = inactivity; - ret = i +1 ; +if (!ret ||time_after (oldest, wvif->link_id_db[i].timestamp)) { + oldest = wvif->link_id_db[i].timestamp; + ret = i +1 ; + } } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 285/399 EDAC/sifive: Fix return value check in ecc_register()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 6cd18453b68942913fd3b1913b707646e544c2ac ]
In case of error, the function edac_device_alloc_ctl_info() returns a NULL pointer, not ERR_PTR(). Replace the IS_ERR() test in the return value check with a NULL test.
--- drivers/edac/sifive_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/sifive_edac.c +2 -2
@@ -54,8 +54,8 @@ static int ecc_register(struct platform_device *pdev) p->dci =edac_device_alloc_ctl_info (0 ,"sifive_ecc" ,1 ,"sifive_ecc" ,1 ,1 ,NULL ,0 ,edac_device_alloc_index ()); -if (IS_ERR (p->dci)) -return PTR_ERR (p->dci); +if (!p->dci) +return -ENOMEM ; p->dci->dev = &pdev->dev; p->dci->mod_name ="Sifive ECC Manager" ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 286/399 KVM: PPC: Remove set but not used variable ra, rs, rt
In reply to Greg Kroah-HartmanFrom: zhengbin <[email protected]>
[ Upstream commit 4de0a8355463e068e443b48eb5ae32370155368b ]
Fixes gcc '-Wunused-but-set-variable' warning:
arch/powerpc/kvm/emulate_loadstore.c: In function kvmppc_emulate_loadstore:arch/powerpc/kvm/emulate_loadstore.c:87:6: warning: variable ra set but not used [-Wunused-but-set-variable] arch/powerpc/kvm/emulate_loadstore.c: In function kvmppc_emulate_loadstore:arch/powerpc/kvm/emulate_loadstore.c:87:10: warning: variable rs set but not used [-Wunused-but-set-variable] arch/powerpc/kvm/emulate_loadstore.c: In function kvmppc_emulate_loadstore:arch/powerpc/kvm/emulate_loadstore.c:87:14: warning: variable rt set but not used [-Wunused-but-set-variable]
They are not used since commit 2b33cb585f94 ("KVM: PPC: Reimplement LOAD_FP/STORE_FP instruction mmio emulation with analyse_instr() input")
--- arch/powerpc/kvm/emulate_loadstore.c | 5 ----- 1 file changed, 5 deletions(-)
arch/powerpc/kvm/emulate_loadstore.c +0 -5
@@ -73,7 +73,6 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu) {struct kvm_run *run = vcpu->run;u32 inst; -int ra, rs, rt;enum emulation_result emulated =EMULATE_FAIL ;int advance =1 ;struct instruction_op op;
@@ -85,10 +84,6 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)if (emulated !=EMULATE_DONE )return emulated; - ra =get_ra (inst); - rs =get_rs (inst); - rt =get_rt (inst); - vcpu->arch.mmio_vsx_copy_nums =0 ; vcpu->arch.mmio_vsx_offset =0 ; vcpu->arch.mmio_copy_type =KVMPPC_VSX_COPY_NONE ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 287/399 arm64: dts: ti: k3-j721e-main: Add missing power-domains for smmu
In reply to Greg Kroah-HartmanFrom: Lokesh Vutla <[email protected]>
[ Upstream commit 3f03a58b25753843ce9e4511e9e246c51bd11011 ]
Add power-domains entry for smmu, so that the it is accessible as long as the driver is active. Without this device shutdown is throwing the below warning:
"[ 44.736348] arm-smmu-v3 36600000.smmu: failed to clear cr0"
--- arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +1 -0
@@ -43,6 +43,7 @@ smmu0: smmu@36600000 { compatible = "arm,smmu-v3"; reg = <0x0 0x36600000 0x0 0x100000>; + power-domains = <&k3_pds 229 TI_SCI_PD_EXCLUSIVE>; interrupt-parent = <&gic500>; interrupts = <GIC_SPI 772 IRQ_TYPE_EDGE_RISING>, <GIC_SPI 768 IRQ_TYPE_EDGE_RISING>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 288/399 sched/core: Fix size of rq::uclamp initialization
In reply to Greg Kroah-HartmanFrom: Li Guanglei <[email protected]>
[ Upstream commit dcd6dffb0a75741471297724640733fa4e958d72 ]
rq::uclamp is an array of struct uclamp_rq, make sure we clear the whole thing.
--- kernel/sched/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/core.c +2 -1
@@ -1253,7 +1253,8 @@ static void __init init_uclamp(void)mutex_init (&uclamp_mutex);for_each_possible_cpu (cpu) { -memset (&cpu_rq (cpu)->uclamp,0 ,sizeof (struct uclamp_rq )); +memset (&cpu_rq (cpu)->uclamp,0 , +sizeof (struct uclamp_rq )*UCLAMP_CNT );cpu_rq (cpu)->uclamp_flags =0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 290/399 perf/x86/amd: Constrain Large Increment per Cycle events
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
[ Upstream commit 471af006a747f1c535c8a8c6c0973c320fe01b22 ]
AMD Family 17h processors and above gain support for Large Increment per Cycle events. Unfortunately there is no CPUID or equivalent bit that indicates whether the feature exists or not, so we continue to determine eligibility based on a CPU family number comparison.
For Large Increment per Cycle events, we add a f17h-and-compatibles get_event_constraints_f17h() that returns an even counter bitmask:
Large Increment per Cycle events can only be placed on PMCs 0, 2, and 4 out of the currently available 0-5. The only currently public event that requires this feature to report valid counts is PMCx003 "Retired SSE/AVX Operations".
Note that the CPU family logic in amd_core_pmu_init() is changed so as to be able to selectively add initialization for features available in ranges of backward-compatible CPU families. This Large Increment per Cycle feature is expected to be retained in future families.
A side-effect of assigning a new get_constraints function for f17h disables calling the old (prior to f15h) amd_get_event_constraints implementation left enabled by commit e40ed1542dd7 ("perf/x86: Add perf support for AMD family-17h processors"), which is no longer necessary since those North Bridge event codes are obsoleted.
Also fix a spelling mistake whilst in the area (calulating -> calculating).
--- arch/x86/events/amd/core.c | 91 ++++++++++++++++++++++++------------ arch/x86/events/perf_event.h | 2 + 2 files changed, 63 insertions(+), 30 deletions(-)
arch/x86/events/amd/core.c +61 -30
@@ -302,6 +302,25 @@ static inline int amd_pmu_addr_offset(int index, bool eventsel)return offset; } +/* +* AMD64 events are detected based on their event codes. +*/ +static inline unsigned int amd_get_event_code (struct hw_perf_event *hwc) +{ +return ((hwc->config >>24 ) &0x0f00 ) | (hwc->config &0x00ff ); +} + +static inline bool amd_is_pair_event_code (struct hw_perf_event *hwc) +{ +if (!(x86_pmu.flags &PMU_FL_PAIR )) +return false; + +switch (amd_get_event_code (hwc)) { +case 0x003 :return true;/* Retired SSE/AVX FLOPs */ +default :return false; + } +} +static int amd_core_hw_config (struct perf_event *event) {if (event->attr.exclude_host && event->attr.exclude_guest)
@@ -320,14 +339,6 @@ static int amd_core_hw_config(struct perf_event *event)return 0 ; } -/* -* AMD64 events are detected based on their event codes. -*/ -static inline unsigned int amd_get_event_code (struct hw_perf_event *hwc) -{ -return ((hwc->config >>24 ) &0x0f00 ) | (hwc->config &0x00ff ); -} -static inline int amd_is_nb_event (struct hw_perf_event *hwc) {return (hwc->config &0xe0 ) ==0xe0 ;
@@ -856,6 +867,20 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, int idx, } } +static struct event_constraint pair_constraint; + +static struct event_constraint * +amd_get_event_constraints_f17h (struct cpu_hw_events *cpuc,int idx, +struct perf_event *event) +{ +struct hw_perf_event *hwc = &event->hw; + +if (amd_is_pair_event_code (hwc)) +return &pair_constraint; + +return &unconstrained; +} +static ssize_t amd_event_sysfs_show (char *page,u64 config) { u64 event = (config & ARCH_PERFMON_EVENTSEL_EVENT) |
@@ -899,33 +924,15 @@ static __initconst const struct x86_pmu amd_pmu = {static int __init amd_core_pmu_init (void ) { +u64 even_ctr_mask =0ULL ; +int i; +if (!boot_cpu_has (X86_FEATURE_PERFCTR_CORE ))return 0 ; -/* Avoid calulating the value each time in the NMI handler */ +/* Avoid calculating the value each time in the NMI handler */ perf_nmi_window =msecs_to_jiffies (100 ); -switch (boot_cpu_data.x86) { -case 0x15 : -pr_cont ("Fam15h " ); - x86_pmu.get_event_constraints = amd_get_event_constraints_f15h; -break ; -case 0x17 : -pr_cont ("Fam17h " ); -/* -* In family 17h, there are no event constraints in the PMC hardware. -* We fallback to using default amd_get_event_constraints. -*/ -break ; -case 0x18 : -pr_cont ("Fam18h " ); -/* Using default amd_get_event_constraints. */ -break ; -default : -pr_err ("core perfctr but no constraints; unknown hardware!\n" ); -return -ENODEV ; - } -/* * If core performance counter extensions exists, we must use * MSR_F15H_PERF_CTL/MSR_F15H_PERF_CTR msrs. See also
@@ -940,6 +947,30 @@ static int __init amd_core_pmu_init(void)*/ x86_pmu.amd_nb_constraints =0 ; +if (boot_cpu_data.x86 ==0x15 ) { +pr_cont ("Fam15h " ); + x86_pmu.get_event_constraints = amd_get_event_constraints_f15h; + } +if (boot_cpu_data.x86 >=0x17 ) { +pr_cont ("Fam17h+ " ); +/* +* Family 17h and compatibles have constraints for Large +* Increment per Cycle events: they may only be assigned an +* even numbered counter that has a consecutive adjacent odd +* numbered counter following it. +*/ +for (i =0 ; i < x86_pmu.num_counters -1 ; i +=2 ) + even_ctr_mask |=1 << i; + + pair_constraint = (struct event_constraint ) +__EVENT_CONSTRAINT (0 , even_ctr_mask,0 , + x86_pmu.num_counters /2 ,0 , +PERF_X86_EVENT_PAIR ); + + x86_pmu.get_event_constraints = amd_get_event_constraints_f17h; + x86_pmu.flags |=PMU_FL_PAIR ; + } +pr_cont ("core perfctr, " );return 0 ; }
arch/x86/events/perf_event.h +2 -0
@@ -77,6 +77,7 @@ static inline bool constraint_match(struct event_constraint *c, u64 ecode)#define PERF_X86_EVENT_AUTO_RELOAD 0x0200/* use PEBS auto-reload */ #define PERF_X86_EVENT_LARGE_PEBS 0x0400/* use large PEBS */ #define PERF_X86_EVENT_PEBS_VIA_PT 0x0800/* use PT buffer for PEBS */ +#define PERF_X86_EVENT_PAIR 0x1000/* Large Increment per Cycle */ struct amd_nb {int nb_id;/* NorthBridge id */
@@ -743,6 +744,7 @@ do { \#define PMU_FL_EXCL_ENABLED 0x8/* exclusive counter active */ #define PMU_FL_PEBS_ALL 0x10/* all events are valid PEBS events */ #define PMU_FL_TFA 0x20/* deal with TSX force abort */ +#define PMU_FL_PAIR 0x40/* merge counters for large incr. events */ #define EVENT_VAR (_id) event_attr_##_id#define EVENT_PTR (_id) &event_attr_##_id.attr.attr
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 289/399 sched/topology: Assert non-NUMA topology masks dont (partially) overlap
In reply to Greg Kroah-HartmanFrom: Valentin Schneider <[email protected]>
[ Upstream commit ccf74128d66ce937876184ad55db2e0276af08d3 ]
topology.c::get_group() relies on the assumption that non-NUMA domains do not partially overlap. Zeng Tao pointed out in [1] that such topology descriptions, while completely bogus, can end up being exposed to the scheduler.
In his example (8 CPUs, 2-node system), we end up with:
MC span for CPU3 == 3-7
MC span for CPU4 == 4-7
The first pass through get_group(3, sdd@MC) will result in the following sched_group list:
3 -> 4 -> 5 -> 6 -> 7
^ /
`----------------'
And a later pass through get_group(4, sdd@MC) will "corrupt" that to:
3 -> 4 -> 5 -> 6 -> 7
^ / `-----------'
which will completely break things like 'while (sg != sd->groups)' when using CPU3's base sched_domain.
There already are some architecture-specific checks in place such as x86/kernel/smpboot.c::topology.sane(), but this is something we can detect in the core scheduler, so it seems worthwhile to do so.
Warn and abort the construction of the sched domains if such a broken topology description is detected. Note that this is somewhat expensive (O(t.c²), 't' non-NUMA topology levels and 'c' CPUs) and could be gated under SCHED_DEBUG if deemed necessary.
Testing
=======
Dietmar managed to reproduce this using the following qemu incantation:
$ qemu-system-aarch64 -kernel ./Image -hda ./qemu-image-aarch64.img \ -append 'root=/dev/vda console=ttyAMA0 loglevel=8 sched_debug' -smp \ cores=8 --nographic -m 512 -cpu cortex-a53 -machine virt -numa \ node,cpus=0-2,nodeid=0 -numa node,cpus=3-7,nodeid=1
alongside the following drivers/base/arch_topology.c hack (AIUI wouldn't be needed if '-smp cores=X, sockets=Y' would work with qemu):
8<---
@@ -465,6 +465,9 @@ void update_siblings_masks(unsigned int cpuid)
if (cpuid_topo->package_id != cpu_topo->package_id)
continue;
+ if ((cpu < 4 && cpuid > 3) || (cpu > 3 && cpuid < 4))
+ continue;
+
cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); cpumask_set_cpu(cpu, &cpuid_topo->core_sibling);
8<---
[1]: https://lkml.kernel.org/r/[email protected]
--- kernel/sched/topology.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
kernel/sched/topology.c +39 -0
@@ -1879,6 +1879,42 @@ static struct sched_domain *build_sched_domain(struct sched_domain_topology_levereturn sd; } +/* +* Ensure topology masks are sane, i.e. there are no conflicts (overlaps) for +* any two given CPUs at this (non-NUMA) topology level. +*/ +static bool topology_span_sane (struct sched_domain_topology_level *tl, +const struct cpumask *cpu_map,int cpu) +{ +int i; + +/* NUMA levels are allowed to overlap */ +if (tl->flags &SDTL_OVERLAP ) +return true; + +/* +* Non-NUMA levels cannot partially overlap - they must be either +* completely equal or completely disjoint. Otherwise we can end up +* breaking the sched_group lists - i.e. a later get_group() pass +* breaks the linking done for an earlier span. +*/ +for_each_cpu (i, cpu_map) { +if (i == cpu) +continue ; +/* +* We should 'and' all those masks with 'cpu_map' to exactly +* match the topology we're about to build, but that can only +* remove CPUs, which only lessens our ability to detect +* overlaps +*/ +if (!cpumask_equal (tl->mask (cpu), tl->mask (i)) && +cpumask_intersects (tl->mask (cpu), tl->mask (i))) +return false; + } + +return true; +} +/* * Find the sched_domain_topology_level where all CPU capacities are visible * for all CPUs.
@@ -1975,6 +2011,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att has_asym = true; } +if (WARN_ON (!topology_span_sane (tl, cpu_map, i))) + goto error; + sd =build_sched_domain (tl, cpu_map, attr, sd, dflags, i);if (tl == sched_domain_topology)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 275/399 crypto: hisilicon - Bugfixed tfm leak
In reply to Greg Kroah-HartmanFrom: Zaibo Xu <[email protected]>
[ Upstream commit dfee9955abc7ec9364413d16316181322cf44f2f ]
1.Fixed the bug of software tfm leakage.
2.Update HW error log message.
--- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 7 +++++- drivers/crypto/hisilicon/hpre/hpre_main.c | 24 ++++++++++----------- 2 files changed, 18 insertions(+), 13 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_crypto.c +6 -1
@@ -1043,6 +1043,7 @@ static unsigned int hpre_rsa_max_size(struct crypto_akcipher *tfm)static int hpre_rsa_init_tfm (struct crypto_akcipher *tfm) {struct hpre_ctx *ctx =akcipher_tfm_ctx (tfm); +int ret; ctx->rsa.soft_tfm =crypto_alloc_akcipher ("rsa-generic" ,0 ,0 );if (IS_ERR (ctx->rsa.soft_tfm)) {
@@ -1050,7 +1051,11 @@ static int hpre_rsa_init_tfm(struct crypto_akcipher *tfm)return PTR_ERR (ctx->rsa.soft_tfm); } -return hpre_ctx_init (ctx); + ret =hpre_ctx_init (ctx); +if (ret) +crypto_free_akcipher (ctx->rsa.soft_tfm); + +return ret; }static void hpre_rsa_exit_tfm (struct crypto_akcipher *tfm)
drivers/crypto/hisilicon/hpre/hpre_main.c +12 -12
@@ -106,18 +106,18 @@ static const char * const hpre_debug_file_name[] = { };static const struct hpre_hw_error hpre_hw_errors[] = { - { .int_msk =BIT (0 ), .msg ="hpre_ecc_1bitt_err" }, - { .int_msk =BIT (1 ), .msg ="hpre_ecc_2bit_err" }, - { .int_msk =BIT (2 ), .msg ="hpre_data_wr_err" }, - { .int_msk =BIT (3 ), .msg ="hpre_data_rd_err" }, - { .int_msk =BIT (4 ), .msg ="hpre_bd_rd_err" }, - { .int_msk =BIT (5 ), .msg ="hpre_ooo_2bit_ecc_err" }, - { .int_msk =BIT (6 ), .msg ="hpre_cltr1_htbt_tm_out_err" }, - { .int_msk =BIT (7 ), .msg ="hpre_cltr2_htbt_tm_out_err" }, - { .int_msk =BIT (8 ), .msg ="hpre_cltr3_htbt_tm_out_err" }, - { .int_msk =BIT (9 ), .msg ="hpre_cltr4_htbt_tm_out_err" }, - { .int_msk =GENMASK (15 ,10 ), .msg ="hpre_ooo_rdrsp_err" }, - { .int_msk =GENMASK (21 ,16 ), .msg ="hpre_ooo_wrrsp_err" }, + { .int_msk =BIT (0 ), .msg ="core_ecc_1bit_err_int_set" }, + { .int_msk =BIT (1 ), .msg ="core_ecc_2bit_err_int_set" }, + { .int_msk =BIT (2 ), .msg ="dat_wb_poison_int_set" }, + { .int_msk =BIT (3 ), .msg ="dat_rd_poison_int_set" }, + { .int_msk =BIT (4 ), .msg ="bd_rd_poison_int_set" }, + { .int_msk =BIT (5 ), .msg ="ooo_ecc_2bit_err_int_set" }, + { .int_msk =BIT (6 ), .msg ="cluster1_shb_timeout_int_set" }, + { .int_msk =BIT (7 ), .msg ="cluster2_shb_timeout_int_set" }, + { .int_msk =BIT (8 ), .msg ="cluster3_shb_timeout_int_set" }, + { .int_msk =BIT (9 ), .msg ="cluster4_shb_timeout_int_set" }, + { .int_msk =GENMASK (15 ,10 ), .msg ="ooo_rdrsp_err_int_set" }, + { .int_msk =GENMASK (21 ,16 ), .msg ="ooo_wrrsp_err_int_set" }, {/* sentinel */ } };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 292/399 enetc: Dont print from enetc_sched_speed_set when link goes down
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 90f29f0eada4d60e1f6ae537502ddb2202b9540d ]
It is not an error to unplug a cable from the ENETC port even with TSN offloads, so don't spam the log with link-related messages from the tc-taprio offload subsystem, a single notification is sufficient:
[10972.351859] fsl_enetc 0000:00:00.0 eno0: Qbv PSPEED set speed link down. [10972.360241] fsl_enetc 0000:00:00.0 eno0: Link is Down
--- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_qos.c +0 -1
@@ -36,7 +36,6 @@ void enetc_sched_speed_set(struct net_device *ndev)case SPEED_10 :default : pspeed =ENETC_PMR_PSPEED_10M ; -netdev_err (ndev,"Qbv PSPEED set speed link down.\n" ); } priv->speed = speed;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 293/399 ACPI/IORT: Fix Number of IDs handling in iort_id_map()
In reply to Greg Kroah-HartmanFrom: Hanjun Guo <[email protected]>
[ Upstream commit 3c23b83a88d00383e1d498cfa515249aa2fe0238 ]
The IORT specification [0] (Section 3, table 4, page 9) defines the 'Number of IDs' as 'The number of IDs in the range minus one'.
However, the IORT ID mapping function iort_id_map() treats the 'Number of IDs' field as if it were the full IDs mapping count, with the following check in place to detect out of boundary input IDs:
InputID >= Input base + Number of IDs
This check is flawed in that it considers the 'Number of IDs' field as the full number of IDs mapping and disregards the 'minus one' from the IDs count.
The correct check in iort_id_map() should be implemented as:
InputID > Input base + Number of IDs
this implements the specification correctly but unfortunately it breaks existing firmwares that erroneously set the 'Number of IDs' as the full IDs mapping count rather than IDs mapping count minus one.
e.g.
PCI hostbridge mapping entry 1:
Input base: 0x1000 ID Count: 0x100 Output base: 0x1000 Output reference: 0xC4 //ITS reference
PCI hostbridge mapping entry 2:
Input base: 0x1100 ID Count: 0x100 Output base: 0x2000 Output reference: 0xD4 //ITS reference
Two mapping entries which the second entry's Input base = the first entry's Input base + ID count, so for InputID 0x1100 and with the correct InputID check in place in iort_id_map() the kernel would map the InputID to ITS 0xC4 not 0xD4 as it would be expected.
Therefore, to keep supporting existing flawed firmwares, introduce a workaround that instructs the kernel to use the old InputID range check logic in iort_id_map(), so that we can support both firmwares written with the flawed 'Number of IDs' logic and the correct one as defined in the specifications.
[0]: http://infocenter.arm.com/help/topic/com.arm.doc.den0049d/DEN0049D_IO_Remapping_Table.pdf
--- drivers/acpi/arm64/iort.c | 57 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-)
drivers/acpi/arm64/iort.c +55 -2
@@ -298,6 +298,59 @@ out:return status; } +struct iort_workaround_oem_info { +char oem_id[ACPI_OEM_ID_SIZE +1 ]; +char oem_table_id[ACPI_OEM_TABLE_ID_SIZE +1 ]; +u32 oem_revision; +}; + +static bool apply_id_count_workaround; + +static struct iort_workaround_oem_info wa_info[]__initdata = { + { + .oem_id ="HISI " , + .oem_table_id ="HIP07 " , + .oem_revision =0 , + }, { + .oem_id ="HISI " , + .oem_table_id ="HIP08 " , + .oem_revision =0 , + } +}; + +static void __init +iort_check_id_count_workaround (struct acpi_table_header *tbl) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (wa_info); i++) { +if (!memcmp (wa_info[i].oem_id, tbl->oem_id,ACPI_OEM_ID_SIZE ) && + !memcmp (wa_info[i].oem_table_id, tbl->oem_table_id,ACPI_OEM_TABLE_ID_SIZE ) && + wa_info[i].oem_revision == tbl->oem_revision) { + apply_id_count_workaround = true; +pr_warn (FW_BUG "ID count for ID mapping entry is wrong, applying workaround\n" ); +break ; + } + } +} + +static inline u32 iort_get_map_max (struct acpi_iort_id_mapping *map) +{ +u32 map_max = map->input_base + map->id_count; + +/* +* The IORT specification revision D (Section 3, table 4, page 9) says +* Number of IDs = The number of IDs in the range minus one, but the +* IORT code ignored the "minus one", and some firmware did that too, +* so apply a workaround here to keep compatible with both the spec +* compliant and non-spec compliant firmwares. +*/ +if (apply_id_count_workaround) + map_max--; + +return map_max; +} +static int iort_id_map (struct acpi_iort_id_mapping *map,u8 type,u32 rid_in,u32 *rid_out) {
@@ -314,8 +367,7 @@ static int iort_id_map(struct acpi_iort_id_mapping *map, u8 type, u32 rid_in,return -ENXIO ; } -if (rid_in < map->input_base || - (rid_in >= map->input_base + map->id_count)) +if (rid_in < map->input_base || rid_in >iort_get_map_max (map))return -ENXIO ; *rid_out = map->output_base + (rid_in - map->input_base);
@@ -1631,5 +1683,6 @@ void __init acpi_iort_init(void)return ; } +iort_check_id_count_workaround (iort_table);iort_init_platform_devices (); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 294/399 x86/apic/uv: Avoid unused variable warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit d0b7788804482b2689946cd8d910ac3e03126c8d ]
When CONFIG_PROC_FS is disabled, the compiler warns about an unused variable:
arch/x86/kernel/apic/x2apic_uv_x.c: In function 'uv_setup_proc_files':arch/x86/kernel/apic/x2apic_uv_x.c:1546:8: error: unused variable 'name' [-Werror=unused-variable]
char *name = hubless ? "hubless" : "hubbed";
Simplify the code so this variable is no longer needed.
--- arch/x86/kernel/apic/x2apic_uv_x.c | 43 +++++------------------------- 1 file changed, 6 insertions(+), 37 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +6 -37
@@ -1493,65 +1493,34 @@ static void check_efi_reboot(void) }/* Setup user proc fs files */ -static int proc_hubbed_show (struct seq_file *file,void *data) +static int __maybe_unused proc_hubbed_show (struct seq_file *file,void *data) {seq_printf (file,"0x%x\n" , uv_hubbed_system);return 0 ; } -static int proc_hubless_show (struct seq_file *file,void *data) +static int __maybe_unused proc_hubless_show (struct seq_file *file,void *data) {seq_printf (file,"0x%x\n" , uv_hubless_system);return 0 ; } -static int proc_oemid_show (struct seq_file *file,void *data) +static int __maybe_unused proc_oemid_show (struct seq_file *file,void *data) {seq_printf (file,"%s/%s\n" , oem_id, oem_table_id);return 0 ; } -static int proc_hubbed_open (struct inode *inode,struct file *file) -{ -return single_open (file, proc_hubbed_show, (void *)NULL ); -} - -static int proc_hubless_open (struct inode *inode,struct file *file) -{ -return single_open (file, proc_hubless_show, (void *)NULL ); -} - -static int proc_oemid_open (struct inode *inode,struct file *file) -{ -return single_open (file, proc_oemid_show, (void *)NULL ); -} - -/* (struct is "non-const" as open function is set at runtime) */ -static struct file_operations proc_version_fops = { - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static const struct file_operations proc_oemid_fops = { - .open = proc_oemid_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; -static __init void uv_setup_proc_files (int hubless) {struct proc_dir_entry *pde; -char *name = hubless ?"hubless" :"hubbed" ; pde =proc_mkdir (UV_PROC_NODE ,NULL ); -proc_create ("oemid" ,0 , pde, &proc_oemid_fops); -proc_create (name,0 , pde, &proc_version_fops); +proc_create_single ("oemid" ,0 , pde, proc_oemid_show);if (hubless) - proc_version_fops.open = proc_hubless_open; +proc_create_single ("hubless" ,0 , pde, proc_hubless_show);else - proc_version_fops.open = proc_hubbed_open; +proc_create_single ("hubbed" ,0 , pde, proc_hubbed_show); }/* Initialize UV hubless systems */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 295/399 debugobjects: Fix various data races
In reply to Greg Kroah-HartmanFrom: Marco Elver <[email protected]>
[ Upstream commit 35fd7a637c42bb54ba4608f4d40ae6e55fc88781 ]
The counters obj_pool_free, and obj_nr_tofree, and the flag obj_freeing are read locklessly outside the pool_lock critical sections. If read with plain accesses, this would result in data races.
This is addressed as follows:
* reads outside critical sections become READ_ONCE()s (pairing with WRITE_ONCE()s added);
* writes become WRITE_ONCE()s (pairing with READ_ONCE()s added); since writes happen inside critical sections, only the write and not the read of RMWs needs to be atomic, thus WRITE_ONCE(var, var +/- X) is sufficient.
The data races were reported by KCSAN:
BUG: KCSAN: data-race in __free_object / fill_pool
write to 0xffffffff8beb04f8 of 4 bytes by interrupt on cpu 1:
__free_object+0x1ee/0x8e0 lib/debugobjects.c:404 __debug_check_no_obj_freed+0x199/0x330 lib/debugobjects.c:969 debug_check_no_obj_freed+0x3c/0x44 lib/debugobjects.c:994 slab_free_hook mm/slub.c:1422 [inline]
read to 0xffffffff8beb04f8 of 4 bytes by task 1 on cpu 2:
fill_pool+0x3d/0x520 lib/debugobjects.c:135 __debug_object_init+0x3c/0x810 lib/debugobjects.c:536 debug_object_init lib/debugobjects.c:591 [inline] debug_object_activate+0x228/0x320 lib/debugobjects.c:677 debug_rcu_head_queue kernel/rcu/rcu.h:176 [inline] BUG: KCSAN: data-race in __debug_object_init / fill_pool
read to 0xffffffff8beb04f8 of 4 bytes by task 10 on cpu 6:
fill_pool+0x3d/0x520 lib/debugobjects.c:135 __debug_object_init+0x3c/0x810 lib/debugobjects.c:536 debug_object_init_on_stack+0x39/0x50 lib/debugobjects.c:606 init_timer_on_stack_key kernel/time/timer.c:742 [inline]
write to 0xffffffff8beb04f8 of 4 bytes by task 1 on cpu 3:
alloc_object lib/debugobjects.c:258 [inline] __debug_object_init+0x717/0x810 lib/debugobjects.c:544 debug_object_init lib/debugobjects.c:591 [inline] debug_object_activate+0x228/0x320 lib/debugobjects.c:677 debug_rcu_head_queue kernel/rcu/rcu.h:176 [inline] BUG: KCSAN: data-race in free_obj_work / free_object
read to 0xffffffff9140c190 of 4 bytes by task 10 on cpu 6:
free_object+0x4b/0xd0 lib/debugobjects.c:426 debug_object_free+0x190/0x210 lib/debugobjects.c:824 destroy_timer_on_stack kernel/time/timer.c:749 [inline]
write to 0xffffffff9140c190 of 4 bytes by task 93 on cpu 1:
free_obj_work+0x24f/0x480 lib/debugobjects.c:313 process_one_work+0x454/0x8d0 kernel/workqueue.c:2264 worker_thread+0x9a/0x780 kernel/workqueue.c:2410
--- lib/debugobjects.c | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-)
lib/debugobjects.c +25 -21
@@ -132,14 +132,18 @@ static void fill_pool(void)struct debug_obj *obj;unsigned long flags; -if (likely (obj_pool_free >= debug_objects_pool_min_level)) +if (likely (READ_ONCE (obj_pool_free) >= debug_objects_pool_min_level))return ;/* * Reuse objs from the global free list; they will be reinitialized * when allocating. +* +* Both obj_nr_tofree and obj_pool_free are checked locklessly; the +* READ_ONCE()s pair with the WRITE_ONCE()s in pool_lock critical +* sections. */ -while (obj_nr_tofree && (obj_pool_free < obj_pool_min_free)) { +while (READ_ONCE (obj_nr_tofree) && (READ_ONCE (obj_pool_free) < obj_pool_min_free)) {raw_spin_lock_irqsave (&pool_lock, flags);/* * Recheck with the lock held as the worker thread might have
@@ -148,9 +152,9 @@ static void fill_pool(void)while (obj_nr_tofree && (obj_pool_free < obj_pool_min_free)) { obj =hlist_entry (obj_to_free.first,typeof (*obj), node);hlist_del (&obj->node); - obj_nr_tofree--; +WRITE_ONCE (obj_nr_tofree, obj_nr_tofree -1 );hlist_add_head (&obj->node, &obj_pool); - obj_pool_free++; +WRITE_ONCE (obj_pool_free, obj_pool_free +1 ); }raw_spin_unlock_irqrestore (&pool_lock, flags); }
@@ -158,7 +162,7 @@ static void fill_pool(void)if (unlikely (!obj_cache))return ; -while (obj_pool_free < debug_objects_pool_min_level) { +while (READ_ONCE (obj_pool_free) < debug_objects_pool_min_level) {struct debug_obj *new[ODEBUG_BATCH_SIZE ];int cnt;
@@ -174,7 +178,7 @@ static void fill_pool(void)while (cnt) {hlist_add_head (&new[--cnt]->node, &obj_pool); debug_objects_allocated++; - obj_pool_free++; +WRITE_ONCE (obj_pool_free, obj_pool_free +1 ); }raw_spin_unlock_irqrestore (&pool_lock, flags); }
@@ -236,7 +240,7 @@ alloc_object(void *addr, struct debug_bucket *b, struct debug_obj_descr *descr) obj =__alloc_object (&obj_pool);if (obj) { obj_pool_used++; - obj_pool_free--; +WRITE_ONCE (obj_pool_free, obj_pool_free -1 );/* * Looking ahead, allocate one batch of debug objects and
@@ -255,7 +259,7 @@ alloc_object(void *addr, struct debug_bucket *b, struct debug_obj_descr *descr) &percpu_pool->free_objs); percpu_pool->obj_free++; obj_pool_used++; - obj_pool_free--; +WRITE_ONCE (obj_pool_free, obj_pool_free -1 ); } }
@@ -309,8 +313,8 @@ static void free_obj_work(struct work_struct *work) obj =hlist_entry (obj_to_free.first,typeof (*obj), node);hlist_del (&obj->node);hlist_add_head (&obj->node, &obj_pool); - obj_pool_free++; - obj_nr_tofree--; +WRITE_ONCE (obj_pool_free, obj_pool_free +1 ); +WRITE_ONCE (obj_nr_tofree, obj_nr_tofree -1 ); }raw_spin_unlock_irqrestore (&pool_lock, flags);return ;
@@ -324,7 +328,7 @@ free_objs:if (obj_nr_tofree) {hlist_move_list (&obj_to_free, &tofree); debug_objects_freed += obj_nr_tofree; - obj_nr_tofree =0 ; +WRITE_ONCE (obj_nr_tofree,0 ); }raw_spin_unlock_irqrestore (&pool_lock, flags);
@@ -375,10 +379,10 @@ free_to_obj_pool: obj_pool_used--;if (work) { - obj_nr_tofree++; +WRITE_ONCE (obj_nr_tofree, obj_nr_tofree +1 );hlist_add_head (&obj->node, &obj_to_free);if (lookahead_count) { - obj_nr_tofree += lookahead_count; +WRITE_ONCE (obj_nr_tofree, obj_nr_tofree + lookahead_count); obj_pool_used -= lookahead_count;while (lookahead_count) { hlist_add_head(&objs[--lookahead_count]->node,
@@ -396,15 +400,15 @@ free_to_obj_pool:for (i =0 ; i <ODEBUG_BATCH_SIZE ; i++) { obj =__alloc_object (&obj_pool);hlist_add_head (&obj->node, &obj_to_free); - obj_pool_free--; - obj_nr_tofree++; +WRITE_ONCE (obj_pool_free, obj_pool_free -1 ); +WRITE_ONCE (obj_nr_tofree, obj_nr_tofree +1 ); } } }else { - obj_pool_free++; +WRITE_ONCE (obj_pool_free, obj_pool_free +1 );hlist_add_head (&obj->node, &obj_pool);if (lookahead_count) { - obj_pool_free += lookahead_count; +WRITE_ONCE (obj_pool_free, obj_pool_free + lookahead_count); obj_pool_used -= lookahead_count;while (lookahead_count) { hlist_add_head(&objs[--lookahead_count]->node,
@@ -423,7 +427,7 @@ free_to_obj_pool:static void free_object (struct debug_obj *obj) {__free_object (obj); -if (!obj_freeing && obj_nr_tofree) { +if (!READ_ONCE (obj_freeing) &&READ_ONCE (obj_nr_tofree)) {WRITE_ONCE (obj_freeing, true);schedule_delayed_work (&debug_obj_work,ODEBUG_FREE_WORK_DELAY ); }
@@ -982,7 +986,7 @@ repeat: debug_objects_maxchecked = objs_checked;/* Schedule work to actually kmem_cache_free() objects */ -if (!obj_freeing && obj_nr_tofree) { +if (!READ_ONCE (obj_freeing) &&READ_ONCE (obj_nr_tofree)) {WRITE_ONCE (obj_freeing, true);schedule_delayed_work (&debug_obj_work,ODEBUG_FREE_WORK_DELAY ); }
@@ -1008,12 +1012,12 @@ static int debug_stats_show(struct seq_file *m, void *v)seq_printf (m,"max_checked :%d\n" , debug_objects_maxchecked);seq_printf (m,"warnings :%d\n" , debug_objects_warnings);seq_printf (m,"fixups :%d\n" , debug_objects_fixups); -seq_printf (m,"pool_free :%d\n" , obj_pool_free + obj_percpu_free); +seq_printf (m,"pool_free :%d\n" ,READ_ONCE (obj_pool_free) + obj_percpu_free);seq_printf (m,"pool_pcp_free :%d\n" , obj_percpu_free);seq_printf (m,"pool_min_free :%d\n" , obj_pool_min_free);seq_printf (m,"pool_used :%d\n" , obj_pool_used - obj_percpu_free);seq_printf (m,"pool_max_used :%d\n" , obj_pool_max_used); -seq_printf (m,"on_free_list :%d\n" , obj_nr_tofree); +seq_printf (m,"on_free_list :%d\n" ,READ_ONCE (obj_nr_tofree));seq_printf (m,"objs_allocated:%d\n" , debug_objects_allocated);seq_printf (m,"objs_freed :%d\n" , debug_objects_freed);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 297/399 ASoC: SOF: Intel: hda: Fix SKL dai count
In reply to Greg Kroah-HartmanFrom: Cezary Rojewski <[email protected]>
[ Upstream commit a6947c9d86bcfd61b758b5693eba58defe7fd2ae ]
With fourth pin added for iDisp for skl_dai, update SOF_SKL_DAI_NUM to account for the change. Without this, dais from the bottom of the list are skipped. In current state that's the case for 'Alt Analog CPU DAI'.
--- sound/soc/sof/intel/hda.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/intel/hda.h +1 -1
@@ -348,7 +348,7 @@/* Number of DAIs */ #if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA ) -#define SOF_SKL_NUM_DAIS 14 +#define SOF_SKL_NUM_DAIS 15#else #define SOF_SKL_NUM_DAIS 8#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 298/399 regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage
In reply to Greg Kroah-HartmanFrom: Enric Balletbo i Serra <[email protected]>
[ Upstream commit e9153311491da9d9863ead9888a1613531cb4a1b ]
cat /sys/kernel/debug/regulator/regulator_summary ends on a deadlock when you have a voltage controlled regulator (vctrl).
The problem is that the vctrl_get_voltage() and vctrl_set_voltage() calls the regulator_get_voltage() and regulator_set_voltage() and that will try to lock again the dependent regulators (the regulator supplying the control voltage).
Fix the issue by exporting the unlocked version of the regulator_get_voltage() and regulator_set_voltage() API so drivers that need it, like the voltage controlled regulator driver can use it.
--- drivers/regulator/core.c | 2 ++ drivers/regulator/vctrl-regulator.c | 38 +++++++++++++++++------------ 2 files changed, 25 insertions(+), 15 deletions(-)
drivers/regulator/core.c +2 -0
@@ -3470,6 +3470,7 @@ int regulator_set_voltage_rdev(struct regulator_dev *rdev, int min_uV, out:return ret; } +EXPORT_SYMBOL (regulator_set_voltage_rdev);static int regulator_limit_voltage_step (struct regulator_dev *rdev,int *current_uV,int *min_uV)
@@ -4034,6 +4035,7 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev)return ret;return ret - rdev->constraints->uV_offset; } +EXPORT_SYMBOL (regulator_get_voltage_rdev);/** * regulator_get_voltage - get regulator output voltage
drivers/regulator/vctrl-regulator.c +23 -15
@@ -11,10 +11,13 @@#include <linux/module.h> #include <linux/of.h> #include <linux/of_device.h> +#include <linux/regulator/coupler.h> #include <linux/regulator/driver.h> #include <linux/regulator/of_regulator.h> #include <linux/sort.h> +#include "internal.h" +struct vctrl_voltage_range {int min_uV;int max_uV;
@@ -79,7 +82,7 @@ static int vctrl_calc_output_voltage(struct vctrl_data *vctrl, int ctrl_uV)static int vctrl_get_voltage (struct regulator_dev *rdev) {struct vctrl_data *vctrl =rdev_get_drvdata (rdev); -int ctrl_uV =regulator_get_voltage (vctrl->ctrl_reg); +int ctrl_uV =regulator_get_voltage_rdev (vctrl->ctrl_reg->rdev);return vctrl_calc_output_voltage (vctrl, ctrl_uV); }
@@ -90,16 +93,16 @@ static int vctrl_set_voltage(struct regulator_dev *rdev, {struct vctrl_data *vctrl =rdev_get_drvdata (rdev);struct regulator *ctrl_reg = vctrl->ctrl_reg; -int orig_ctrl_uV =regulator_get_voltage (ctrl_reg); +int orig_ctrl_uV =regulator_get_voltage_rdev (ctrl_reg->rdev);int uV =vctrl_calc_output_voltage (vctrl, orig_ctrl_uV);int ret;if (req_min_uV >= uV || !vctrl->ovp_threshold)/* voltage rising or no OVP */ -return regulator_set_voltage ( - ctrl_reg, +return regulator_set_voltage_rdev (ctrl_reg->rdev,vctrl_calc_ctrl_voltage (vctrl, req_min_uV), -vctrl_calc_ctrl_voltage (vctrl, req_max_uV)); +vctrl_calc_ctrl_voltage (vctrl, req_max_uV), +PM_SUSPEND_ON );while (uV > req_min_uV) {int max_drop_uV = (uV * vctrl->ovp_threshold) /100 ;
@@ -114,9 +117,10 @@ static int vctrl_set_voltage(struct regulator_dev *rdev, next_uV =max_t (int, req_min_uV, uV - max_drop_uV); next_ctrl_uV =vctrl_calc_ctrl_voltage (vctrl, next_uV); - ret =regulator_set_voltage (ctrl_reg, + ret =regulator_set_voltage_rdev (ctrl_reg->rdev, + next_ctrl_uV, next_ctrl_uV, - next_ctrl_uV); +PM_SUSPEND_ON );if (ret) goto err;
@@ -130,7 +134,8 @@ static int vctrl_set_voltage(struct regulator_dev *rdev, err:/* Try to go back to original voltage */ -regulator_set_voltage (ctrl_reg, orig_ctrl_uV, orig_ctrl_uV); +regulator_set_voltage_rdev (ctrl_reg->rdev, orig_ctrl_uV, orig_ctrl_uV, +PM_SUSPEND_ON );return ret; }
@@ -155,9 +160,10 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev,if (selector >= vctrl->sel || !vctrl->ovp_threshold) {/* voltage rising or no OVP */ - ret =regulator_set_voltage (ctrl_reg, + ret =regulator_set_voltage_rdev (ctrl_reg->rdev, + vctrl->vtable[selector].ctrl, vctrl->vtable[selector].ctrl, - vctrl->vtable[selector].ctrl); +PM_SUSPEND_ON );if (!ret) vctrl->sel = selector;
@@ -173,9 +179,10 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev,else next_sel = vctrl->vtable[vctrl->sel].ovp_min_sel; - ret =regulator_set_voltage (ctrl_reg, + ret =regulator_set_voltage_rdev (ctrl_reg->rdev, vctrl->vtable[next_sel].ctrl, - vctrl->vtable[next_sel].ctrl); + vctrl->vtable[next_sel].ctrl, +PM_SUSPEND_ON );if (ret) { dev_err(&rdev->dev, "failed to set control voltage to %duV\n",
@@ -195,9 +202,10 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev, err:if (vctrl->sel != orig_sel) {/* Try to go back to original voltage */ -if (!regulator_set_voltage (ctrl_reg, +if (!regulator_set_voltage_rdev (ctrl_reg->rdev, + vctrl->vtable[orig_sel].ctrl, vctrl->vtable[orig_sel].ctrl, - vctrl->vtable[orig_sel].ctrl)) +PM_SUSPEND_ON )) vctrl->sel = orig_sel;else dev_warn(&rdev->dev,
@@ -482,7 +490,7 @@ static int vctrl_probe(struct platform_device *pdev)if (ret)return ret; - ctrl_uV =regulator_get_voltage (vctrl->ctrl_reg); + ctrl_uV =regulator_get_voltage_rdev (vctrl->ctrl_reg->rdev);if (ctrl_uV <0 ) {dev_err (&pdev->dev,"failed to get control voltage\n" );return ctrl_uV;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 296/399 ASoC: wm_adsp: Correct cache handling of new kernel control API
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit 73ecf1a673d3502dff1445f06675aba65ff20ce7 ]
The recently added API that exposes firmware mixer controls to the kernel is missing cache handling and all writes bypass the cache, this obviously causes the cache to get out of sync with the hardware. Factor out the cache handling into two new helper functions and call those from both the normal ALSA control handlers and the new kernel API.
--- sound/soc/codecs/wm_adsp.c | 98 ++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 47 deletions(-)
sound/soc/codecs/wm_adsp.c +51 -47
@@ -1030,8 +1030,8 @@ static int wm_coeff_write_acked_control(struct wm_coeff_ctl *ctl,return -ETIMEDOUT ; } -static int wm_coeff_write_control (struct wm_coeff_ctl *ctl, -const void *buf,size_t len) +static int wm_coeff_write_ctrl_raw (struct wm_coeff_ctl *ctl, +const void *buf,size_t len) {struct wm_adsp *dsp = ctl->dsp;void *scratch;
@@ -1061,6 +1061,23 @@ static int wm_coeff_write_control(struct wm_coeff_ctl *ctl,return 0 ; } +static int wm_coeff_write_ctrl (struct wm_coeff_ctl *ctl, +const void *buf,size_t len) +{ +int ret =0 ; + +if (ctl->flags &WMFW_CTL_FLAG_VOLATILE ) + ret = -EPERM ; +else if (buf != ctl->cache) +memcpy (ctl->cache, buf, len); + + ctl->set =1 ; +if (ctl->enabled && ctl->dsp->running) + ret =wm_coeff_write_ctrl_raw (ctl, buf, len); + +return ret; +} +static int wm_coeff_put (struct snd_kcontrol *kctl,struct snd_ctl_elem_value *ucontrol) {
@@ -1071,16 +1088,7 @@ static int wm_coeff_put(struct snd_kcontrol *kctl,int ret =0 ;mutex_lock (&ctl->dsp->pwr_lock); - -if (ctl->flags &WMFW_CTL_FLAG_VOLATILE ) - ret = -EPERM ; -else -memcpy (ctl->cache, p, ctl->len); - - ctl->set =1 ; -if (ctl->enabled && ctl->dsp->running) - ret =wm_coeff_write_control (ctl, p, ctl->len); - + ret =wm_coeff_write_ctrl (ctl, p, ctl->len);mutex_unlock (&ctl->dsp->pwr_lock);return ret;
@@ -1096,15 +1104,10 @@ static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,mutex_lock (&ctl->dsp->pwr_lock); -if (copy_from_user (ctl->cache, bytes, size)) { +if (copy_from_user (ctl->cache, bytes, size)) ret = -EFAULT ; - }else { - ctl->set =1 ; -if (ctl->enabled && ctl->dsp->running) - ret =wm_coeff_write_control (ctl, ctl->cache, size); -else if (ctl->flags &WMFW_CTL_FLAG_VOLATILE ) - ret = -EPERM ; - } +else + ret =wm_coeff_write_ctrl (ctl, ctl->cache, size);mutex_unlock (&ctl->dsp->pwr_lock);
@@ -1135,8 +1138,8 @@ static int wm_coeff_put_acked(struct snd_kcontrol *kctl,return ret; } -static int wm_coeff_read_control (struct wm_coeff_ctl *ctl, -void *buf,size_t len) +static int wm_coeff_read_ctrl_raw (struct wm_coeff_ctl *ctl, +void *buf,size_t len) {struct wm_adsp *dsp = ctl->dsp;void *scratch;
@@ -1166,29 +1169,37 @@ static int wm_coeff_read_control(struct wm_coeff_ctl *ctl,return 0 ; } -static int wm_coeff_get (struct snd_kcontrol *kctl, -struct snd_ctl_elem_value *ucontrol) +static int wm_coeff_read_ctrl (struct wm_coeff_ctl *ctl,void *buf,size_t len) { -struct soc_bytes_ext *bytes_ext = - (struct soc_bytes_ext *)kctl->private_value; -struct wm_coeff_ctl *ctl =bytes_ext_to_ctl (bytes_ext); -char *p = ucontrol->value.bytes.data;int ret =0 ; -mutex_lock (&ctl->dsp->pwr_lock); -if (ctl->flags &WMFW_CTL_FLAG_VOLATILE ) {if (ctl->enabled && ctl->dsp->running) - ret =wm_coeff_read_control (ctl, p, ctl->len); +return wm_coeff_read_ctrl_raw (ctl, buf, len);else - ret = -EPERM ; +return -EPERM ; }else {if (!ctl->flags && ctl->enabled && ctl->dsp->running) - ret =wm_coeff_read_control (ctl, ctl->cache, ctl->len); + ret =wm_coeff_read_ctrl_raw (ctl, ctl->cache, ctl->len); -memcpy (p, ctl->cache, ctl->len); +if (buf != ctl->cache) +memcpy (buf, ctl->cache, len); } +return ret; +} + +static int wm_coeff_get (struct snd_kcontrol *kctl, +struct snd_ctl_elem_value *ucontrol) +{ +struct soc_bytes_ext *bytes_ext = + (struct soc_bytes_ext *)kctl->private_value; +struct wm_coeff_ctl *ctl =bytes_ext_to_ctl (bytes_ext); +char *p = ucontrol->value.bytes.data; +int ret; + +mutex_lock (&ctl->dsp->pwr_lock); + ret =wm_coeff_read_ctrl (ctl, p, ctl->len);mutex_unlock (&ctl->dsp->pwr_lock);return ret;
@@ -1204,15 +1215,7 @@ static int wm_coeff_tlv_get(struct snd_kcontrol *kctl,mutex_lock (&ctl->dsp->pwr_lock); -if (ctl->flags &WMFW_CTL_FLAG_VOLATILE ) { -if (ctl->enabled && ctl->dsp->running) - ret =wm_coeff_read_control (ctl, ctl->cache, size); -else - ret = -EPERM ; - }else { -if (!ctl->flags && ctl->enabled && ctl->dsp->running) - ret =wm_coeff_read_control (ctl, ctl->cache, size); - } + ret =wm_coeff_read_ctrl_raw (ctl, ctl->cache, size);if (!ret &©_to_user (bytes, ctl->cache, size)) ret = -EFAULT ;
@@ -1340,7 +1343,7 @@ static int wm_coeff_init_control_caches(struct wm_adsp *dsp)* created so we don't need to do anything. */ if (!ctl->flags || (ctl->flags &WMFW_CTL_FLAG_READABLE )) { - ret =wm_coeff_read_control (ctl, ctl->cache, ctl->len); + ret =wm_coeff_read_ctrl_raw (ctl, ctl->cache, ctl->len);if (ret <0 )return ret; }
@@ -1358,7 +1361,8 @@ static int wm_coeff_sync_controls(struct wm_adsp *dsp)if (!ctl->enabled)continue ;if (ctl->set && !(ctl->flags &WMFW_CTL_FLAG_VOLATILE )) { - ret =wm_coeff_write_control (ctl, ctl->cache, ctl->len); + ret =wm_coeff_write_ctrl_raw (ctl, ctl->cache, + ctl->len);if (ret <0 )return ret; }
@@ -2048,7 +2052,7 @@ int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type,if (len > ctl->len)return -EINVAL ; - ret =wm_coeff_write_control (ctl, buf, len); + ret =wm_coeff_write_ctrl (ctl, buf, len); kcontrol =snd_soc_card_get_kcontrol (dsp->component->card, ctl->name); snd_ctl_notify(dsp->component->card->snd_card,
@@ -2070,7 +2074,7 @@ int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type,if (len > ctl->len)return -EINVAL ; -return wm_coeff_read_control (ctl, buf, len); +return wm_coeff_read_ctrl (ctl, buf, len); }EXPORT_SYMBOL_GPL (wm_adsp_read_ctl);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 300/399 x86/mm: Fix NX bit clearing issue in kernel_map_pages_in_pgd
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 75fbef0a8b6b4bb19b9a91b5214f846c2dc5139e ]
The following commit:
15f003d20782 ("x86/mm/pat: Don't implicitly allow _PAGE_RW in kernel_map_pages_in_pgd()")
modified kernel_map_pages_in_pgd() to manage writable permissions of memory mappings in the EFI page table in a different way, but in the process, it removed the ability to clear NX attributes from read-only mappings, by clobbering the clear mask if _PAGE_RW is not being requested.
Failure to remove the NX attribute from read-only mappings is unlikely to be a security issue, but it does prevent us from tightening the permissions in the EFI page tables going forward, so let's fix it now.
--- arch/x86/mm/pageattr.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
arch/x86/mm/pageattr.c +1 -7
@@ -2215,7 +2215,7 @@ int __init kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn, unsigned long address, .pgd = pgd, .numpages = numpages, .mask_set = __pgprot(0), - .mask_clr = __pgprot(0), + .mask_clr = __pgprot(~page_flags & (_PAGE_NX|_PAGE_RW)), .flags = 0, };
@@ -2224,12 +2224,6 @@ int __init kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn, unsigned long address,if (!(__supported_pte_mask & _PAGE_NX)) goto out; -if (!(page_flags & _PAGE_NX)) - cpa.mask_clr =__pgprot (_PAGE_NX); - -if (!(page_flags & _PAGE_RW)) - cpa.mask_clr =__pgprot (_PAGE_RW); -if (!(page_flags & _PAGE_ENC)) cpa.mask_clr =pgprot_encrypted (cpa.mask_clr);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 301/399 efi/arm: Defer probe of PCIe backed efifb on DT systems
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 64c8a0cd0a535891d5905c3a1651150f0f141439 ]
The new of_devlink support breaks PCIe probing on ARM platforms booting via UEFI if the firmware exposes a EFI framebuffer that is backed by a PCI device. The reason is that the probing order gets reversed, resulting in a resource conflict on the framebuffer memory window when the PCIe probes last, causing it to give up entirely.
Given that we rely on PCI quirks to deal with EFI framebuffers that get moved around in memory, we cannot simply drop the memory reservation, so instead, let's use the device link infrastructure to register this dependency, and force the probing to occur in the expected order.
--- drivers/firmware/efi/arm-init.c | 107 ++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 4 deletions(-)
drivers/firmware/efi/arm-init.c +103 -4
@@ -10,10 +10,12 @@#define pr_fmt (fmt) "efi: " fmt#include <linux/efi.h> +#include <linux/fwnode.h> #include <linux/init.h> #include <linux/memblock.h> #include <linux/mm_types.h> #include <linux/of.h> +#include <linux/of_address.h> #include <linux/of_fdt.h> #include <linux/platform_device.h> #include <linux/screen_info.h>
@@ -276,15 +278,112 @@ void __init efi_init(void)efi_memmap_unmap (); } +static bool efifb_overlaps_pci_range (const struct of_pci_range *range) +{ +u64 fb_base = screen_info.lfb_base; + +if (screen_info.capabilities &VIDEO_CAPABILITY_64BIT_BASE ) + fb_base |= (u64 )(unsigned long )screen_info.ext_lfb_base <<32 ; + +return fb_base >= range->cpu_addr && + fb_base < (range->cpu_addr + range->size); +} + +static struct device_node *find_pci_overlap_node (void ) +{ +struct device_node *np; + +for_each_node_by_type (np,"pci" ) { +struct of_pci_range_parser parser; +struct of_pci_range range; +int err; + + err =of_pci_range_parser_init (&parser, np); +if (err) { +pr_warn ("of_pci_range_parser_init() failed: %d\n" , err); +continue ; + } + +for_each_of_pci_range (&parser, &range) +if (efifb_overlaps_pci_range (&range)) +return np; + } +return NULL ; +} + +/* +* If the efifb framebuffer is backed by a PCI graphics controller, we have +* to ensure that this relation is expressed using a device link when +* running in DT mode, or the probe order may be reversed, resulting in a +* resource reservation conflict on the memory window that the efifb +* framebuffer steals from the PCIe host bridge. +*/ +static int efifb_add_links (const struct fwnode_handle *fwnode, +struct device *dev) +{ +struct device_node *sup_np; +struct device *sup_dev; + + sup_np =find_pci_overlap_node (); + +/* +* If there's no PCI graphics controller backing the efifb, we are +* done here. +*/ +if (!sup_np) +return 0 ; + + sup_dev =get_dev_from_fwnode (&sup_np->fwnode); +of_node_put (sup_np); + +/* +* Return -ENODEV if the PCI graphics controller device hasn't been +* registered yet. This ensures that efifb isn't allowed to probe +* and this function is retried again when new devices are +* registered. +*/ +if (!sup_dev) +return -ENODEV ; + +/* +* If this fails, retrying this function at a later point won't +* change anything. So, don't return an error after this. +*/ +if (!device_link_add (dev, sup_dev,0 )) +dev_warn (dev,"device_link_add() failed\n" ); + +put_device (sup_dev); + +return 0 ; +} + +static const struct fwnode_operations efifb_fwnode_ops = { + .add_links = efifb_add_links, +}; + +static struct fwnode_handle efifb_fwnode = { + .ops = &efifb_fwnode_ops, +}; +static int __init register_gop_device (void ) { -void *pd; +struct platform_device *pd; +int err;if (screen_info.orig_video_isVGA !=VIDEO_TYPE_EFI )return 0 ; - pd =platform_device_register_data (NULL ,"efi-framebuffer" ,0 , - &screen_info,sizeof (screen_info)); -return PTR_ERR_OR_ZERO (pd); + pd =platform_device_alloc ("efi-framebuffer" ,0 ); +if (!pd) +return -ENOMEM ; + +if (IS_ENABLED (CONFIG_PCI )) + pd->dev.fwnode = &efifb_fwnode; + + err =platform_device_add_data (pd, &screen_info,sizeof (screen_info)); +if (err) +return err; + +return platform_device_add (pd); }subsys_initcall (register_gop_device);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 302/399 x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit bc310baf2ba381c648983c7f4748327f17324562 ]
The final build stage of the x86 kernel captures some symbol addresses from the decompressor binary and copies them into zoffset.h. It uses sed with a regular expression that matches the address, symbol type and symbol name, and mangles the captured addresses and the names of symbols of interest into #define directives that are added to zoffset.h
The symbol type is indicated by a single letter, which we match
strictly: only letters in the set 'ABCDGRSTVW' are matched, even though the actual symbol type is relevant and therefore ignored.
Commit bc7c9d620 ("efi/libstub/x86: Force 'hidden' visibility for extern declarations") made a change to the way external symbol references are classified, resulting in 'startup_32' now being emitted as a hidden symbol. This prevents the use of GOT entries to refer to this symbol via its absolute address, which recent toolchains (including Clang based ones) already avoid by default, making this change a no-op in the majority of cases.
However, as it turns out, the LLVM linker classifies such hidden symbols as symbols with static linkage in fully linked ELF binaries, causing tools such as NM to output a lowercase 't' rather than an upper case 'T' for the type of such symbols. Since our sed expression only matches upper case letters for the symbol type, the line describing startup_32 is disregarded, resulting in a build error like the following
arch/x86/boot/header.S:568:18: error: symbol 'ZO_startup_32' can not be
undefined in a subtraction expression
init_size: .long (0x00000000008fd000 - ZO_startup_32 +
(((0x0000000001f6361c + ((0x0000000001f6361c >> 8) + 65536)
- 0x00000000008c32e5) + 4095) & ~4095)) # kernel initialization size
Given that we are only interested in the value of the symbol, let's match any character in the set 'a-zA-Z' instead.
--- arch/x86/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/Makefile +1 -1
@@ -88,7 +88,7 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) -sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|kernel_info\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p' +sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|kernel_info\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p' quiet_cmd_zoffset = ZOFFSET $@ cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 303/399 pwm: omap-dmtimer: Remove PWM chip in .remove before making it unfunctional
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 43efdc8f0e6d7088ec61bd55a73bf853f002d043 ]
In the old code (e.g.) mutex_destroy() was called before pwmchip_remove(). Between these two calls it is possible that a PWM callback is used which tries to grab the mutex.
--- drivers/pwm/pwm-omap-dmtimer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pwm/pwm-omap-dmtimer.c +6 -1
@@ -361,6 +361,11 @@ put:static int pwm_omap_dmtimer_remove (struct platform_device *pdev) {struct pwm_omap_dmtimer_chip *omap =platform_get_drvdata (pdev); +int ret; + + ret =pwmchip_remove (&omap->chip); +if (ret) +return ret;if (pm_runtime_active (&omap->dm_timer_pdev->dev)) omap->pdata->stop (omap->dm_timer);
@@ -369,7 +374,7 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev)mutex_destroy (&omap->mutex); -return pwmchip_remove (&omap->chip); +return 0 ; }static const struct of_device_id pwm_omap_dmtimer_of_match[] = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 304/399 cmd64x: potential buffer overflow in cmd64x_program_timings()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 117fcc3053606d8db5cef8821dca15022ae578bb ]
The "drive->dn" value is a u8 and it is controlled by root only, but it could be out of bounds here so let's check.
--- drivers/ide/cmd64x.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ide/cmd64x.c +3 -0
@@ -66,6 +66,9 @@ static void cmd64x_program_timings(ide_drive_t *drive, u8 mode)struct ide_timing t;u8 arttim =0 ; +if (drive->dn >=ARRAY_SIZE (drwtim_regs)) +return ; +ide_timing_compute (drive, mode, &t,T ,0 );/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 306/399 pwm: Remove set but not set variable pwm
In reply to Greg Kroah-HartmanFrom: yu kuai <[email protected]>
[ Upstream commit 9871abffc81048e20f02e15d6aa4558a44ad53ea ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/pwm/pwm-pca9685.c: In function ‘pca9685_pwm_gpio_free’: drivers/pwm/pwm-pca9685.c:162:21: warning: variable ‘pwm’ set but not used [-Wunused-but-set-variable]
It is never used, and so can be removed. In that case, hold and release the lock 'pca->lock' can be removed since nothing will be done between them.
--- drivers/pwm/pwm-pca9685.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/pwm/pwm-pca9685.c +0 -4
@@ -159,13 +159,9 @@ static void pca9685_pwm_gpio_set(struct gpio_chip *gpio, unsigned int offset,static void pca9685_pwm_gpio_free (struct gpio_chip *gpio,unsigned int offset) {struct pca9685 *pca =gpiochip_get_data (gpio); -struct pwm_device *pwm;pca9685_pwm_gpio_set (gpio, offset,0 );pm_runtime_put (pca->chip.dev); -mutex_lock (&pca->lock); - pwm = &pca->chip.pwms[offset]; -mutex_unlock (&pca->lock); } static int pca9685_pwm_gpio_get_direction(struct gpio_chip *chip,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 305/399 ide: serverworks: potential overflow in svwks_set_pio_mode()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit ce1f31b4c0b9551dd51874dd5364654ed4ca13ae ]
The "drive->dn" variable is a u8 controlled by root.
--- drivers/ide/serverworks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/ide/serverworks.c +6 -0
@@ -115,6 +115,9 @@ static void svwks_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)struct pci_dev *dev =to_pci_dev (hwif->dev);const u8 pio = drive->pio_mode -XFER_PIO_0 ; +if (drive->dn >=ARRAY_SIZE (drive_pci)) +return ; +pci_write_config_byte (dev, drive_pci[drive->dn], pio_modes[pio]);if (svwks_csb_check (dev)) {
@@ -141,6 +144,9 @@ static void svwks_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)u8 ultra_enable =0 , ultra_timing =0 , dma_timing =0 ; +if (drive->dn >=ARRAY_SIZE (drive_pci2)) +return ; +pci_read_config_byte (dev, (0x56 |hwif->channel), &ultra_timing);pci_read_config_byte (dev,0x54 , &ultra_enable);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 307/399 btrfs: fix possible NULL-pointer dereference in integrity checks
In reply to Greg Kroah-HartmanFrom: Johannes Thumshirn <[email protected]>
[ Upstream commit 3dbd351df42109902fbcebf27104149226a4fcd9 ]
A user reports a possible NULL-pointer dereference in btrfsic_process_superblock(). We are assigning state->fs_info to a local fs_info variable and afterwards checking for the presence of state.
While we would BUG_ON() a NULL state anyways, we can also just remove the local fs_info copy, as fs_info is only used once as the first argument for btrfs_num_copies(). There we can just pass in state->fs_info as well.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205003
--- fs/btrfs/check-integrity.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/check-integrity.c +1 -2
@@ -629,7 +629,6 @@ static struct btrfsic_dev_state *btrfsic_dev_state_hashtable_lookup(dev_t dev,static int btrfsic_process_superblock (struct btrfsic_state *state,struct btrfs_fs_devices *fs_devices) { -struct btrfs_fs_info *fs_info = state->fs_info;struct btrfs_super_block *selected_super;struct list_head *dev_head = &fs_devices->devices;struct btrfs_device *device;
@@ -700,7 +699,7 @@ static int btrfsic_process_superblock(struct btrfsic_state *state,break ; } - num_copies =btrfs_num_copies (fs_info, next_bytenr, + num_copies =btrfs_num_copies (state->fs_info, next_bytenr, state->metablock_size);if (state->print_mask &BTRFSIC_PRINT_MASK_NUM_COPIES ) pr_info("num_copies(log_bytenr=%llu) = %d\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 309/399 btrfs: device stats, log when stats are zeroed
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
[ Upstream commit a69976bc69308aa475d0ba3b8b3efd1d013c0460 ]
We had a report indicating that some read errors aren't reported by the device stats in the userland. It is important to have the errors reported in the device stat as user land scripts might depend on it to take the reasonable corrective actions. But to debug these issue we need to be really sure that request to reset the device stat did not come from the userland itself. So log an info message when device error reset happens.
For example:
BTRFS info (device sdc): device stats zeroed by btrfs(9223)
--- fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/volumes.c +2 -0
@@ -7342,6 +7342,8 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,else btrfs_dev_stat_set (dev, i,0 ); } +btrfs_info (fs_info,"device stats zeroed by %s (%d)" , + current->comm,task_pid_nr (current)); }else {for (i =0 ; i <BTRFS_DEV_STAT_VALUES_MAX ; i++)if (stats->nr_items > i)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 310/399 module: avoid setting info->name early in case we can fall back to info->mod->name
In reply to Greg Kroah-HartmanFrom: Jessica Yu <[email protected]>
[ Upstream commit 708e0ada1916be765b7faa58854062f2bc620bbf ]
In setup_load_info(), info->name (which contains the name of the module, mostly used for early logging purposes before the module gets set up) gets unconditionally assigned if .modinfo is missing despite the fact that there is an if (!info->name) check near the end of the function. Avoid assigning a placeholder string to info->name if .modinfo doesn't exist, so that we can fall back to info->mod->name later on.
--- kernel/module.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
kernel/module.c +4 -5
@@ -3059,9 +3059,7 @@ static int setup_load_info(struct load_info *info, int flags)/* Try to find a name early so we can log errors with a module name */ info->index.info =find_sec (info,".modinfo" ); -if (!info->index.info) - info->name ="(missing .modinfo section)" ; -else +if (info->index.info) info->name =get_modinfo (info,"name" );/* Find internal symbols and strings. */
@@ -3076,14 +3074,15 @@ static int setup_load_info(struct load_info *info, int flags) }if (info->index.sym ==0 ) { -pr_warn ("%s: module has no symbols (stripped?)\n" , info->name); +pr_warn ("%s: module has no symbols (stripped?)\n" , + info->name ?:"(missing .modinfo section or name field)" );return -ENOEXEC ; } info->index.mod =find_sec (info,".gnu.linkonce.this_module" );if (!info->index.mod) {pr_warn ("%s: No module found in object\n" , - info->name ?:"(missing .modinfo name field)" ); + info->name ?:"(missing .modinfo section or name field)" );return -ENOEXEC ; }/* This is temporary: point mod into copy of data. */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 312/399 regulator: core: Fix exported symbols to the exported GPL version
In reply to Greg Kroah-HartmanFrom: Enric Balletbo i Serra <[email protected]>
[ Upstream commit 3d7610e8da993539346dce6f7c909fd3d56bf4d5 ]
Change the exported symbols introduced by commit e9153311491da ("regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage") from EXPORT_SYMBOL() to EXPORT_SYMBOL_GPL(), like is used for all the core parts.
--- drivers/regulator/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/core.c +2 -2
@@ -3470,7 +3470,7 @@ int regulator_set_voltage_rdev(struct regulator_dev *rdev, int min_uV, out:return ret; } -EXPORT_SYMBOL (regulator_set_voltage_rdev); +EXPORT_SYMBOL_GPL (regulator_set_voltage_rdev);static int regulator_limit_voltage_step (struct regulator_dev *rdev,int *current_uV,int *min_uV)
@@ -4035,7 +4035,7 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev)return ret;return ret - rdev->constraints->uV_offset; } -EXPORT_SYMBOL (regulator_get_voltage_rdev); +EXPORT_SYMBOL_GPL (regulator_get_voltage_rdev);/** * regulator_get_voltage - get regulator output voltage
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 277/399 ALSA: usb-audio: add implicit fb quirk for MOTU M Series
In reply to Greg Kroah-HartmanFrom: Alexander Tsoy <[email protected]>
[ Upstream commit c249177944b650816069f6c49b769baaa94339dc ]
This fixes crackling sound during playback.
Further note: MOTU is known for reusing Product IDs for different devices or different generations of the device (e.g. MicroBook I/II/IIc shares a single Product ID). This patch was only tested with M4 audio interface, but the same Product ID is also used by M2. Hope it will work for M2 as well.
--- sound/usb/pcm.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/usb/pcm.c +4 -0
@@ -348,6 +348,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, ep =0x84 ; ifnum =0 ; goto add_sync_ep_from_ifnum; +case USB_ID (0x07fd ,0x0008 ):/* MOTU M Series */ + ep =0x81 ; + ifnum =2 ; + goto add_sync_ep_from_ifnum;case USB_ID (0x0582 ,0x01d8 ):/* BOSS Katana */ /* BOSS Katana amplifiers do not need quirks */ return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 278/399 PM / devfreq: Add debugfs support with devfreq_summary file
In reply to Greg Kroah-HartmanFrom: Chanwoo Choi <[email protected]>
[ Upstream commit 490a421bc575d1bf391a6ad5b582dcfbd0037724 ]
Add debugfs interface to provide debugging information of devfreq device. It contains 'devfreq_summary' entry to show the summary of registered devfreq devices as following and the additional debugfs file will be added.
- /sys/kernel/debug/devfreq/devfreq_summary
[Detailed description of each field of 'devfreq_summary' debugfs file]
- dev_name : Device name of h/w
- dev : Device name made by devfreq core
- parent_dev : If devfreq device uses the passive governor,
show parent devfreq device name. Otherwise, show 'null'.
- governor : Devfreq governor name
- polling_ms : If devfreq device uses the simple_ondemand governor,
polling_ms is necessary for the period. (unit: millisecond)
- cur_freq_Hz : Current frequency (unit: Hz)
- min_freq_Hz : Minimum frequency (unit: Hz)
- max_freq_Hz : Maximum frequency (unit: Hz)
[For example on Exynos5422-based Odroid-XU3 board]
$ cat /sys/kernel/debug/devfreq/devfreq_summary dev_name dev parent_dev governor polling_ms cur_freq_Hz min_freq_Hz max_freq_Hz ------------------------------ ---------- ---------- --------------- ---------- ------------ ------------ ------------ 10c20000.memory-controller devfreq0 null simple_ondemand 0 165000000 165000000 825000000 soc:bus_wcore devfreq1 null simple_ondemand 50 532000000 88700000 532000000 soc:bus_noc devfreq2 devfreq1 passive 0 111000000 66600000 111000000 soc:bus_fsys_apb devfreq3 devfreq1 passive 0 222000000 111000000 222000000 soc:bus_fsys devfreq4 devfreq1 passive 0 200000000 75000000 200000000 soc:bus_fsys2 devfreq5 devfreq1 passive 0 200000000 75000000 200000000 soc:bus_mfc devfreq6 devfreq1 passive 0 333000000 83250000 333000000 soc:bus_gen devfreq7 devfreq1 passive 0 266000000 88700000 266000000 soc:bus_peri devfreq8 devfreq1 passive 0 66600000 66600000 66600000 soc:bus_g2d devfreq9 devfreq1 passive 0 333000000 83250000 333000000 soc:bus_g2d_acp devfreq10 devfreq1 passive 0 266000000 66500000 266000000 soc:bus_jpeg devfreq11 devfreq1 passive 0 300000000 75000000 300000000 soc:bus_jpeg_apb devfreq12 devfreq1 passive 0 166500000 83250000 166500000 soc:bus_disp1_fimd devfreq13 devfreq1 passive 0 200000000 120000000 200000000 soc:bus_disp1 devfreq14 devfreq1 passive 0 300000000 120000000 300000000 soc:bus_gscl_scaler devfreq15 devfreq1 passive 0 300000000 150000000 300000000 soc:bus_mscl devfreq16 devfreq1 passive 0 666000000 84000000 666000000
--- drivers/devfreq/devfreq.c | 82 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
drivers/devfreq/devfreq.c +82 -0
@@ -10,6 +10,7 @@#include <linux/kernel.h> #include <linux/kmod.h> #include <linux/sched.h> +#include <linux/debugfs.h> #include <linux/errno.h> #include <linux/err.h> #include <linux/init.h>
@@ -33,6 +34,7 @@#define HZ_PER_KHZ 1000static struct class *devfreq_class; +static struct dentry *devfreq_debugfs;/* * devfreq core provides delayed work based load monitoring helper
@@ -1614,6 +1616,81 @@ static struct attribute *devfreq_attrs[] = { };ATTRIBUTE_GROUPS (devfreq); +/** +* devfreq_summary_show() - Show the summary of the devfreq devices +* @s: seq_file instance to show the summary of devfreq devices +* @data: not used +* +* Show the summary of the devfreq devices via 'devfreq_summary' debugfs file. +* It helps that user can know the detailed information of the devfreq devices. +* +* Return 0 always because it shows the information without any data change. +*/ +static int devfreq_summary_show (struct seq_file *s,void *data) +{ +struct devfreq *devfreq; +struct devfreq *p_devfreq =NULL ; +unsigned long cur_freq, min_freq, max_freq; +unsigned int polling_ms; + +seq_printf (s,"%-30s %-10s %-10s %-15s %10s %12s %12s %12s\n" , +"dev_name" , +"dev" , +"parent_dev" , +"governor" , +"polling_ms" , +"cur_freq_Hz" , +"min_freq_Hz" , +"max_freq_Hz" ); +seq_printf (s,"%30s %10s %10s %15s %10s %12s %12s %12s\n" , +"------------------------------" , +"----------" , +"----------" , +"---------------" , +"----------" , +"------------" , +"------------" , +"------------" ); + +mutex_lock (&devfreq_list_lock); + +list_for_each_entry_reverse (devfreq, &devfreq_list, node) { +#if IS_ENABLED (CONFIG_DEVFREQ_GOV_PASSIVE ) +if (!strncmp (devfreq->governor_name,DEVFREQ_GOV_PASSIVE , +DEVFREQ_NAME_LEN )) { +struct devfreq_passive_data *data = devfreq->data; + +if (data) + p_devfreq = data->parent; + }else { + p_devfreq =NULL ; + } +#endif + +mutex_lock (&devfreq->lock); + cur_freq = devfreq->previous_freq, +get_freq_range (devfreq, &min_freq, &max_freq); + polling_ms = devfreq->profile->polling_ms, +mutex_unlock (&devfreq->lock); + +seq_printf (s, +"%-30s %-10s %-10s %-15s %10d %12ld %12ld %12ld\n" , +dev_name (devfreq->dev.parent), +dev_name (&devfreq->dev), + p_devfreq ?dev_name (&p_devfreq->dev) :"null" , + devfreq->governor_name, + polling_ms, + cur_freq, + min_freq, + max_freq); + } + +mutex_unlock (&devfreq_list_lock); + +return 0 ; +} +DEFINE_SHOW_ATTRIBUTE (devfreq_summary); +static int __init devfreq_init (void ) { devfreq_class =class_create (THIS_MODULE ,"devfreq" );
@@ -1630,6 +1707,11 @@ static int __init devfreq_init(void) } devfreq_class->dev_groups = devfreq_groups; + devfreq_debugfs =debugfs_create_dir ("devfreq" ,NULL ); +debugfs_create_file ("devfreq_summary" ,0444 , + devfreq_debugfs,NULL , + &devfreq_summary_fops); +return 0 ; }subsys_initcall (devfreq_init);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 280/399 RDMA/mlx5: Dont fake udata for kernel path
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 4835709176e8ccf6561abc9f5c405293e008095f ]
Kernel paths must not set udata and provide NULL pointer, instead of faking zeroed udata struct.
--- drivers/infiniband/hw/mlx5/main.c | 34 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/infiniband/hw/mlx5/main.c +16 -18
@@ -815,6 +815,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,struct ib_device_attr *props, struct ib_udata *uhw) { + size_t uhw_outlen = (uhw) ? uhw->outlen : 0;struct mlx5_ib_dev *dev =to_mdev (ibdev);struct mlx5_core_dev *mdev = dev->mdev;int err = -ENOMEM ;
@@ -828,12 +829,12 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,u64 max_tso; resp_len =sizeof (resp.comp_mask) +sizeof (resp.response_length); -if (uhw->outlen && uhw->outlen < resp_len) +if (uhw_outlen && uhw_outlen < resp_len)return -EINVAL ; resp.response_length = resp_len; -if (uhw->inlen && !ib_is_udata_cleared (uhw,0 , uhw->inlen)) +if (uhw && uhw->inlen && !ib_is_udata_cleared (uhw,0 , uhw->inlen))return -EINVAL ;memset (props,0 ,sizeof (*props));
@@ -897,7 +898,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, props->raw_packet_caps |=IB_RAW_PACKET_CAP_CVLAN_STRIPPING ; -if (field_avail (typeof (resp), tso_caps, uhw->outlen)) { +if (field_avail (typeof (resp), tso_caps, uhw_outlen)) { max_tso =MLX5_CAP_ETH (mdev, max_lso_cap);if (max_tso) { resp.tso_caps.max_tso =1 << max_tso;
@@ -907,7 +908,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, } } -if (field_avail (typeof (resp), rss_caps, uhw->outlen)) { +if (field_avail (typeof (resp), rss_caps, uhw_outlen)) { resp.rss_caps.rx_hash_function =MLX5_RX_HASH_FUNC_TOEPLITZ ; resp.rss_caps.rx_hash_fields_mask =
@@ -927,9 +928,9 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, resp.response_length +=sizeof (resp.rss_caps); } }else { -if (field_avail (typeof (resp), tso_caps, uhw->outlen)) +if (field_avail (typeof (resp), tso_caps, uhw_outlen)) resp.response_length +=sizeof (resp.tso_caps); -if (field_avail (typeof (resp), rss_caps, uhw->outlen)) +if (field_avail (typeof (resp), rss_caps, uhw_outlen)) resp.response_length +=sizeof (resp.rss_caps); }
@@ -1054,7 +1055,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,MLX5_MAX_CQ_PERIOD ; } -if (field_avail (typeof (resp), cqe_comp_caps, uhw->outlen)) { +if (field_avail (typeof (resp), cqe_comp_caps, uhw_outlen)) { resp.response_length +=sizeof (resp.cqe_comp_caps);if (MLX5_CAP_GEN (dev->mdev, cqe_compression)) {
@@ -1072,7 +1073,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, } } -if (field_avail (typeof (resp), packet_pacing_caps, uhw->outlen) && +if (field_avail (typeof (resp), packet_pacing_caps, uhw_outlen) && raw_support) {if (MLX5_CAP_QOS (mdev, packet_pacing) &&MLX5_CAP_GEN (mdev, qos)) {
@@ -1091,7 +1092,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, }if (field_avail (typeof (resp), mlx5_ib_support_multi_pkt_send_wqes, - uhw->outlen)) { + uhw_outlen)) {if (MLX5_CAP_ETH (mdev, multi_pkt_send_wqe)) resp.mlx5_ib_support_multi_pkt_send_wqes =MLX5_IB_ALLOW_MPW ;
@@ -1104,7 +1105,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,sizeof (resp.mlx5_ib_support_multi_pkt_send_wqes); } -if (field_avail (typeof (resp), flags, uhw->outlen)) { +if (field_avail (typeof (resp), flags, uhw_outlen)) { resp.response_length +=sizeof (resp.flags);if (MLX5_CAP_GEN (mdev, cqe_compression_128))
@@ -1120,8 +1121,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, resp.flags |=MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT ; } -if (field_avail (typeof (resp), sw_parsing_caps, - uhw->outlen)) { +if (field_avail (typeof (resp), sw_parsing_caps, uhw_outlen)) { resp.response_length +=sizeof (resp.sw_parsing_caps);if (MLX5_CAP_ETH (mdev, swp)) { resp.sw_parsing_caps.sw_parsing_offloads |=
@@ -1141,7 +1141,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, } } -if (field_avail (typeof (resp), striding_rq_caps, uhw->outlen) && +if (field_avail (typeof (resp), striding_rq_caps, uhw_outlen) && raw_support) { resp.response_length +=sizeof (resp.striding_rq_caps);if (MLX5_CAP_GEN (mdev, striding_rq)) {
@@ -1164,8 +1164,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, } } -if (field_avail (typeof (resp), tunnel_offloads_caps, - uhw->outlen)) { +if (field_avail (typeof (resp), tunnel_offloads_caps, uhw_outlen)) { resp.response_length +=sizeof (resp.tunnel_offloads_caps);if (MLX5_CAP_ETH (mdev, tunnel_stateless_vxlan)) resp.tunnel_offloads_caps |=
@@ -1186,7 +1185,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,MLX5_IB_TUNNELED_OFFLOADS_MPLS_UDP ; } -if (uhw->outlen) { +if (uhw_outlen) { err =ib_copy_to_udata (uhw, &resp, resp.response_length);if (err)
@@ -4771,7 +4770,6 @@ static int __get_port_caps(struct mlx5_ib_dev *dev, u8 port)struct ib_device_attr *dprops =NULL ;struct ib_port_attr *pprops =NULL ;int err = -ENOMEM ; -struct ib_udata uhw = {.inlen =0 , .outlen =0 }; pprops =kzalloc (sizeof (*pprops),GFP_KERNEL );if (!pprops)
@@ -4781,7 +4779,7 @@ static int __get_port_caps(struct mlx5_ib_dev *dev, u8 port)if (!dprops) goto out; - err =mlx5_ib_query_device (&dev->ib_dev, dprops, &uhw); + err =mlx5_ib_query_device (&dev->ib_dev, dprops,NULL );if (err) {mlx5_ib_warn (dev,"query_device failed %d\n" , err); goto out;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 281/399 arm64: lse: fix LSE atomics with LLVMs integrated assembler
In reply to Greg Kroah-HartmanFrom: Sami Tolvanen <[email protected]>
[ Upstream commit e0d5896bd356cd577f9710a02d7a474cdf58426b ]
Unlike gcc, clang considers each inline assembly block to be independent and therefore, when using the integrated assembler for inline assembly, any preambles that enable features must be repeated in each block.
This change defines __LSE_PREAMBLE and adds it to each inline assembly block that has LSE instructions, which allows them to be compiled also with clang's assembler.
--- arch/arm64/include/asm/atomic_lse.h | 19 +++++++++++++++++++ arch/arm64/include/asm/lse.h | 6 +++--- 2 files changed, 22 insertions(+), 3 deletions(-)
arch/arm64/include/asm/atomic_lse.h +19 -0
@@ -14,6 +14,7 @@ static inline void __lse_atomic_##op(int i, atomic_t *v) \ { \ asm volatile( \ + __LSE_PREAMBLE \ " " #asm_op " %w[i], %[v]\n" \ : [i] "+r" (i), [v] "+Q" (v->counter) \ : "r" (v)); \
@@ -30,6 +31,7 @@ ATOMIC_OP(add, stadd) static inline int __lse_atomic_fetch_##op##name(int i, atomic_t *v) \ { \ asm volatile( \ + __LSE_PREAMBLE \ " " #asm_op #mb " %w[i], %w[i], %[v]" \ : [i] "+r" (i), [v] "+Q" (v->counter) \ : "r" (v) \
@@ -58,6 +60,7 @@ static inline int __lse_atomic_add_return##name(int i, atomic_t *v) \u32 tmp; \ \ asm volatile( \ + __LSE_PREAMBLE \ " ldadd" #mb " %w[i], %w[tmp], %[v]\n" \ " add %w[i], %w[i], %w[tmp]" \ : [i] "+r" (i), [v] "+Q" (v->counter), [tmp] "=&r" (tmp) \
@@ -77,6 +80,7 @@ ATOMIC_OP_ADD_RETURN( , al, "memory")static inline void __lse_atomic_and (int i,atomic_t *v) { asmvolatile ( + __LSE_PREAMBLE" mvn %w[i], %w[i]\n" " stclr %w[i], %[v]" : [i] "+&r" (i), [v] "+Q" (v->counter)
@@ -87,6 +91,7 @@ static inline void __lse_atomic_and(int i, atomic_t *v) static inline int __lse_atomic_fetch_and##name(int i, atomic_t *v) \ { \ asm volatile( \ + __LSE_PREAMBLE \ " mvn %w[i], %w[i]\n" \ " ldclr" #mb " %w[i], %w[i], %[v]" \ : [i] "+&r" (i), [v] "+Q" (v->counter) \
@@ -106,6 +111,7 @@ ATOMIC_FETCH_OP_AND( , al, "memory")static inline void __lse_atomic_sub (int i,atomic_t *v) { asmvolatile ( + __LSE_PREAMBLE" neg %w[i], %w[i]\n" " stadd %w[i], %[v]" : [i] "+&r" (i), [v] "+Q" (v->counter)
@@ -118,6 +124,7 @@ static inline int __lse_atomic_sub_return##name(int i, atomic_t *v) \u32 tmp; \ \ asm volatile( \ + __LSE_PREAMBLE \ " neg %w[i], %w[i]\n" \ " ldadd" #mb " %w[i], %w[tmp], %[v]\n" \ " add %w[i], %w[i], %w[tmp]" \
@@ -139,6 +146,7 @@ ATOMIC_OP_SUB_RETURN( , al, "memory") static inline int __lse_atomic_fetch_sub##name(int i, atomic_t *v) \ { \ asm volatile( \ + __LSE_PREAMBLE \ " neg %w[i], %w[i]\n" \ " ldadd" #mb " %w[i], %w[i], %[v]" \ : [i] "+&r" (i), [v] "+Q" (v->counter) \
@@ -159,6 +167,7 @@ ATOMIC_FETCH_OP_SUB( , al, "memory") static inline void __lse_atomic64_##op(s64 i, atomic64_t *v) \ { \ asm volatile( \ + __LSE_PREAMBLE \ " " #asm_op " %[i], %[v]\n" \ : [i] "+r" (i), [v] "+Q" (v->counter) \ : "r" (v)); \
@@ -175,6 +184,7 @@ ATOMIC64_OP(add, stadd) static inline long __lse_atomic64_fetch_##op##name(s64 i, atomic64_t *v)\ { \ asm volatile( \ + __LSE_PREAMBLE \ " " #asm_op #mb " %[i], %[i], %[v]" \ : [i] "+r" (i), [v] "+Q" (v->counter) \ : "r" (v) \
@@ -203,6 +213,7 @@ static inline long __lse_atomic64_add_return##name(s64 i, atomic64_t *v)\unsigned long tmp; \ \ asm volatile( \ + __LSE_PREAMBLE \ " ldadd" #mb " %[i], %x[tmp], %[v]\n" \ " add %[i], %[i], %x[tmp]" \ : [i] "+r" (i), [v] "+Q" (v->counter), [tmp] "=&r" (tmp) \
@@ -222,6 +233,7 @@ ATOMIC64_OP_ADD_RETURN( , al, "memory")static inline void __lse_atomic64_and (s64 i,atomic64_t *v) { asmvolatile ( + __LSE_PREAMBLE" mvn %[i], %[i]\n" " stclr %[i], %[v]" : [i] "+&r" (i), [v] "+Q" (v->counter)
@@ -232,6 +244,7 @@ static inline void __lse_atomic64_and(s64 i, atomic64_t *v) static inline long __lse_atomic64_fetch_and##name(s64 i, atomic64_t *v) \ { \ asm volatile( \ + __LSE_PREAMBLE \ " mvn %[i], %[i]\n" \ " ldclr" #mb " %[i], %[i], %[v]" \ : [i] "+&r" (i), [v] "+Q" (v->counter) \
@@ -251,6 +264,7 @@ ATOMIC64_FETCH_OP_AND( , al, "memory")static inline void __lse_atomic64_sub (s64 i,atomic64_t *v) { asmvolatile ( + __LSE_PREAMBLE" neg %[i], %[i]\n" " stadd %[i], %[v]" : [i] "+&r" (i), [v] "+Q" (v->counter)
@@ -263,6 +277,7 @@ static inline long __lse_atomic64_sub_return##name(s64 i, atomic64_t *v) \unsigned long tmp; \ \ asm volatile( \ + __LSE_PREAMBLE \ " neg %[i], %[i]\n" \ " ldadd" #mb " %[i], %x[tmp], %[v]\n" \ " add %[i], %[i], %x[tmp]" \
@@ -284,6 +299,7 @@ ATOMIC64_OP_SUB_RETURN( , al, "memory") static inline long __lse_atomic64_fetch_sub##name(s64 i, atomic64_t *v) \ { \ asm volatile( \ + __LSE_PREAMBLE \ " neg %[i], %[i]\n" \ " ldadd" #mb " %[i], %[i], %[v]" \ : [i] "+&r" (i), [v] "+Q" (v->counter) \
@@ -305,6 +321,7 @@ static inline s64 __lse_atomic64_dec_if_positive(atomic64_t *v)unsigned long tmp; asmvolatile ( + __LSE_PREAMBLE"1: ldr %x[tmp], %[v]\n" " subs %[ret], %x[tmp], #1\n" " b.lt 2f\n"
@@ -332,6 +349,7 @@ __lse__cmpxchg_case_##name##sz(volatile void *ptr, \unsigned long tmp; \ \ asm volatile( \ + __LSE_PREAMBLE \ " mov %" #w "[tmp], %" #w "[old]\n" \ " cas" #mb #sfx "\t%" #w "[tmp], %" #w "[new], %[v]\n" \ " mov %" #w "[ret], %" #w "[tmp]" \
@@ -379,6 +397,7 @@ __lse__cmpxchg_double##name(unsigned long old1, \ register unsigned long x4 asm ("x4") = (unsigned long)ptr; \ \ asm volatile( \ + __LSE_PREAMBLE \ " casp" #mb "\t%[old1], %[old2], %[new1], %[new2], %[v]\n"\ " eor %[old1], %[old1], %[oldval1]\n" \ " eor %[old2], %[old2], %[oldval2]\n" \
arch/arm64/include/asm/lse.h +3 -3
@@ -6,6 +6,8 @@#if defined(CONFIG_AS_LSE ) && defined(CONFIG_ARM64_LSE_ATOMICS ) +#define __LSE_PREAMBLE ".arch armv8-a+lse\n" +#include <linux/compiler_types.h> #include <linux/export.h> #include <linux/jump_label.h>
@@ -14,8 +16,6 @@#include <asm/atomic_lse.h> #include <asm/cpucaps.h> -__asm__(".arch_extension lse" ); -extern struct static_key_false cpu_hwcap_keys[ARM64_NCAPS ];extern struct static_key_false arm64_const_caps_ready;
@@ -34,7 +34,7 @@ static inline bool system_uses_lse_atomics(void)/* In-line patching at runtime */ #define ARM64_LSE_ATOMIC_INSN (llsc, lse) \ - ALTERNATIVE(llsc, lse, ARM64_HAS_LSE_ATOMICS) + ALTERNATIVE(llsc, __LSE_PREAMBLE lse, ARM64_HAS_LSE_ATOMICS)#else /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 282/399 arm64: fix alternatives with LLVMs integrated assembler
In reply to Greg Kroah-HartmanFrom: Sami Tolvanen <[email protected]>
[ Upstream commit c54f90c2627cc316d365e3073614731e17dbc631 ]
LLVM's integrated assembler fails with the following error when building KVM:
<inline asm>:12:6: error: expected absolute expression
.if kvm_update_va_mask == 0
^
<inline asm>:21:6: error: expected absolute expression
.if kvm_update_va_mask == 0
^
<inline asm>:24:2: error: unrecognized instruction mnemonic
NOT_AN_INSTRUCTION
^LLVM ERROR: Error parsing inline asm
These errors come from ALTERNATIVE_CB and __ALTERNATIVE_CFG, which test for the existence of the callback parameter in inline assembly using the following expression:
" .if " __stringify(cb) " == 0\n"
This works with GNU as, but isn't supported by LLVM. This change splits __ALTERNATIVE_CFG and ALTINSTR_ENTRY into separate macros to fix the LLVM build.
--- arch/arm64/include/asm/alternative.h | 32 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-)
arch/arm64/include/asm/alternative.h +21 -11
@@ -35,13 +35,16 @@ void apply_alternatives_module(void *start, size_t length);static inline void apply_alternatives_module (void *start,size_t length) { }#endif -#define ALTINSTR_ENTRY (feature,cb) \ +#define ALTINSTR_ENTRY (feature) \ " .word 661b - .\n"/* label */ \ - " .if " __stringify(cb) " == 0\n" \" .word 663f - .\n" /* new instruction */ \ -" .else\n" \ + " .hword " __stringify(feature) "\n" /* feature bit */ \ +" .byte 662b-661b\n" /* source len */ \ + " .byte 664f-663f\n" /* replacement len */ + +#define ALTINSTR_ENTRY_CB (feature, cb) \ + " .word 661b - .\n"/* label */ \ " .word " __stringify(cb) "- .\n" /* callback */ \ -" .endif\n" \ " .hword " __stringify(feature) "\n" /* feature bit */ \" .byte 662b-661b\n" /* source len */ \" .byte 664f-663f\n" /* replacement len */
@@ -62,15 +65,14 @@ static inline void apply_alternatives_module(void *start, size_t length) { }* * Alternatives with callbacks do not generate replacement instructions. */ -#define __ALTERNATIVE_CFG (oldinstr, newinstr, feature, cfg_enabled, cb) \ +#define __ALTERNATIVE_CFG (oldinstr, newinstr, feature, cfg_enabled) \ ".if "__stringify(cfg_enabled)" == 1\n" \ "661:\n\t" \ oldinstr "\n" \ "662:\n" \ ".pushsection .altinstructions,\"a\"\n" \ - ALTINSTR_ENTRY(feature,cb) \ + ALTINSTR_ENTRY(feature) \ ".popsection\n" \ - " .if " __stringify(cb) " == 0\n" \ ".pushsection .altinstr_replacement, \"a\"\n" \ "663:\n\t" \ newinstr "\n" \
@@ -78,17 +80,25 @@ static inline void apply_alternatives_module(void *start, size_t length) { }".popsection\n\t" \".org . - (664b-663b) + (662b-661b)\n\t" \".org . - (662b-661b) + (664b-663b)\n" \ -".else\n\t" \ + ".endif\n" + +#define __ALTERNATIVE_CFG_CB (oldinstr, feature, cfg_enabled, cb) \ + ".if "__stringify(cfg_enabled)" == 1\n" \ + "661:\n\t" \ + oldinstr "\n" \ + "662:\n" \ + ".pushsection .altinstructions,\"a\"\n" \ + ALTINSTR_ENTRY_CB(feature, cb) \ + ".popsection\n" \ "663:\n\t" \ "664:\n\t" \ -".endif\n" \ ".endif\n"#define _ALTERNATIVE_CFG (oldinstr, newinstr, feature, cfg, ...) \ - __ALTERNATIVE_CFG(oldinstr, newinstr, feature, IS_ENABLED(cfg), 0) + __ALTERNATIVE_CFG(oldinstr, newinstr, feature, IS_ENABLED(cfg))#define ALTERNATIVE_CB (oldinstr, cb) \ - __ALTERNATIVE_CFG(oldinstr, "NOT_AN_INSTRUCTION", ARM64_CB_PATCH, 1, cb) + __ALTERNATIVE_CFG_CB(oldinstr, ARM64_CB_PATCH, 1, cb)#else #include <asm/assembler.h>
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 273/399 scsi: iscsi: Dont destroy session if there are outstanding connections
In reply to Greg Kroah-HartmanFrom: Nick Black <[email protected]>
[ Upstream commit 54155ed4199c7aa3fd20866648024ab63c96d579 ]
A faulty userspace that calls destroy_session() before destroying the connections can trigger the failure. This patch prevents the issue by refusing to destroy the session if there are outstanding connections.
------------[ cut here ]------------ kernel BUG at mm/slub.c:306! invalid opcode: 0000 [#1] SMP PTI CPU: 1 PID: 1224 Comm: iscsid Not tainted 5.4.0-rc2.iscsi+ #7 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:__slab_free+0x181/0x350 [...] [ 1209.686056] RSP: 0018:ffffa93d4074fae0 EFLAGS: 00010246 [ 1209.686694] RAX: ffff934efa5ad800 RBX: 000000008010000a RCX: ffff934efa5ad800 [ 1209.687651] RDX: ffff934efa5ad800 RSI: ffffeb4041e96b00 RDI: ffff934efd402c40 [ 1209.688582] RBP: ffffa93d4074fb80 R08: 0000000000000001 R09: ffffffffbb5dfa26 [ 1209.689425] R10: ffff934efa5ad800 R11: 0000000000000001 R12: ffffeb4041e96b00 [ 1209.690285] R13: ffff934efa5ad800 R14: ffff934efd402c40 R15: 0000000000000000 [ 1209.691213] FS: 00007f7945dfb540(0000) GS:ffff934efda80000(0000) knlGS:0000000000000000 [ 1209.692316] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1209.693013] CR2: 000055877fd3da80 CR3: 0000000077384000 CR4: 00000000000006e0 [ 1209.693897] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1209.694773] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1209.695631] Call Trace: [ 1209.695957] ? __wake_up_common_lock+0x8a/0xc0 [ 1209.696712] iscsi_pool_free+0x26/0x40 [ 1209.697263] iscsi_session_teardown+0x2f/0xf0 [ 1209.698117] iscsi_sw_tcp_session_destroy+0x45/0x60 [ 1209.698831] iscsi_if_rx+0xd88/0x14e0 [ 1209.699370] netlink_unicast+0x16f/0x200 [ 1209.699932] netlink_sendmsg+0x21a/0x3e0 [ 1209.700446] sock_sendmsg+0x4f/0x60 [ 1209.700902] ___sys_sendmsg+0x2ae/0x320 [ 1209.701451] ? cp_new_stat+0x150/0x180 [ 1209.701922] __sys_sendmsg+0x59/0xa0 [ 1209.702357] do_syscall_64+0x52/0x160 [ 1209.702812] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 1209.703419] RIP: 0033:0x7f7946433914 [...] [ 1209.706084] RSP: 002b:00007fffb99f2378 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [ 1209.706994] RAX: ffffffffffffffda RBX: 000055bc869eac20 RCX: 00007f7946433914 [ 1209.708082] RDX: 0000000000000000 RSI: 00007fffb99f2390 RDI: 0000000000000005 [ 1209.709120] RBP: 00007fffb99f2390 R08: 000055bc84fe9320 R09: 00007fffb99f1f07 [ 1209.710110] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000038 [ 1209.711085] R13: 000055bc8502306e R14: 0000000000000000 R15: 0000000000000000 Modules linked in: ---[ end trace a2d933ede7f730d8 ]---
--- drivers/scsi/iscsi_tcp.c | 4 ++++ drivers/scsi/scsi_transport_iscsi.c | 26 +++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-)
drivers/scsi/iscsi_tcp.c +4 -0
@@ -887,6 +887,10 @@ free_host:static void iscsi_sw_tcp_session_destroy (struct iscsi_cls_session *cls_session) {struct Scsi_Host *shost =iscsi_session_to_shost (cls_session); +struct iscsi_session *session = cls_session->dd_data; + +if (WARN_ON_ONCE (session->leadconn)) +return ;iscsi_tcp_r2tpool_free (cls_session->dd_data);iscsi_session_teardown (cls_session);
drivers/scsi/scsi_transport_iscsi.c +23 -3
@@ -2947,6 +2947,24 @@ iscsi_set_path(struct iscsi_transport *transport, struct iscsi_uevent *ev)return err; } +static int iscsi_session_has_conns (int sid) +{ +struct iscsi_cls_conn *conn; +unsigned long flags; +int found =0 ; + +spin_lock_irqsave (&connlock, flags); +list_for_each_entry (conn, &connlist, conn_list) { +if (iscsi_conn_get_sid (conn) == sid) { + found =1 ; +break ; + } + } +spin_unlock_irqrestore (&connlock, flags); + +return found; +} +static int iscsi_set_iface_params (struct iscsi_transport *transport,struct iscsi_uevent *ev,uint32_t len)
@@ -3524,10 +3542,12 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)break ;case ISCSI_UEVENT_DESTROY_SESSION : session =iscsi_session_lookup (ev->u.d_session.sid); -if (session) - transport->destroy_session (session); -else +if (!session) err = -EINVAL ; +else if (iscsi_session_has_conns (ev->u.d_session.sid)) + err = -EBUSY ; +else + transport->destroy_session (session);break ;case ISCSI_UEVENT_UNBIND_SESSION : session =iscsi_session_lookup (ev->u.d_session.sid);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 323/399 bpf, btf: Always output invariant hit in pahole DWARF to BTF transform
In reply to Greg Kroah-HartmanFrom: Chris Down <[email protected]>
[ Upstream commit 2a67a6ccb01f21b854715d86ff6432a18b97adb3 ]
When trying to compile with CONFIG_DEBUG_INFO_BTF enabled, I got this error:
% make -s
Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make[3]: *** [vmlinux] Error 1
Compiling again without -s shows the true error (that pahole is missing), but since this is fatal, we should show the error unconditionally on stderr as well, not silence it using the info function. With this patch:
% make -s
BTF: .tmp_vmlinux.btf: pahole (pahole) is not available Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make[3]: *** [vmlinux] Error 1
--- scripts/link-vmlinux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/link-vmlinux.sh +2 -2
@@ -108,13 +108,13 @@ gen_btf() local bin_arch if ! [ -x "$(command -v ${PAHOLE})" ]; then - info "BTF" "${1}: pahole (${PAHOLE}) is not available" + echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available" return 1 fi pahole_ver=$(${PAHOLE} --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/') if [ "${pahole_ver}" -lt "113" ]; then - info "BTF" "${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.13" + echo >&2 "BTF: ${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.13" return 1 fi
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 324/399 ALSA: hda - Add docking station support for Lenovo Thinkpad T420s
In reply to Greg Kroah-HartmanFrom: Peter Große <[email protected]>
[ Upstream commit ef7d84caa5928b40b1c93a26dbe5a3f12737c6ab ]
Lenovo Thinkpad T420s uses the same codec as T420, so apply the same quirk to enable audio output on a docking station.
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -922,6 +922,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {SND_PCI_QUIRK (0x17aa ,0x215f ,"Lenovo T510" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21ce ,"Lenovo T420" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21cf ,"Lenovo T520" ,CXT_PINCFG_LENOVO_TP410 ), +SND_PCI_QUIRK (0x17aa ,0x21d2 ,"Lenovo T420s" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21da ,"Lenovo X220" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21db ,"Lenovo X220-tablet" ,CXT_PINCFG_LENOVO_TP410 ), SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 325/399 sunrpc: Fix potential leaks in sunrpc_cache_unhash()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 1d82163714c16ebe09c7a8c9cd3cef7abcc16208 ]
When we unhash the cache entry, we need to handle any pending upcalls by calling cache_fresh_unlocked().
--- net/sunrpc/cache.c | 2 ++ 1 file changed, 2 insertions(+)
net/sunrpc/cache.c +2 -0
@@ -1888,7 +1888,9 @@ void sunrpc_cache_unhash(struct cache_detail *cd, struct cache_head *h)if (!hlist_unhashed (&h->cache_list)){hlist_del_init_rcu (&h->cache_list); cd->entries--; +set_bit (CACHE_CLEANED , &h->flags);spin_unlock (&cd->hash_lock); +cache_fresh_unlocked (h, cd);cache_put (h, cd); }else spin_unlock (&cd->hash_lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 314/399 ALSA: hda/hdmi - add retry logic to parse_intel_hdmi()
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
[ Upstream commit 2928fa0a97ebb9549cb877fdc99aed9b95438c3a ]
The initial snd_hda_get_sub_node() can fail on certain devices (e.g. some Chromebook models using Intel GLK). The failure rate is very low, but as this is is part of the probe process, end-user impact is high.
In observed cases, related hardware status registers have expected values, but the node query still fails. Retrying the node query does seem to help, so fix the problem by adding retry logic to the query. This does not impact non-Intel platforms.
--- sound/pci/hda/patch_hdmi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c +5 -2
@@ -2862,9 +2862,12 @@ static int alloc_intel_hdmi(struct hda_codec *codec)/* parse and post-process for Intel codecs */ static int parse_intel_hdmi (struct hda_codec *codec) { -int err; +int err, retries =3 ; + +do { + err =hdmi_parse_codec (codec); + }while (err <0 && retries--); - err =hdmi_parse_codec (codec);if (err <0 ) {generic_spec_free (codec);return err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 326/399 drm/nouveau/mmu: fix comptag memory leak
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit 35e4909b6a2b4005ced3c4238da60d926b78fdea ]
--- drivers/gpu/drm/nouveau/nvkm/core/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/core/memory.c +1 -1
@@ -91,8 +91,8 @@ nvkm_memory_tags_get(struct nvkm_memory *memory, struct nvkm_device *device, }refcount_set (&tags->refcount,1 ); + *ptags = memory->tags = tags;mutex_unlock (&fb->subdev.mutex); - *ptags = tags;return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 330/399 btrfs: separate definition of assertion failure handlers
In reply to Greg Kroah-HartmanFrom: David Sterba <[email protected]>
[ Upstream commit 68c467cbb2f389b6c933e235bce0d1756fc8cc34 ]
There's a report where objtool detects unreachable instructions, eg.:
fs/btrfs/ctree.o: warning: objtool: btrfs_search_slot()+0x2d4: unreachable instruction
This seems to be a false positive due to compiler version. The cause is in the ASSERT macro implementation that does the conditional check as IS_DEFINED(CONFIG_BTRFS_ASSERT) and not an #ifdef.
To avoid that, use the ifdefs directly.
There are still 2 reports that aren't fixed:
fs/btrfs/extent_io.o: warning: objtool: __set_extent_bit()+0x71f: unreachable instruction fs/btrfs/relocation.o: warning: objtool: find_data_references()+0x4e0: unreachable instruction
--- fs/btrfs/ctree.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
fs/btrfs/ctree.h +12 -8
@@ -3108,17 +3108,21 @@ do { \rcu_read_unlock (); \ } while (0) -__cold -static inline void assfail(const char *expr, const char *file, int line) +#ifdef CONFIG_BTRFS_ASSERT +__cold __noreturn +static inline void assertfail (const char *expr,const char *file,int line) { -if (IS_ENABLED (CONFIG_BTRFS_ASSERT )) { -pr_err ("assertion failed: %s, in %s:%d\n" , expr, file, line); -BUG (); - } +pr_err ("assertion failed: %s, in %s:%d\n" , expr, file, line); +BUG (); } -#define ASSERT (expr) \ - (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) +#define ASSERT (expr) \ + (likely(expr) ? (void)0 : assertfail(#expr, __FILE__, __LINE__)) + +#else +static inline void assertfail (const char *expr,const char * file,int line) { } +#define ASSERT (expr) (void)(expr) +#endif /* * Use that for functions that are conditionally exported for sanity tests but
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 331/399 btrfs: Fix split-brain handling when changing FSID to metadata uuid
In reply to Greg Kroah-HartmanFrom: Nikolay Borisov <[email protected]>
[ Upstream commit 1362089d2ad7e20d16371b39d3c11990d4ec23e4 ]
Current code doesn't correctly handle the situation which arises when a file system that has METADATA_UUID_INCOMPAT flag set and has its FSID changed to the one in metadata uuid. This causes the incompat flag to disappear.
In case of a power failure we could end up in a situation where part of the disks in a multi-disk filesystem are correctly reverted to METADATA_UUID_INCOMPAT flag unset state, while others have METADATA_UUID_INCOMPAT set and CHANGING_FSID_V2_IN_PROGRESS.
This patch corrects the behavior required to handle the case where a disk of the second type is scanned first, creating the necessary btrfs_fs_devices. Subsequently, when a disk which has already completed the transition is scanned it should overwrite the data in btrfs_fs_devices.
--- fs/btrfs/volumes.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-)
fs/btrfs/volumes.c +38 -4
@@ -723,6 +723,32 @@ static struct btrfs_fs_devices *find_fsid_changed(return NULL ; } + +static struct btrfs_fs_devices *find_fsid_reverted_metadata ( +struct btrfs_super_block *disk_super) +{ +struct btrfs_fs_devices *fs_devices; + +/* +* Handle the case where the scanned device is part of an fs whose last +* metadata UUID change reverted it to the original FSID. At the same +* time * fs_devices was first created by another constitutent device +* which didn't fully observe the operation. This results in an +* btrfs_fs_devices created with metadata/fsid different AND +* btrfs_fs_devices::fsid_change set AND the metadata_uuid of the +* fs_devices equal to the FSID of the disk. +*/ +list_for_each_entry (fs_devices, &fs_uuids, fs_list) { +if (memcmp (fs_devices->fsid, fs_devices->metadata_uuid, +BTRFS_FSID_SIZE ) !=0 && +memcmp (fs_devices->metadata_uuid, disk_super->fsid, +BTRFS_FSID_SIZE ) ==0 && + fs_devices->fsid_change) +return fs_devices; + } + +return NULL ; +}/* * Add new device to list of registered devices *
@@ -762,7 +788,9 @@ static noinline struct btrfs_device *device_list_add(const char *path, fs_devices =find_fsid (disk_super->fsid, disk_super->metadata_uuid); }else { - fs_devices =find_fsid (disk_super->fsid,NULL ); + fs_devices =find_fsid_reverted_metadata (disk_super); +if (!fs_devices) + fs_devices =find_fsid (disk_super->fsid,NULL ); }
@@ -792,12 +820,18 @@ static noinline struct btrfs_device *device_list_add(const char *path,* a device which had the CHANGING_FSID_V2 flag then replace the * metadata_uuid/fsid values of the fs_devices. */ -if (has_metadata_uuid && fs_devices->fsid_change && +if (fs_devices->fsid_change && found_transid > fs_devices->latest_generation) {memcpy (fs_devices->fsid, disk_super->fsid,BTRFS_FSID_SIZE ); -memcpy (fs_devices->metadata_uuid, - disk_super->metadata_uuid,BTRFS_FSID_SIZE ); + +if (has_metadata_uuid) +memcpy (fs_devices->metadata_uuid, + disk_super->metadata_uuid, +BTRFS_FSID_SIZE ); +else +memcpy (fs_devices->metadata_uuid, + disk_super->fsid,BTRFS_FSID_SIZE ); fs_devices->fsid_change = false; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 332/399 bcache: cached_dev_free needs to put the sb page
In reply to Greg Kroah-HartmanFrom: Liang Chen <[email protected]>
[ Upstream commit e8547d42095e58bee658f00fef8e33d2a185c927 ]
Same as cache device, the buffer page needs to be put while freeing cached_dev. Otherwise a page would be leaked every time a cached_dev is stopped.
--- drivers/md/bcache/super.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/bcache/super.c +3 -0
@@ -1275,6 +1275,9 @@ static void cached_dev_free(struct closure *cl)mutex_unlock (&bch_register_lock); +if (dc->sb_bio.bi_inline_vecs[0 ].bv_page) +put_page (bio_first_page_all (&dc->sb_bio)); +if (!IS_ERR_OR_NULL (dc->bdev))blkdev_put (dc->bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 333/399 bcache: rework error unwinding in register_bcache
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 50246693f81fe887f4db78bf7089051d7f1894cc ]
Split the successful and error return path, and use one goto label for each resource to unwind. This also fixes some small errors like leaking the module reference count in the reboot case (which seems entirely harmless) or printing the wrong warning messages for early failures.
--- drivers/md/bcache/super.c | 75 +++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 30 deletions(-)
drivers/md/bcache/super.c +45 -30
@@ -2375,29 +2375,33 @@ static bool bch_is_open(struct block_device *bdev)static ssize_t register_bcache (struct kobject *k,struct kobj_attribute *attr,const char *buffer,size_t size) { -ssize_t ret = -EINVAL ; -const char *err ="cannot allocate memory" ; -char *path =NULL ; -struct cache_sb *sb =NULL ; +const char *err; +char *path; +struct cache_sb *sb;struct block_device *bdev =NULL ; -struct page *sb_page =NULL ; +struct page *sb_page; +ssize_t ret; + ret = -EBUSY ;if (!try_module_get (THIS_MODULE )) -return -EBUSY ; + goto out;/* For latest state of bcache_is_reboot */ smp_mb ();if (bcache_is_reboot) -return -EBUSY ; + goto out_module_put; + ret = -ENOMEM ; + err ="cannot allocate memory" ; path =kstrndup (buffer, size,GFP_KERNEL );if (!path) - goto err; + goto out_module_put; sb =kmalloc (sizeof (struct cache_sb ),GFP_KERNEL );if (!sb) - goto err; + goto out_free_path; + ret = -EINVAL ; err ="failed to open device" ; bdev = blkdev_get_by_path(strim(path), FMODE_READ|FMODE_WRITE|FMODE_EXCL,
@@ -2414,57 +2418,68 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,if (!IS_ERR (bdev))bdput (bdev);if (attr == &ksysfs_register_quiet) - goto quiet_out; + goto done; } - goto err; + goto out_free_sb; } err ="failed to set blocksize" ;if (set_blocksize (bdev,4096 )) - goto err_close; + goto out_blkdev_put; err =read_super (sb, bdev, &sb_page);if (err) - goto err_close; + goto out_blkdev_put; err ="failed to register device" ;if (SB_IS_BDEV (sb)) {struct cached_dev *dc =kzalloc (sizeof (*dc),GFP_KERNEL );if (!dc) - goto err_close; + goto out_put_sb_page;mutex_lock (&bch_register_lock); ret =register_bdev (sb, sb_page, bdev, dc);mutex_unlock (&bch_register_lock);/* blkdev_put() will be called in cached_dev_free() */ -if (ret <0 ) - goto err; +if (ret <0 ) { + bdev =NULL ; + goto out_put_sb_page; + } }else {struct cache *ca =kzalloc (sizeof (*ca),GFP_KERNEL );if (!ca) - goto err_close; + goto out_put_sb_page;/* blkdev_put() will be called in bch_cache_release() */ -if (register_cache (sb, sb_page, bdev, ca) !=0 ) - goto err; +if (register_cache (sb, sb_page, bdev, ca) !=0 ) { + bdev =NULL ; + goto out_put_sb_page; + } } -quiet_out: - ret = size; -out: -if (sb_page) -put_page (sb_page); + +put_page (sb_page); +done:kfree (sb);kfree (path);module_put (THIS_MODULE ); -return ret; - -err_close: -blkdev_put (bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL ); -err: +return size; + +out_put_sb_page: +put_page (sb_page); +out_blkdev_put: +if (bdev) +blkdev_put (bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL ); +out_free_sb: +kfree (sb); +out_free_path: +kfree (path); +out_module_put: +module_put (THIS_MODULE ); +out:pr_info ("error %s: %s" , path, err); - goto out; +return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 315/399 spi: spi-fsl-qspi: Ensure width is respected in spi-mem operations
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit b0177aca7aea7e8917d4e463334b51facb293d02 ]
Make use of a core helper to ensure the desired width is respected when calling spi-mem operators.
Otherwise only the SPI controller will be matched with the flash chip, which might lead to wrong widths. Also consider the width specified by the user in the device tree.
--- drivers/spi/spi-fsl-qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-qspi.c +1 -1
@@ -410,7 +410,7 @@ static bool fsl_qspi_supports_op(struct spi_mem *mem, op->data.nbytes > q->devtype_data->txfifo)return false; -return true; +return spi_mem_default_supports_op (mem, op); } static void fsl_qspi_prepare_lut(struct fsl_qspi *q,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 334/399 bcache: fix use-after-free in register_bcache()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
[ Upstream commit ae3cd299919af6eb670d5af0bc9d7ba14086bd8e ]
The patch "bcache: rework error unwinding in register_bcache" introduces a use-after-free regression in register_bcache(). Here are current code,
2510 out_free_path:
2511 kfree(path);
2512 out_module_put:
2513 module_put(THIS_MODULE);
2514 out:
2515 pr_info("error %s: %s", path, err);
2516 return ret;If some error happens and the above code path is executed, at line 2511 path is released, but referenced at line 2515. Then KASAN reports a use- after-free error message.
This patch changes line 2515 in the following way to fix the problem,
2515 pr_info("error %s: %s", path?path:"", err);--- drivers/md/bcache/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +2 -1
@@ -2475,10 +2475,11 @@ out_free_sb:kfree (sb); out_free_path:kfree (path); + path =NULL ; out_module_put:module_put (THIS_MODULE ); out: -pr_info ("error %s: %s" , path, err); +pr_info ("error %s: %s" , path?path:"" , err);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 335/399 iommu/vt-d: Mark firmware tainted if RMRR fails sanity check
In reply to Greg Kroah-HartmanFrom: Barret Rhoden <[email protected]>
[ Upstream commit f5a68bb0752e0cf77c06f53f72258e7beb41381b ]
RMRR entries describe memory regions that are DMA targets for devices outside the kernel's control.
RMRR entries that fail the sanity check are pointing to regions of memory that the firmware did not tell the kernel are reserved or otherwise should not be used.
Instead of aborting DMAR processing, this commit marks the firmware as tainted. These RMRRs will still be identity mapped, otherwise, some devices, e.x. graphic devices, will not work during boot.
--- drivers/iommu/intel-iommu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/iommu/intel-iommu.c +8 -4
@@ -4320,12 +4320,16 @@ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) {struct acpi_dmar_reserved_memory *rmrr;struct dmar_rmrr_unit *rmrru; -int ret; rmrr = (struct acpi_dmar_reserved_memory *)header; - ret =arch_rmrr_sanity_check (rmrr); -if (ret) -return ret; +if (arch_rmrr_sanity_check (rmrr)) +WARN_TAINT (1 ,TAINT_FIRMWARE_WORKAROUND , +"Your BIOS is broken; bad RMRR [%#018Lx-%#018Lx]\n" +"BIOS vendor: %s; Ver: %s; Product Version: %s\n" , + rmrr->base_address, rmrr->end_address, +dmi_get_system_info (DMI_BIOS_VENDOR ), +dmi_get_system_info (DMI_BIOS_VERSION ), +dmi_get_system_info (DMI_PRODUCT_VERSION )); rmrru =kzalloc (sizeof (*rmrru),GFP_KERNEL );if (!rmrru)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 336/399 iommu/vt-d: Remove unnecessary WARN_ON_ONCE()
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 857f081426e5aa38313426c13373730f1345fe95 ]
Address field in device TLB invalidation descriptor is qualified by the S field. If S field is zero, a single page at page address specified by address [63:12] is requested to be invalidated. If S field is set, the least significant bit in the address field with value 0b (say bit N) indicates the invalidation address range. The spec doesn't require the address [N - 1, 0] to be cleared, hence remove the unnecessary WARN_ON_ONCE().
Otherwise, the caller might set "mask = MAX_AGAW_PFN_WIDTH" in order to invalidating all the cached mappings on an endpoint, and below overflow error will be triggered.
[...]
UBSAN: Undefined behaviour in drivers/iommu/dmar.c:1354:3
shift exponent 64 is too large for 64-bit type 'long long unsigned int' [...]
--- drivers/iommu/dmar.c | 1 - 1 file changed, 1 deletion(-)
drivers/iommu/dmar.c +0 -1
@@ -1354,7 +1354,6 @@ void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid,struct qi_desc desc;if (mask) { -WARN_ON_ONCE (addr & ((1ULL << (VTD_PAGE_SHIFT + mask)) -1 )); addr |= (1ULL << (VTD_PAGE_SHIFT + mask -1 )) -1 ; desc.qw1 =QI_DEV_IOTLB_ADDR (addr) |QI_DEV_IOTLB_SIZE ; }else
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 338/399 selftests: bpf: Reset global state between reuseport test runs
In reply to Greg Kroah-HartmanFrom: Lorenz Bauer <[email protected]>
[ Upstream commit 51bad0f05616c43d6d34b0a19bcc9bdab8e8fb39 ]
Currently, there is a lot of false positives if a single reuseport test fails. This is because expected_results and the result map are not cleared.
Zero both after individual test runs, which fixes the mentioned false positives.
--- .../selftests/bpf/test_select_reuseport.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/test_select_reuseport.c +14 -2
@@ -30,7 +30,7 @@#define REUSEPORT_ARRAY_SIZE 32static int result_map, tmp_index_ovr_map, linum_map, data_check_map; -static enum result expected_results[NR_RESULTS ]; +static __u32 expected_results[NR_RESULTS ];static int sk_fds[REUSEPORT_ARRAY_SIZE ];static int reuseport_array, outer_map;static int select_by_skb_data_prog;
@@ -662,7 +662,19 @@ static void setup_per_test(int type, unsigned short family, bool inany)static void cleanup_per_test (void ) { -int i, err; +int i, err, zero =0 ; + +memset (expected_results,0 ,sizeof (expected_results)); + +for (i =0 ; i <NR_RESULTS ; i++) { + err =bpf_map_update_elem (result_map, &i, &zero,BPF_ANY ); +RET_IF (err,"reset elem in result_map" , +"i:%u err:%d errno:%d\n" , i, err, errno); + } + + err =bpf_map_update_elem (linum_map, &zero, &zero,BPF_ANY ); +RET_IF (err,"reset line number in linum_map" ,"err:%d errno:%d\n" , + err, errno);for (i =0 ; i <REUSEPORT_ARRAY_SIZE ; i++)close (sk_fds[i]);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 339/399 jbd2: switch to use jbd2_journal_abort() when failed to submit the commit record
In reply to Greg Kroah-HartmanFrom: zhangyi (F) <[email protected]>
[ Upstream commit d0a186e0d3e7ac05cc77da7c157dae5aa59f95d9 ]
We invoke jbd2_journal_abort() to abort the journal and record errno in the jbd2 superblock when committing journal transaction besides the failure on submitting the commit record. But there is no need for the case and we can also invoke jbd2_journal_abort() instead of __jbd2_journal_abort_hard().
--- fs/jbd2/commit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/jbd2/commit.c +2 -2
@@ -782,7 +782,7 @@ start_journal_io: err =journal_submit_commit_record (journal, commit_transaction, &cbh, crc32_sum);if (err) -__jbd2_journal_abort_hard (journal); +jbd2_journal_abort (journal, err); }blk_finish_plug (&plug);
@@ -875,7 +875,7 @@ start_journal_io: err =journal_submit_commit_record (journal, commit_transaction, &cbh, crc32_sum);if (err) -__jbd2_journal_abort_hard (journal); +jbd2_journal_abort (journal, err); }if (cbh) err =journal_wait_on_commit_record (journal, cbh);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 341/399 powerpc/pseries/lparcfg: Fix display of Maximum Memory
In reply to Greg Kroah-HartmanFrom: Michael Bringmann <[email protected]>
[ Upstream commit f1dbc1c5c70d0d4c60b5d467ba941fba167c12f6 ]
Correct overflow problem in calculation and display of Maximum Memory value to syscfg.
--- arch/powerpc/platforms/pseries/lparcfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/lparcfg.c +2 -2
@@ -435,10 +435,10 @@ static void maxmem_data(struct seq_file *m) {unsigned long maxmem =0 ; - maxmem += drmem_info->n_lmbs * drmem_info->lmb_size; + maxmem += (unsigned long )drmem_info->n_lmbs * drmem_info->lmb_size; maxmem +=hugetlb_total_pages () *PAGE_SIZE ; -seq_printf (m,"MaxMem=%ld\n" , maxmem); +seq_printf (m,"MaxMem=%lu\n" , maxmem); }static int pseries_lparcfg_data (struct seq_file *m,void *v)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 342/399 selftests/eeh: Bump EEH wait time to 60s
In reply to Greg Kroah-HartmanFrom: Oliver O'Halloran <[email protected]>
[ Upstream commit 414f50434aa2463202a5b35e844f4125dd1a7101 ]
Some newer cards supported by aacraid can take up to 40s to recover after an EEH event. This causes spurious failures in the basic EEH self-test since the current maximim timeout is only 30s.
Fix the immediate issue by bumping the timeout to a default of 60s, and allow the wait time to be specified via an environmental variable (EEH_MAX_WAIT).
--- tools/testing/selftests/powerpc/eeh/eeh-functions.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/testing/selftests/powerpc/eeh/eeh-functions.sh +7 -3
@@ -53,9 +53,13 @@ eeh_one_dev() { # is a no-op. echo $dev >/sys/kernel/debug/powerpc/eeh_dev_check - # Enforce a 30s timeout for recovery. Even the IPR, which is infamously - # slow to reset, should recover within 30s. - max_wait=30 + # Default to a 60s timeout when waiting for a device to recover. This + # is an arbitrary default which can be overridden by setting the + # EEH_MAX_WAIT environmental variable when required. + + # The current record holder for longest recovery time is: + # "Adaptec Series 8 12G SAS/PCIe 3" at 39 seconds + max_wait=${EEH_MAX_WAIT:=60} for i in `seq 0 ${max_wait}` ; do if pe_ok $dev ; then
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 343/399 ARM: 8941/1: decompressor: enable CP15 barrier instructions in v7 cache setup code
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 8239fc7755fd3d410920006615abd0c7d653560f ]
Commit e17b1af96b2afc38e684aa2f1033387e2ed10029
"ARM: 8857/1: efi: enable CP15 DMB instructions before cleaning the cache"
added some explicit handling of the CP15BEN bit in the SCTLR system register, to ensure that CP15 barrier instructions are enabled, even if we enter the decompressor via the EFI stub.
However, as it turns out, there are other ways in which we may end up using CP15 barrier instructions without them being enabled. I.e., when the decompressor startup code skips the cache_on() initially, we end up calling cache_clean_flush() with the caches and MMU off, in which case the CP15BEN bit in SCTLR may not be programmed either. And in fact, cache_on() itself issues CP15 barrier instructions before actually enabling them by programming the new SCTLR value (and issuing an ISB)
Since these routines are shared between v7 CPUs and older ones that implement the CPUID extension as well, using the ordinary v7 barrier instructions in this code is not possible, and so we should enable the CP15 ones explicitly before issuing them. Note that a v7 ISB is still required between programming the SCTLR register and using the CP15 barrier instructions, and we should take care to branch over it if the CP15BEN bit is already set, given that in that case, the CPU may not support it.
--- arch/arm/boot/compressed/head.S | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/boot/compressed/head.S +13 -0
@@ -140,6 +140,17 @@ #endif .endm + .macro enable_cp15_barriers, reg + mrc p15, 0, \reg, c1, c0, 0 @ read SCTLR + tst \reg, #(1 << 5) @ CP15BEN bit set? + bne .L_\@ + orr \reg, \reg, #(1 << 5) @ CP15 barrier instructions + mcr p15, 0, \reg, c1, c0, 0 @ write SCTLR + ARM( .inst 0xf57ff06f @ v7+ isb ) + THUMB( isb ) +.L_\@: + .endm + .section ".start", "ax" /* * sort out different calling conventions
@@ -820,6 +831,7 @@ __armv4_mmu_cache_on: mov pc, r12 __armv7_mmu_cache_on: + enable_cp15_barriers r11 mov r12, lr #ifdef CONFIG_MMU mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0
@@ -1209,6 +1221,7 @@ __armv6_mmu_cache_flush: mov pc, lr __armv7_mmu_cache_flush: + enable_cp15_barriers r10 tst r4, #1 bne iflush mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 316/399 kbuild: use -S instead of -E for precise cc-option test in Kconfig
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 3bed1b7b9d79ca40e41e3af130931a3225e951a3 ]
Currently, -E (stop after the preprocessing stage) is used to check whether the given compiler flag is supported.
While it is faster than -S (or -c), it can be false-positive. You need to run the compilation proper to check the flag more precisely.
For example, -E and -S disagree about the support of "--param asan-instrument-allocas=1".
$ gcc -Werror --param asan-instrument-allocas=1 -E -x c /dev/null -o /dev/null $ echo $? 0
$ gcc -Werror --param asan-instrument-allocas=1 -S -x c /dev/null -o /dev/null cc1: error: invalid --param name ‘asan-instrument-allocas’; did you mean ‘asan-instrument-writes’? $ echo $? 1
--- scripts/Kconfig.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Kconfig.include +1 -1
@@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y) # $(cc-option,<flag>) # Return y if the compiler supports <flag>, n otherwise -cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null) +cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null) # $(ld-option,<flag>) # Return y if the linker supports <flag>, n otherwise
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 345/399 ALSA: usb-audio: add quirks for Line6 Helix devices fw>=2.82
In reply to Greg Kroah-HartmanFrom: Nicola Lunghi <[email protected]>
[ Upstream commit b81cbf7abfc94878a3c6f0789f2185ee55b1cc21 ]
With firmware 2.82 Line6 changed the usb id of some of the Helix devices but the quirks is still needed.
Add it to the quirk list for line6 helix family of devices.
Thanks to Jens for pointing out the missing ids.
--- sound/usb/format.c | 3 +++ 1 file changed, 3 insertions(+)
sound/usb/format.c +3 -0
@@ -296,6 +296,9 @@ static int line6_parse_audio_format_rates_quirk(struct snd_usb_audio *chip,case USB_ID (0x0E41 ,0x4242 ):/* Line6 Helix Rack */ case USB_ID (0x0E41 ,0x4244 ):/* Line6 Helix LT */ case USB_ID (0x0E41 ,0x4246 ):/* Line6 HX-Stomp */ +case USB_ID (0x0E41 ,0x4248 ):/* Line6 Helix >= fw 2.82 */ +case USB_ID (0x0E41 ,0x4249 ):/* Line6 Helix Rack >= fw 2.82 */ +case USB_ID (0x0E41 ,0x424a ):/* Line6 Helix LT >= fw 2.82 */ /* supported rates: 48Khz */ kfree (fp->rate_table); fp->rate_table =kmalloc (sizeof (int ),GFP_KERNEL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 344/399 ARM: 8951/1: Fix Kexec compilation issue.
In reply to Greg Kroah-HartmanFrom: Vincenzo Frascino <[email protected]>
[ Upstream commit 76950f7162cad51d2200ebd22c620c14af38f718 ]
To perform the reserve_crashkernel() operation kexec uses SECTION_SIZE to find a memblock in a range.SECTION_SIZE is not defined for nommu systems. Trying to compile kexec in these conditions results in a build error:
linux/arch/arm/kernel/setup.c: In function ‘reserve_crashkernel’:
linux/arch/arm/kernel/setup.c:1016:25: error: ‘SECTION_SIZE’ undeclared
(first use in this function); did you mean ‘SECTIONS_WIDTH’?
crash_size, SECTION_SIZE);
^~~~~~~~~~~~
SECTIONS_WIDTH linux/arch/arm/kernel/setup.c:1016:25: note: each undeclared identifier
is reported only once for each function it appears in
linux/scripts/Makefile.build:265: recipe for target 'arch/arm/kernel/setup.o'
failed
Make KEXEC depend on MMU to fix the compilation issue.
--- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
@@ -1905,7 +1905,7 @@ config XIP_DEFLATED_DATA config KEXEC bool "Kexec system call (EXPERIMENTAL)" depends on (!SMP || PM_SLEEP_SMP) - depends on !CPU_V7M + depends on MMU select KEXEC_CORE help kexec is a system call that implements the ability to shutdown your
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 348/399 iwlegacy: ensure loop counter addr does not wrap and cause an infinite loop
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit c2f9a4e4a5abfc84c01b738496b3fd2d471e0b18 ]
The loop counter addr is a u16 where as the upper limit of the loop is an int. In the unlikely event that the il->cfg->eeprom_size is greater than 64K then we end up with an infinite loop since addr will wrap around an never reach upper loop limit. Fix this by making addr an int.
Addresses-Coverity: ("Infinite loop")
--- drivers/net/wireless/intel/iwlegacy/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlegacy/common.c +1 -1
@@ -699,7 +699,7 @@ il_eeprom_init(struct il_priv *il)u32 gp =_il_rd (il,CSR_EEPROM_GP );int sz;int ret; -u16 addr; +int addr;/* allocate eeprom */ sz = il->cfg->eeprom_size;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 347/399 rtw88: fix potential NULL skb access in TX ISR
In reply to Greg Kroah-HartmanFrom: Yan-Hsuan Chuang <[email protected]>
[ Upstream commit f4f84ff8377d4cedf18317747bc407b2cf657d0f ]
Sometimes the TX queue may be empty and we could possible dequeue a NULL pointer, crash the kernel. If the skb is NULL then there is nothing to do, just leave the ISR.
And the TX queue should not be empty here, so print an error to see if there is anything wrong for DMA ring.
--- drivers/net/wireless/realtek/rtw88/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/realtek/rtw88/pci.c +5 -0
@@ -832,6 +832,11 @@ static void rtw_pci_tx_isr(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci,while (count--) { skb =skb_dequeue (&ring->queue); +if (!skb) { +rtw_err (rtwdev,"failed to dequeue %d skb TX queue %d, BD=0x%08x, rp %d -> %d\n" , + count, hw_queue, bd_idx, ring->r.rp, cur_rp); +break ; + } tx_data =rtw_pci_get_tx_data (skb);pci_unmap_single (rtwpci->pdev, tx_data->dma, skb->len,PCI_DMA_TODEVICE );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 349/399 cifs: fix unitialized variable poential problem with network I/O cache lock patch
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
[ Upstream commit 463a7b457c02250a84faa1d23c52da9e3364aed2 ]
static analysis with Coverity detected an issue with the following commit:
Author: Paulo Alcantara (SUSE) <[email protected]>
Date: Wed Dec 4 17:38:03 2019 -0300
cifs: Avoid doing network I/O while holding cache lock
Addresses-Coverity: ("Uninitialized pointer read")
--- fs/cifs/dfs_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dfs_cache.c +1 -1
@@ -1319,7 +1319,7 @@ static struct cifs_ses *find_root_ses(struct dfs_cache_vol_info *vi,char *mdata =NULL , *devname =NULL ;struct TCP_Server_Info *server;struct cifs_ses *ses; -struct smb_vol vol; +struct smb_vol vol = {NULL }; rpath =get_dfs_root (path);if (IS_ERR (rpath))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 350/399 cifs: Fix mount options set in automount
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara (SUSE) <[email protected]>
[ Upstream commit 5739375ee4230980166807d347cc21c305532bbc ]
Starting from 4a367dc04435, we must set the mount options based on the DFS full path rather than the resolved target, that is, cifs_mount() will be responsible for resolving the DFS link (cached) as well as performing failover to any other targets in the referral.
--- fs/cifs/cifs_dfs_ref.c | 97 +++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 54 deletions(-)
fs/cifs/cifs_dfs_ref.c +43 -54
@@ -120,17 +120,17 @@ cifs_build_devname(char *nodename, const char *prepath)/** -* cifs_compose_mount_options - creates mount options for refferral +* cifs_compose_mount_options - creates mount options for referral * @sb_mountdata: parent/root DFS mount options (template) * @fullpath: full path in UNC format -* @ref: server's referral +* @ref: optional server's referral * @devname: optional pointer for saving device name * * creates mount options for submount based on template options sb_mountdata * and replacing unc,ip,prefixpath options with ones we've got form ref_unc. * * Returns: pointer to new mount options or ERR_PTR. -* Caller is responcible for freeing retunrned value if it is not error. +* Caller is responsible for freeing returned value if it is not error. */ char *cifs_compose_mount_options(const char *sb_mountdata, const char *fullpath,
@@ -150,18 +150,27 @@ char *cifs_compose_mount_options(const char *sb_mountdata,if (sb_mountdata ==NULL )return ERR_PTR (-EINVAL ); -if (strlen (fullpath) - ref->path_consumed) { - prepath = fullpath + ref->path_consumed; -/* skip initial delimiter */ -if (*prepath =='/' || *prepath =='\\' ) - prepath++; - } +if (ref) { +if (strlen (fullpath) - ref->path_consumed) { + prepath = fullpath + ref->path_consumed; +/* skip initial delimiter */ +if (*prepath =='/' || *prepath =='\\' ) + prepath++; + } - name =cifs_build_devname (ref->node_name, prepath); -if (IS_ERR (name)) { - rc =PTR_ERR (name); - name =NULL ; - goto compose_mount_options_err; + name =cifs_build_devname (ref->node_name, prepath); +if (IS_ERR (name)) { + rc =PTR_ERR (name); + name =NULL ; + goto compose_mount_options_err; + } + }else { + name =cifs_build_devname ((char *)fullpath,NULL ); +if (IS_ERR (name)) { + rc =PTR_ERR (name); + name =NULL ; + goto compose_mount_options_err; + } } rc =dns_resolve_server_name_to_ip (name, &srvIP);
@@ -225,6 +234,8 @@ char *cifs_compose_mount_options(const char *sb_mountdata,if (devname) *devname = name; +else +kfree (name);/*cifs_dbg(FYI, "%s: parent mountdata: %s\n", __func__, sb_mountdata);*/ /*cifs_dbg(FYI, "%s: submount mountdata: %s\n", __func__, mountdata );*/
@@ -241,23 +252,23 @@ compose_mount_options_err: }/** -* cifs_dfs_do_refmount - mounts specified path using provided refferal +* cifs_dfs_do_mount - mounts specified path using DFS full path +* +* Always pass down @fullpath to smb3_do_mount() so we can use the root server +* to perform failover in case we failed to connect to the first target in the +* referral. +* * @cifs_sb: parent/root superblock * @fullpath: full path in UNC format -* @ref: server's referral */ -static struct vfsmount *cifs_dfs_do_refmount (struct dentry *mntpt, -struct cifs_sb_info *cifs_sb, -const char *fullpath,const struct dfs_info3_param *ref) +static struct vfsmount *cifs_dfs_do_mount (struct dentry *mntpt, +struct cifs_sb_info *cifs_sb, +const char *fullpath) {struct vfsmount *mnt;char *mountdata;char *devname; -/* -* Always pass down the DFS full path to smb3_do_mount() so we -* can use it later for failover. -*/ devname =kstrndup (fullpath,strlen (fullpath),GFP_KERNEL );if (!devname)return ERR_PTR (-ENOMEM );
@@ -266,7 +277,7 @@ static struct vfsmount *cifs_dfs_do_refmount(struct dentry *mntpt,/* strip first '\' from fullpath */ mountdata =cifs_compose_mount_options (cifs_sb->mountdata, - fullpath +1 , ref,NULL ); + fullpath +1 ,NULL ,NULL );if (IS_ERR (mountdata)) {kfree (devname);return (struct vfsmount *)mountdata;
@@ -278,28 +289,16 @@ static struct vfsmount *cifs_dfs_do_refmount(struct dentry *mntpt,return mnt; } -static void dump_referral (const struct dfs_info3_param *ref) -{ -cifs_dbg (FYI ,"DFS: ref path: %s\n" , ref->path_name); -cifs_dbg (FYI ,"DFS: node path: %s\n" , ref->node_name); -cifs_dbg (FYI ,"DFS: fl: %d, srv_type: %d\n" , - ref->flags, ref->server_type); -cifs_dbg (FYI ,"DFS: ref_flags: %d, path_consumed: %d\n" , - ref->ref_flag, ref->path_consumed); -} -/* * Create a vfsmount that we can automount */ static struct vfsmount *cifs_dfs_do_automount (struct dentry *mntpt) { -struct dfs_info3_param referral = {0 };struct cifs_sb_info *cifs_sb;struct cifs_ses *ses;struct cifs_tcon *tcon;char *full_path, *root_path;unsigned int xid; -int len;int rc;struct vfsmount *mnt;
@@ -357,7 +356,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)if (!rc) { rc =dfs_cache_find (xid, ses, cifs_sb->local_nls,cifs_remap (cifs_sb), full_path +1 , - &referral,NULL ); +NULL ,NULL ); }free_xid (xid);
@@ -366,26 +365,16 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) mnt =ERR_PTR (rc); goto free_root_path; } - -dump_referral (&referral); - - len =strlen (referral.node_name); -if (len <2 ) { -cifs_dbg (VFS ,"%s: Net Address path too short: %s\n" , - __func__, referral.node_name); - mnt =ERR_PTR (-EINVAL ); - goto free_dfs_ref; - }/* -* cifs_mount() will retry every available node server in case -* of failures. +* OK - we were able to get and cache a referral for @full_path. +* +* Now, pass it down to cifs_mount() and it will retry every available +* node server in case of failures - no need to do it here. */ - mnt =cifs_dfs_do_refmount (mntpt, cifs_sb, full_path, &referral); -cifs_dbg (FYI ,"%s: cifs_dfs_do_refmount:%s , mnt:%p\n" , __func__, - referral.node_name, mnt); + mnt =cifs_dfs_do_mount (mntpt, cifs_sb, full_path); +cifs_dbg (FYI ,"%s: cifs_dfs_do_mount:%s , mnt:%p\n" , __func__, + full_path +1 , mnt); -free_dfs_ref: -free_dfs_info_param (&referral); free_root_path:kfree (root_path); free_full_path:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 351/399 cifs: fix NULL dereference in match_prepath
In reply to Greg Kroah-HartmanFrom: Ronnie Sahlberg <[email protected]>
[ Upstream commit fe1292686333d1dadaf84091f585ee903b9ddb84 ]
RHBZ: 1760879
Fix an oops in match_prepath() by making sure that the prepath string is not NULL before we pass it into strcmp().
This is similar to other checks we make for example in cifs_root_iget()
--- fs/cifs/connect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/cifs/connect.c +4 -2
@@ -3709,8 +3709,10 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data) {struct cifs_sb_info *old =CIFS_SB (sb);struct cifs_sb_info *new = mnt_data->cifs_sb; -bool old_set = old->mnt_cifs_flags &CIFS_MOUNT_USE_PREFIX_PATH ; -bool new_set = new->mnt_cifs_flags &CIFS_MOUNT_USE_PREFIX_PATH ; +bool old_set = (old->mnt_cifs_flags &CIFS_MOUNT_USE_PREFIX_PATH ) && + old->prepath; +bool new_set = (new->mnt_cifs_flags &CIFS_MOUNT_USE_PREFIX_PATH ) && + new->prepath;if (old_set && new_set && !strcmp (new->prepath, old->prepath))return 1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 352/399 video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
In reply to Greg Kroah-HartmanFrom: Wei Hu <[email protected]>
[ Upstream commit 3a6fb6c4255c3893ab61e2bd4e9ae01ca6bbcd94 ]
On Hyper-V, Generation 1 VMs can directly use VM's physical memory for their framebuffers. This can improve the efficiency of framebuffer and overall performence for VM. The physical memory assigned to framebuffer must be contiguous. We use CMA allocator to get contiguouse physicial memory when the framebuffer size is greater than 4MB. For size under 4MB, we use alloc_pages to achieve this.
To enable framebuffer memory allocation from CMA, supply a kernel parameter to give enough space to CMA allocator at boot time. For example:
cma=130m
This gives 130MB memory to CAM allocator that can be allocated to framebuffer. If this fails, we fall back to the old way of using mmio for framebuffer.
--- drivers/video/fbdev/Kconfig | 1 + drivers/video/fbdev/hyperv_fb.c | 182 +++++++++++++++++++++++++------- 2 files changed, 144 insertions(+), 39 deletions(-)
drivers/video/fbdev/Kconfig +1 -0
@@ -2215,6 +2215,7 @@ config FB_HYPERV select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select FB_DEFERRED_IO + select DMA_CMA if HAVE_DMA_CONTIGUOUS && CMA help This framebuffer driver supports Microsoft Hyper-V Synthetic Video.
drivers/video/fbdev/hyperv_fb.c +143 -39
293 lines not on this page · raw message
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 317/399 objtool: Fix ARCH=x86_64 build error
In reply to Greg Kroah-HartmanFrom: Shile Zhang <[email protected]>
[ Upstream commit 8580bed7e751e6d4f17881e059daf3cb37ba4717 ]
Building objtool with ARCH=x86_64 fails with:
$make ARCH=x86_64 -C tools/objtool
...
CC arch/x86/decode.o
arch/x86/decode.c:10:22: fatal error: asm/insn.h: No such file or directory
#include <asm/insn.h>
^ compilation terminated.
mv: cannot stat ‘arch/x86/.decode.o.tmp’: No such file or directory make[2]: *** [arch/x86/decode.o] Error 1
...
The root cause is that the command-line variable 'ARCH' cannot be overridden. It can be replaced by 'SRCARCH', which is defined in 'tools/scripts/Makefile.arch'.
--- tools/objtool/Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
tools/objtool/Makefile +1 -5
@@ -2,10 +2,6 @@ include ../scripts/Makefile.include include ../scripts/Makefile.arch -ifeq ($(ARCH),x86_64) -ARCH := x86 -endif - # always use the host compiler HOSTAR ?= ar HOSTCC ?= gcc
@@ -33,7 +29,7 @@ all: $(OBJTOOL) INCLUDES := -I$(srctree)/tools/include \ -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ - -I$(srctree)/tools/arch/$(ARCH)/include + -I$(srctree)/tools/arch/$(SRCARCH)/include WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 318/399 x86/decoder: Add TEST opcode to Group3-2
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 8b7e20a7ba54836076ff35a28349dabea4cec48f ]
Add TEST opcode to Group3-2 reg=001b as same as Group3-1 does.
Commit
12a78d43de76 ("x86/decoder: Add new TEST instruction pattern")
added a TEST opcode assignment to f6 XX/001/XXX (Group 3-1), but did not add f7 XX/001/XXX (Group 3-2).
Actually, this TEST opcode variant (ModRM.reg /1) is not described in the Intel SDM Vol2 but in AMD64 Architecture Programmer's Manual Vol.3, Appendix A.2 Table A-6. ModRM.reg Extensions for the Primary Opcode Map.
Without this fix, Randy found a warning by insn_decoder_test related to this issue as below.
HOSTCC arch/x86/tools/insn_decoder_test
HOSTCC arch/x86/tools/insn_sanity
TEST posttest arch/x86/tools/insn_decoder_test: warning: Found an x86 instruction decoder bug, please report this.
arch/x86/tools/insn_decoder_test: warning: ffffffff81000bf1: f7 0b 00 01 08 00 testl $0x80100,(%rbx)
arch/x86/tools/insn_decoder_test: warning: objdump says 6 bytes, but insn_get_length() says 2 arch/x86/tools/insn_decoder_test: warning: Decoded and checked 11913894 instructions with 1 failures
TEST posttest
arch/x86/tools/insn_sanity: Success: decoded and checked 1000000 random instructions with 0 errors (seed:0x871ce29c)
To fix this error, add the TEST opcode according to AMD64 APM Vol.3.
[ bp: Massage commit message. ]
--- arch/x86/lib/x86-opcode-map.txt | 2 +- tools/arch/x86/lib/x86-opcode-map.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -929,7 +929,7 @@ EndTable GrpTable: Grp3_2 0: TEST Ev,Iz -1: +1: TEST Ev,Iz 2: NOT Ev 3: NEG Ev 4: MUL rAX,Ev
tools/arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -929,7 +929,7 @@ EndTable GrpTable: Grp3_2 0: TEST Ev,Iz -1: +1: TEST Ev,Iz 2: NOT Ev 3: NEG Ev 4: MUL rAX,Ev
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 320/399 s390/ftrace: generate traced function stack frame
In reply to Greg Kroah-HartmanFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 45f7a0da600d3c409b5ad8d5ddddacd98ddc8840 ]
Currently backtrace from ftraced function does not contain ftraced function itself. e.g. for "path_openat":
arch_stack_walk+0x15c/0x2d8 stack_trace_save+0x50/0x68 stack_trace_call+0x15e/0x3d8 ftrace_graph_caller+0x0/0x1c <-- ftrace code do_filp_open+0x7c/0xe8 <-- ftraced function caller do_open_execat+0x76/0x1b8 open_exec+0x52/0x78 load_elf_binary+0x180/0x1160 search_binary_handler+0x8e/0x288 load_script+0x2a8/0x2b8 search_binary_handler+0x8e/0x288 __do_execve_file.isra.39+0x6fa/0xb40 __s390x_sys_execve+0x56/0x68 system_call+0xdc/0x2d8
Ftraced function is expected in the backtrace by ftrace kselftests, which are now failing. It would also be nice to have it for clarity reasons.
"ftrace_caller" itself is called without stack frame allocated for it and does not store its caller (ftraced function). Instead it simply allocates a stack frame for "ftrace_trace_function" and sets backchain to point to ftraced function stack frame (which contains ftraced function caller in saved r14).
To fix this issue make "ftrace_caller" allocate a stack frame for itself just to store ftraced function for the stack unwinder. As a result backtrace looks like the following:
arch_stack_walk+0x15c/0x2d8 stack_trace_save+0x50/0x68 stack_trace_call+0x15e/0x3d8 ftrace_graph_caller+0x0/0x1c <-- ftrace code path_openat+0x6/0xd60 <-- ftraced function do_filp_open+0x7c/0xe8 <-- ftraced function caller do_open_execat+0x76/0x1b8 open_exec+0x52/0x78 load_elf_binary+0x180/0x1160 search_binary_handler+0x8e/0x288 load_script+0x2a8/0x2b8 search_binary_handler+0x8e/0x288 __do_execve_file.isra.39+0x6fa/0xb40 __s390x_sys_execve+0x56/0x68 system_call+0xdc/0x2d8
--- arch/s390/kernel/mcount.S | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/s390/kernel/mcount.S +14 -1
@@ -26,6 +26,12 @@ ENDPROC(ftrace_stub) #define STACK_PTREGS (STACK_FRAME_OVERHEAD) #define STACK_PTREGS_GPRS (STACK_PTREGS + __PT_GPRS) #define STACK_PTREGS_PSW (STACK_PTREGS + __PT_PSW) +#ifdef __PACK_STACK +/* allocate just enough for r14, r15 and backchain */ +#define TRACED_FUNC_FRAME_SIZE 24 +#else +#define TRACED_FUNC_FRAME_SIZE STACK_FRAME_OVERHEAD +#endif ENTRY(_mcount) BR_EX %r14
@@ -40,9 +46,16 @@ ENTRY(ftrace_caller) #if !(defined(CC_USING_HOTPATCH) || defined(CC_USING_NOP_MCOUNT)) aghi %r0,MCOUNT_RETURN_FIXUP #endif - aghi %r15,-STACK_FRAME_SIZE + # allocate stack frame for ftrace_caller to contain traced function + aghi %r15,-TRACED_FUNC_FRAME_SIZE stg %r1,__SF_BACKCHAIN(%r15) + stg %r0,(__SF_GPRS+8*8)(%r15) + stg %r15,(__SF_GPRS+9*8)(%r15) + # allocate pt_regs and stack frame for ftrace_trace_function + aghi %r15,-STACK_FRAME_SIZE stg %r1,(STACK_PTREGS_GPRS+15*8)(%r15) + aghi %r1,-TRACED_FUNC_FRAME_SIZE + stg %r1,__SF_BACKCHAIN(%r15) stg %r0,(STACK_PTREGS_PSW+8)(%r15) stmg %r2,%r14,(STACK_PTREGS_GPRS+2*8)(%r15) #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 321/399 s390: fix __EMIT_BUG() macro
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 17248ea0367465f4aaef728f6af661ed38e38cf1 ]
Setting a kprobe on getname_flags() failed:
$ echo 'p:tmr1 getname_flags +0(%r2):ustring' > kprobe_events -bash: echo: write error: Invalid argument
Debugging the kprobes code showed that the address of getname_flags() is contained in the __bug_table. Kprobes doesn't allow to set probes at BUG() locations.
$ objdump -j __bug_table -x build/fs/namei.o [..] 0000000000000108 R_390_PC32 .text+0x00000000000075a8 000000000000010c R_390_PC32 .L223+0x0000000000000004
I was expecting getname_flags() to start with a BUG(), but:
7598: e3 20 10 00 00 04 lg %r2,0(%r1) 759e: c0 f4 00 00 00 00 jg 759e <putname+0x7e>
75a0: R_390_PLT32DBL kmem_cache_free+0x2
75a4: a7 f4 00 01 j 75a6 <putname+0x86>
00000000000075a8 <getname_flags>:
75a8: c0 04 00 00 00 00 brcl 0,75a8 <getname_flags> 75ae: eb 6f f0 48 00 24 stmg %r6,%r15,72(%r15) 75b4: b9 04 00 ef lgr %r14,%r15 75b8: e3 f0 ff a8 ff 71 lay %r15,-88(%r15)
So the BUG() is actually the last opcode of the previous function. Fix this by switching to using the MONITOR CALL (MC) instruction, and set the entry in __bug_table to the beginning of that MC.
--- arch/s390/boot/head.S | 2 +- arch/s390/include/asm/bug.h | 16 ++++++-------- arch/s390/kernel/entry.h | 1 + arch/s390/kernel/pgm_check.S | 2 +- arch/s390/kernel/traps.c | 41 +++++++++++++++++++++++++++++++----- 5 files changed, 46 insertions(+), 16 deletions(-)
arch/s390/boot/head.S +1 -1
@@ -329,7 +329,7 @@ ENTRY(startup_kdump) .quad .Lduct # cr5: primary-aste origin .quad 0 # cr6: I/O interrupts .quad 0 # cr7: secondary space segment table - .quad 0 # cr8: access registers translation + .quad 0x0000000000008000 # cr8: access registers translation .quad 0 # cr9: tracing off .quad 0 # cr10: tracing off .quad 0 # cr11: tracing off
arch/s390/include/asm/bug.h +7 -9
@@ -10,15 +10,14 @@#define __EMIT_BUG (x) do { \ asm_inline volatile( \ - "0: j 0b+2\n" \ - "1:\n" \ + "0: mc 0,0\n" \ ".section .rodata.str,\"aMS\",@progbits,1\n" \ - "2: .asciz \""__FILE__"\"\n" \ + "1: .asciz \""__FILE__"\"\n" \ ".previous\n" \ ".section __bug_table,\"awM\",@progbits,%2\n" \ - "3: .long 1b-3b,2b-3b\n" \ + "2: .long 0b-2b,1b-2b\n" \ " .short %0,%1\n" \ - " .org 3b+%2\n" \ + " .org 2b+%2\n" \ ".previous\n" \ : : "i" (__LINE__), \ "i" (x), \
@@ -29,12 +28,11 @@#define __EMIT_BUG (x) do { \ asm_inline volatile( \ - "0: j 0b+2\n" \ - "1:\n" \ + "0: mc 0,0\n" \ ".section __bug_table,\"awM\",@progbits,%1\n" \ - "2: .long 1b-2b\n" \ + "1: .long 0b-1b\n" \ " .short %0\n" \ - " .org 2b+%1\n" \ + " .org 1b+%1\n" \ ".previous\n" \ : : "i" (x), \ "i" (sizeof(struct bug_entry))); \
arch/s390/kernel/entry.h +1 -0
@@ -45,6 +45,7 @@ void specification_exception(struct pt_regs *regs);void transaction_exception (struct pt_regs *regs);void translation_exception (struct pt_regs *regs);void vector_exception (struct pt_regs *regs); +void monitor_event_exception (struct pt_regs *regs);void do_per_trap (struct pt_regs *regs);void do_report_trap (struct pt_regs *regs,int si_signo,int si_code,char *str);
arch/s390/kernel/pgm_check.S +1 -1
@@ -81,7 +81,7 @@ PGM_CHECK_DEFAULT /* 3c */ PGM_CHECK_DEFAULT /* 3d */ PGM_CHECK_DEFAULT /* 3e */ PGM_CHECK_DEFAULT /* 3f */ -PGM_CHECK_DEFAULT /* 40 */ +PGM_CHECK(monitor_event_exception) /* 40 */ PGM_CHECK_DEFAULT /* 41 */ PGM_CHECK_DEFAULT /* 42 */ PGM_CHECK_DEFAULT /* 43 */
arch/s390/kernel/traps.c +36 -5
61 lines not on this page · raw message
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 313/399 irqchip/mbigen: Set driver .suppress_bind_attrs to avoid remove problems
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit d6152e6ec9e2171280436f7b31a571509b9287e1 ]
The following crash can be seen for setting CONFIG_DEBUG_TEST_DRIVER_REMOVE=y for DT FW (which some people still use):
Hisilicon MBIGEN-V2 60080000.interrupt-controller: Failed to create mbi-gen irqdomain Hisilicon MBIGEN-V2: probe of 60080000.interrupt-controller failed with error -12
[...]
Unable to handle kernel paging request at virtual address 0000000000005008 Mem abort info: ESR = 0x96000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 Data abort info: ISV = 0, ISS = 0x00000004 CM = 0, WnR = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=0000041fb9990000 [0000000000005008] pgd=0000000000000000 Internal error: Oops: 96000004 [#1] PREEMPT SMP Modules linked in: CPU: 7 PID: 1 Comm: swapper/0 Not tainted 5.5.0-rc6-00002-g3fc42638a506-dirty #1622 Hardware name: Huawei Taishan 2280 /D05, BIOS Hisilicon D05 IT21 Nemo 2.0 RC0 04/18/2018 pstate: 40000085 (nZcv daIf -PAN -UAO) pc : mbigen_set_type+0x38/0x60 lr : __irq_set_trigger+0x6c/0x188 sp : ffff800014b4b400 x29: ffff800014b4b400 x28: 0000000000000007 x27: 0000000000000000 x26: 0000000000000000 x25: ffff041fd83bd0d4 x24: ffff041fd83bd188 x23: 0000000000000000 x22: ffff80001193ce00 x21: 0000000000000004 x20: 0000000000000000 x19: ffff041fd83bd000 x18: ffffffffffffffff x17: 0000000000000000 x16: 0000000000000000 x15: ffff8000119098c8 x14: ffff041fb94ec91c x13: ffff041fb94ec1a1 x12: 0000000000000030 x11: 0101010101010101 x10: 0000000000000040 x9 : 0000000000000000 x8 : ffff041fb98c6680 x7 : ffff800014b4b380 x6 : ffff041fd81636c8 x5 : 0000000000000000 x4 : 000000000000025f x3 : 0000000000005000 x2 : 0000000000005008 x1 : 0000000000000004 x0 : 0000000080000000 Call trace: mbigen_set_type+0x38/0x60 __setup_irq+0x744/0x900 request_threaded_irq+0xe0/0x198 pcie_pme_probe+0x98/0x118 pcie_port_probe_service+0x38/0x78 really_probe+0xa0/0x3e0 driver_probe_device+0x58/0x100 __device_attach_driver+0x90/0xb0 bus_for_each_drv+0x64/0xc8 __device_attach+0xd8/0x138 device_initial_probe+0x10/0x18 bus_probe_device+0x90/0x98 device_add+0x4c4/0x770 device_register+0x1c/0x28 pcie_port_device_register+0x1e4/0x4f0 pcie_portdrv_probe+0x34/0xd8 local_pci_probe+0x3c/0xa0 pci_device_probe+0x128/0x1c0 really_probe+0xa0/0x3e0 driver_probe_device+0x58/0x100 __device_attach_driver+0x90/0xb0 bus_for_each_drv+0x64/0xc8 __device_attach+0xd8/0x138 device_attach+0x10/0x18 pci_bus_add_device+0x4c/0xb8 pci_bus_add_devices+0x38/0x88 pci_host_probe+0x3c/0xc0 pci_host_common_probe+0xf0/0x208 hisi_pcie_almost_ecam_probe+0x24/0x30 platform_drv_probe+0x50/0xa0 really_probe+0xa0/0x3e0 driver_probe_device+0x58/0x100 device_driver_attach+0x6c/0x90 __driver_attach+0x84/0xc8 bus_for_each_dev+0x74/0xc8 driver_attach+0x20/0x28 bus_add_driver+0x148/0x1f0 driver_register+0x60/0x110 __platform_driver_register+0x40/0x48 hisi_pcie_almost_ecam_driver_init+0x1c/0x24
The specific problem here is that the mbigen driver real probe has failed as the mbigen_of_create_domain()->of_platform_device_create() call fails, the reason for that being that we never destroyed the platform device created during the remove test dry run and there is some conflict.
Since we generally would never want to unbind this driver, and to save adding a driver tear down path for that, just set the driver .suppress_bind_attrs member to avoid this possibility.
--- drivers/irqchip/irq-mbigen.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-mbigen.c +1 -0
@@ -374,6 +374,7 @@ static struct platform_driver mbigen_platform_driver = { .name = "Hisilicon MBIGEN-V2", .of_match_table = mbigen_of_match, .acpi_match_table = ACPI_PTR(mbigen_acpi_match), + .suppress_bind_attrs = true, }, .probe = mbigen_device_probe, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 354/399 powerpc/mm: Dont log user reads to 0xffffffff
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 0f9aee0cb9da7db7d96f63cfa2dc5e4f1bffeb87 ]
Running vdsotest leaves many times the following log:
[ 79.629901] vdsotest[396]: User access of kernel address (ffffffff) - exploit attempt? (uid: 0)
A pointer set to (-1) is likely a programming error similar to a NULL pointer and is not worth logging as an exploit attempt.
Don't log user accesses to 0xffffffff.
--- arch/powerpc/mm/fault.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/mm/fault.c +3 -0
@@ -354,6 +354,9 @@ static void sanity_check_fault(bool is_write, bool is_user,* Userspace trying to access kernel address, we get PROTFAULT for that. */ if (is_user && address >=TASK_SIZE ) { +if ((long )address ==-1 ) +return ; +pr_crit_ratelimited ("%s[%d]: User access of kernel address (%lx) - exploit attempt? (uid: %d)\n" , current->comm, current->pid, address,from_kuid (&init_user_ns,current_uid ()));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 363/399 ftrace: fpid_next() should increase position index
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
[ Upstream commit e4075e8bdffd93a9b6d6e1d52fabedceeca5a91b ]
if seq_file .next fuction does not change position index, read after some lseek can generate unexpected output.
Without patch:
# dd bs=4 skip=1 if=/sys/kernel/tracing/set_ftrace_pid dd: /sys/kernel/tracing/set_ftrace_pid: cannot skip to specified offset id no pid 2+1 records in 2+1 records out 10 bytes copied, 0.000213285 s, 46.9 kB/s
Notice the "id" followed by "no pid".
With the patch:
# dd bs=4 skip=1 if=/sys/kernel/tracing/set_ftrace_pid dd: /sys/kernel/tracing/set_ftrace_pid: cannot skip to specified offset id 0+1 records in 0+1 records out 3 bytes copied, 0.000202112 s, 14.8 kB/s
Notice that it only prints "id" and not the "no pid" afterward.
https://bugzilla.kernel.org/show_bug.cgi?id=206283
--- kernel/trace/ftrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/trace/ftrace.c +3 -2
@@ -7038,9 +7038,10 @@ static void *fpid_next(struct seq_file *m, void *v, loff_t *pos)struct trace_array *tr = m->private;struct trace_pid_list *pid_list =rcu_dereference_sched (tr->function_pids); -if (v ==FTRACE_NO_PIDS ) +if (v ==FTRACE_NO_PIDS ) { + (*pos)++;return NULL ; - + }return trace_pid_next (pid_list, v, pos); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 364/399 trigger_next should increase position index
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
[ Upstream commit 6722b23e7a2ace078344064a9735fb73e554e9ef ]
if seq_file .next fuction does not change position index, read after some lseek can generate unexpected output.
Without patch:
# dd bs=30 skip=1 if=/sys/kernel/tracing/events/sched/sched_switch/trigger dd: /sys/kernel/tracing/events/sched/sched_switch/trigger: cannot skip to specified offset n traceoff snapshot stacktrace enable_event disable_event enable_hist disable_hist hist # Available triggers: # traceon traceoff snapshot stacktrace enable_event disable_event enable_hist disable_hist hist 6+1 records in 6+1 records out 206 bytes copied, 0.00027916 s, 738 kB/s
Notice the printing of "# Available triggers:..." after the line.
With the patch:
# dd bs=30 skip=1 if=/sys/kernel/tracing/events/sched/sched_switch/trigger dd: /sys/kernel/tracing/events/sched/sched_switch/trigger: cannot skip to specified offset n traceoff snapshot stacktrace enable_event disable_event enable_hist disable_hist hist 2+1 records in 2+1 records out 88 bytes copied, 0.000526867 s, 167 kB/s
It only prints the end of the file, and does not restart.
https://bugzilla.kernel.org/show_bug.cgi?id=206283
--- kernel/trace/trace_events_trigger.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/trace/trace_events_trigger.c +3 -2
@@ -116,9 +116,10 @@ static void *trigger_next(struct seq_file *m, void *t, loff_t *pos) {struct trace_event_file *event_file =event_file_data (m->private); -if (t ==SHOW_AVAILABLE_TRIGGERS ) +if (t ==SHOW_AVAILABLE_TRIGGERS ) { + (*pos)++;return NULL ; - + }return seq_list_next (t, &event_file->triggers, pos); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 365/399 radeon: insert 10ms sleep in dce5_crtc_load_lut
In reply to Greg Kroah-HartmanFrom: Daniel Vetter <[email protected]>
[ Upstream commit ec3d65082d7dabad6fa8f66a8ef166f2d522d6b2 ]
Per at least one tester this is enough magic to recover the regression introduced for some people (but not all) in
commit b8e2b0199cc377617dc238f5106352c06dcd3fa2
Author: Peter Rosin <[email protected]> Date: Tue Jul 4 12:36:57 2017 +0200
drm/fb-helper: factor out pseudo-palette
which for radeon had the side-effect of refactoring out a seemingly redudant writing of the color palette.
10ms in a fairly slow modeset path feels like an acceptable form of duct-tape, so maybe worth a shot and see what sticks.
--- drivers/gpu/drm/radeon/radeon_display.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/radeon_display.c +2 -0
@@ -127,6 +127,8 @@ static void dce5_crtc_load_lut(struct drm_crtc *crtc)DRM_DEBUG_KMS ("%d\n" , radeon_crtc->crtc_id); +msleep (10 ); +WREG32 (NI_INPUT_CSC_CONTROL + radeon_crtc->crtc_offset, (NI_INPUT_CSC_GRPH_MODE (NI_INPUT_CSC_BYPASS ) |NI_INPUT_CSC_OVL_MODE (NI_INPUT_CSC_BYPASS )));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 366/399 powerpc: Do not consider weak unresolved symbol relocations as bad
In reply to Greg Kroah-HartmanFrom: Alexandre Ghiti <[email protected]>
[ Upstream commit 43e76cd368fbb67e767da5363ffeaa3989993c8c ]
Commit 8580ac9404f6 ("bpf: Process in-kernel BTF") introduced two weak symbols that may be unresolved at link time which result in an absolute relocation to 0. relocs_check.sh emits the following warning:
"WARNING: 2 bad relocationsc000000001a41478 R_PPC64_ADDR64 _binary__btf_vmlinux_bin_startc000000001a41480 R_PPC64_ADDR64 _binary__btf_vmlinux_bin_end"
whereas those relocations are legitimate even for a relocatable kernel compiled with -pie option.
relocs_check.sh already excluded some weak unresolved symbols explicitly:
remove those hardcoded symbols and add some logic that parses the symbols using nm, retrieves all the weak unresolved symbols and excludes those from the list of the potential bad relocations.
--- arch/powerpc/Makefile.postlink | 4 ++-- arch/powerpc/tools/relocs_check.sh | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-)
arch/powerpc/Makefile.postlink +2 -2
@@ -17,11 +17,11 @@ quiet_cmd_head_check = CHKHEAD $@ quiet_cmd_relocs_check = CHKREL $@ ifdef CONFIG_PPC_BOOK3S_64 cmd_relocs_check = \ - $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$@" ; \ + $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@" ; \ $(BASH) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$@" else cmd_relocs_check = \ - $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$@" + $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$(NM)" "$@" endif # `@true` prevents complaint when there is nothing to be done
arch/powerpc/tools/relocs_check.sh +12 -8
@@ -10,14 +10,21 @@ # based on relocs_check.pl # Copyright © 2009 IBM Corporation -if [ $# -lt 2 ]; then - echo "$0 [path to objdump] [path to vmlinux]" 1>&2 +if [ $# -lt 3 ]; then + echo "$0 [path to objdump] [path to nm] [path to vmlinux]" 1>&2 exit 1 fi -# Have Kbuild supply the path to objdump so we handle cross compilation. +# Have Kbuild supply the path to objdump and nm so we handle cross compilation. objdump="$1" -vmlinux="$2" +nm="$2" +vmlinux="$3" + +# Remove from the bad relocations those that match an undefined weak symbol +# which will result in an absolute relocation to 0. +# Weak unresolved symbols are of that form in nm output: +# " w _binary__btf_vmlinux_bin_end" +undef_weak_symbols=$($nm "$vmlinux" | awk '$1 ~ /w/ { print $2 }') bad_relocs=$( $objdump -R "$vmlinux" |
@@ -26,8 +33,6 @@ $objdump -R "$vmlinux" | # These relocations are okay # On PPC64: # R_PPC64_RELATIVE, R_PPC64_NONE - # R_PPC64_ADDR64 mach_<name> - # R_PPC64_ADDR64 __crc_<name> # On PPC: # R_PPC_RELATIVE, R_PPC_ADDR16_HI, # R_PPC_ADDR16_HA,R_PPC_ADDR16_LO,
@@ -39,8 +44,7 @@ R_PPC_ADDR16_HI R_PPC_ADDR16_HA R_PPC_RELATIVE R_PPC_NONE' | - grep -E -v '\<R_PPC64_ADDR64[[:space:]]+mach_' | - grep -E -v '\<R_PPC64_ADDR64[[:space:]]+__crc_' + ([ "$undef_weak_symbols" ] && grep -F -w -v "$undef_weak_symbols" || cat) ) if [ -z "$bad_relocs" ]; then
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 368/399 tracing: Fix now invalid var_ref_vals assumption in trace action
In reply to Greg Kroah-HartmanFrom: Tom Zanussi <[email protected]>
[ Upstream commit d380dcde9a07ca5de4805dee11f58a98ec0ad6ff ]
The patch 'tracing: Fix histogram code when expression has same var as value' added code to return an existing variable reference when creating a new variable reference, which resulted in var_ref_vals slots being reused instead of being duplicated.
The implementation of the trace action assumes that the end of the var_ref_vals array starting at action_data.var_ref_idx corresponds to the values that will be assigned to the trace params. The patch mentioned above invalidates that assumption, which means that each param needs to explicitly specify its index into var_ref_vals.
This fix changes action_data.var_ref_idx to an array of var ref indexes to account for that.
--- kernel/trace/trace_events_hist.c | 53 +++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 15 deletions(-)
kernel/trace/trace_events_hist.c +38 -15
@@ -470,11 +470,12 @@ struct action_data {* When a histogram trigger is hit, the values of any * references to variables, including variables being passed * as parameters to synthetic events, are collected into a -* var_ref_vals array. This var_ref_idx is the index of the -* first param in the array to be passed to the synthetic -* event invocation. +* var_ref_vals array. This var_ref_idx array is an array of +* indices into the var_ref_vals array, one for each synthetic +* event param, and is passed to the synthetic event +* invocation. */ -unsigned int var_ref_idx; +unsigned int var_ref_idx[TRACING_MAP_VARS_MAX ];struct synth_event *synth_event;bool use_trace_keyword;char *synth_event_name;
@@ -875,14 +876,14 @@ static struct trace_event_functions synth_event_funcs = { static notrace void trace_event_raw_event_synth(void *__data,u64 *var_ref_vals, -unsigned int var_ref_idx) +unsigned int *var_ref_idx) {struct trace_event_file *trace_file = __data;struct synth_trace_event *entry;struct trace_event_buffer fbuffer;struct ring_buffer *buffer;struct synth_event *event; -unsigned int i, n_u64; +unsigned int i, n_u64, val_idx;int fields_size =0 ; event = trace_file->event_call->data;
@@ -905,15 +906,16 @@ static notrace void trace_event_raw_event_synth(void *__data, goto out;for (i =0 , n_u64 =0 ; i < event->n_fields; i++) { + val_idx = var_ref_idx[i];if (event->fields[i]->is_string) { -char *str_val = (char *)(long )var_ref_vals[var_ref_idx + i]; +char *str_val = (char *)(long )var_ref_vals[val_idx];char *str_field = (char *)&entry->fields[n_u64];strscpy (str_field, str_val,STR_VAR_LEN_MAX ); n_u64 +=STR_VAR_LEN_MAX /sizeof (u64); }else {struct synth_field *field = event->fields[i]; -u64 val = var_ref_vals[var_ref_idx + i]; +u64 val = var_ref_vals[val_idx];switch (field->size) {case 1 :
@@ -1113,10 +1115,10 @@ static struct tracepoint *alloc_synth_tracepoint(char *name) }typedef void (*synth_probe_func_t ) (void *__data,u64 *var_ref_vals, -unsigned int var_ref_idx); +unsigned int *var_ref_idx);static inline void trace_synth (struct synth_event *event,u64 *var_ref_vals, -unsigned int var_ref_idx) +unsigned int *var_ref_idx) {struct tracepoint *tp = event->tp;
@@ -2651,6 +2653,22 @@ static int init_var_ref(struct hist_field *ref_field, goto out; } +static int find_var_ref_idx (struct hist_trigger_data *hist_data, +struct hist_field *var_field) +{ +struct hist_field *ref_field; +int i; + +for (i =0 ; i < hist_data->n_var_refs; i++) { + ref_field = hist_data->var_refs[i]; +if (ref_field->var.idx == var_field->var.idx && + ref_field->var.hist_data == var_field->hist_data) +return i; + } + +return -ENOENT ; +} +/** * create_var_ref - Create a variable reference and attach it to trigger * @hist_data: The trigger that will be referencing the variable
@@ -4224,11 +4242,11 @@ static int trace_action_create(struct hist_trigger_data *hist_data,struct trace_array *tr = hist_data->event_file->tr;char *event_name, *param, *system =NULL ;struct hist_field *hist_field, *var_ref; -unsigned int i, var_ref_idx; +unsigned int i;unsigned int field_pos =0 ;struct synth_event *event;char *synth_event_name; -int ret =0 ; +int var_ref_idx, ret =0 ;lockdep_assert_held (&event_mutex);
@@ -4245,8 +4263,6 @@ static int trace_action_create(struct hist_trigger_data *hist_data, event->ref++; - var_ref_idx = hist_data->n_var_refs; -for (i =0 ; i < data->n_params; i++) {char *p;
@@ -4295,6 +4311,14 @@ static int trace_action_create(struct hist_trigger_data *hist_data, goto err; } + var_ref_idx =find_var_ref_idx (hist_data, var_ref); +if (WARN_ON (var_ref_idx <0 )) { + ret = var_ref_idx; + goto err; + } + + data->var_ref_idx[i] = var_ref_idx; + field_pos++;kfree (p);continue ;
@@ -4313,7 +4337,6 @@ static int trace_action_create(struct hist_trigger_data *hist_data, } data->synth_event = event; - data->var_ref_idx = var_ref_idx; out:return ret; err:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 369/399 ocfs2: make local header paths relative to C files
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit ca322fb6030956c2337fbf1c1beeb08c5dd5c943 ]
Gang He reports the failure of building fs/ocfs2/ as an external module of the kernel installed on the system:
$ cd fs/ocfs2 $ make -C /lib/modules/`uname -r`/build M=`pwd` modules
If you want to make it work reliably, I'd recommend to remove ccflags-y from the Makefiles, and to make header paths relative to the C files. I think this is the correct usage of the #include "..." directive.
--- fs/ocfs2/dlm/Makefile | 2 -- fs/ocfs2/dlm/dlmast.c | 8 ++++---- fs/ocfs2/dlm/dlmconvert.c | 8 ++++---- fs/ocfs2/dlm/dlmdebug.c | 8 ++++---- fs/ocfs2/dlm/dlmdomain.c | 8 ++++---- fs/ocfs2/dlm/dlmlock.c | 8 ++++---- fs/ocfs2/dlm/dlmmaster.c | 8 ++++---- fs/ocfs2/dlm/dlmrecovery.c | 8 ++++---- fs/ocfs2/dlm/dlmthread.c | 8 ++++---- fs/ocfs2/dlm/dlmunlock.c | 8 ++++---- fs/ocfs2/dlmfs/Makefile | 2 -- fs/ocfs2/dlmfs/dlmfs.c | 4 ++-- fs/ocfs2/dlmfs/userdlm.c | 6 +++--- 13 files changed, 41 insertions(+), 45 deletions(-)
fs/ocfs2/dlm/Makefile +0 -2
@@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ccflags-y := -I $(srctree)/$(src)/.. - obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \
fs/ocfs2/dlm/dlmast.c +4 -4
@@ -23,15 +23,15 @@#include <linux/spinlock.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static void dlm_update_lvb (struct dlm_ctxt *dlm,struct dlm_lock_resource *res,struct dlm_lock *lock);
fs/ocfs2/dlm/dlmconvert.c +4 -4
@@ -23,9 +23,9 @@#include <linux/spinlock.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -33,7 +33,7 @@#include "dlmconvert.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" /* NOTE: __dlmconvert_master is the only function in here that * needs a spinlock held on entry (res->spinlock) and it is the
fs/ocfs2/dlm/dlmdebug.c +4 -4
@@ -17,9 +17,9 @@#include <linux/debugfs.h> #include <linux/export.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -27,7 +27,7 @@#include "dlmdebug.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static int stringify_lockname (const char *lockname,int locklen,char *buf,int len);
fs/ocfs2/dlm/dlmdomain.c +4 -4
@@ -20,9 +20,9 @@#include <linux/debugfs.h> #include <linux/sched/signal.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -30,7 +30,7 @@#include "dlmdebug.h" #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_DOMAIN) -#include "cluster/masklog.h" +#include "../cluster/masklog.h" /* * ocfs2 node maps are array of long int, which limits to send them freely
fs/ocfs2/dlm/dlmlock.c +4 -4
@@ -25,9 +25,9 @@#include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -35,7 +35,7 @@#include "dlmconvert.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static struct kmem_cache *dlm_lock_cache;
fs/ocfs2/dlm/dlmmaster.c +4 -4
@@ -25,9 +25,9 @@#include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h"
@@ -35,7 +35,7 @@#include "dlmdebug.h" #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_MASTER) -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static void dlm_mle_node_down(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle,
fs/ocfs2/dlm/dlmrecovery.c +4 -4
@@ -26,16 +26,16 @@#include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h" #include "dlmdomain.h" #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_RECOVERY) -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static void dlm_do_local_recovery_cleanup (struct dlm_ctxt *dlm,u8 dead_node);
fs/ocfs2/dlm/dlmthread.c +4 -4
@@ -25,16 +25,16 @@#include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h" #include "dlmdomain.h" #define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_THREAD) -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static int dlm_thread (void *data);static void dlm_flush_asts (struct dlm_ctxt *dlm);
fs/ocfs2/dlm/dlmunlock.c +4 -4
@@ -23,15 +23,15 @@#include <linux/spinlock.h> #include <linux/delay.h> -#include "cluster/heartbeat.h" -#include "cluster/nodemanager.h" -#include "cluster/tcp.h" +#include "../cluster/heartbeat.h" +#include "../cluster/nodemanager.h" +#include "../cluster/tcp.h" #include "dlmapi.h" #include "dlmcommon.h" #define MLOG_MASK_PREFIX ML_DLM -#include "cluster/masklog.h" +#include "../cluster/masklog.h" #define DLM_UNLOCK_FREE_LOCK 0x00000001#define DLM_UNLOCK_CALL_AST 0x00000002
fs/ocfs2/dlmfs/Makefile +0 -2
@@ -1,6 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ccflags-y := -I $(srctree)/$(src)/.. - obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o ocfs2_dlmfs-objs := userdlm.o dlmfs.o
fs/ocfs2/dlmfs/dlmfs.c +2 -2
@@ -33,11 +33,11 @@#include <linux/uaccess.h> -#include "stackglue.h" +#include "../stackglue.h" #include "userdlm.h" #define MLOG_MASK_PREFIX ML_DLMFS -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static const struct super_operations dlmfs_ops;
fs/ocfs2/dlmfs/userdlm.c +3 -3
@@ -21,12 +21,12 @@#include <linux/types.h> #include <linux/crc32.h> -#include "ocfs2_lockingver.h" -#include "stackglue.h" +#include "../ocfs2_lockingver.h" +#include "../stackglue.h" #include "userdlm.h" #define MLOG_MASK_PREFIX ML_DLMFS -#include "cluster/masklog.h" +#include "../cluster/masklog.h" static inline struct user_lock_res *user_lksb_to_lock_res (struct ocfs2_dlm_lksb *lksb)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 370/399 ocfs2: fix a NULL pointer dereference when call ocfs2_update_inode_fsync_trans()
In reply to Greg Kroah-HartmanFrom: wangyan <[email protected]>
[ Upstream commit 9f16ca48fc818a17de8be1f75d08e7f4addc4497 ]
I found a NULL pointer dereference in ocfs2_update_inode_fsync_trans(), handle->h_transaction may be NULL in this situation:
ocfs2_file_write_iter
->__generic_file_write_iter
->generic_perform_write
->ocfs2_write_begin
->ocfs2_write_begin_nolock
->ocfs2_write_cluster_by_desc
->ocfs2_write_cluster
->ocfs2_mark_extent_written
->ocfs2_change_extent_flag
->ocfs2_split_extent
->ocfs2_try_to_merge_extent
->ocfs2_extend_rotate_transaction
->ocfs2_extend_trans
->jbd2_journal_restart
->jbd2__journal_restart
// handle->h_transaction is NULL here
->handle->h_transaction = NULL;
->start_this_handle
/* journal aborted due to storage
network disconnection, return error */
->return -EROFS;
/* line 3806 in ocfs2_try_to_merge_extent (),
it will ignore ret error. */
->ret = 0;
->...
->ocfs2_write_end
->ocfs2_write_end_nolock
->ocfs2_update_inode_fsync_trans
// NULL pointer dereference
->oi->i_sync_tid = handle->h_transaction->t_tid;The information of NULL pointer dereference as follows:
JBD2: Detected IO errors while flushing file data on dm-11-45
Aborting journal on device dm-11-45.
JBD2: Error -5 detected when updating journal superblock for dm-11-45.
(dd,22081,3):ocfs2_extend_trans:474 ERROR: status = -30
(dd,22081,3):ocfs2_try_to_merge_extent:3877 ERROR: status = -30
Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000008
Mem abort info:
ESR = 0x96000004
Exception class = DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000e74e1338
[0000000000000008] pgd=0000000000000000
Internal error: Oops: 96000004 [#1] SMP
Process dd (pid: 22081, stack limit = 0x00000000584f35a9)
CPU: 3 PID: 22081 Comm: dd Kdump: loaded
Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 0.98 08/25/2019
pstate: 60400009 (nZCv daif +PAN -UAO)
pc : ocfs2_write_end_nolock+0x2b8/0x550 [ocfs2]
lr : ocfs2_write_end_nolock+0x2a0/0x550 [ocfs2]
sp : ffff0000459fba70
x29: ffff0000459fba70 x28: 0000000000000000
x27: ffff807ccf7f1000 x26: 0000000000000001
x25: ffff807bdff57970 x24: ffff807caf1d4000
x23: ffff807cc79e9000 x22: 0000000000001000
x21: 000000006c6cd000 x20: ffff0000091d9000
x19: ffff807ccb239db0 x18: ffffffffffffffff
x17: 000000000000000e x16: 0000000000000007
x15: ffff807c5e15bd78 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000001
x9 : 0000000000000228 x8 : 000000000000000c
x7 : 0000000000000fff x6 : ffff807a308ed6b0
x5 : ffff7e01f10967c0 x4 : 0000000000000018
x3 : d0bc661572445600 x2 : 0000000000000000
x1 : 000000001b2e0200 x0 : 0000000000000000
Call trace:
ocfs2_write_end_nolock+0x2b8/0x550 [ocfs2]
ocfs2_write_end+0x4c/0x80 [ocfs2]
generic_perform_write+0x108/0x1a8
__generic_file_write_iter+0x158/0x1c8
ocfs2_file_write_iter+0x668/0x950 [ocfs2]
__vfs_write+0x11c/0x190
vfs_write+0xac/0x1c0
ksys_write+0x6c/0xd8
__arm64_sys_write+0x24/0x30
el0_svc_common+0x78/0x130
el0_svc_handler+0x38/0x78
el0_svc+0x8/0xcTo prevent NULL pointer dereference in this situation, we use is_handle_aborted() before using handle->h_transaction->t_tid.
--- fs/ocfs2/journal.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/ocfs2/journal.h +5 -3
@@ -597,9 +597,11 @@ static inline void ocfs2_update_inode_fsync_trans(handle_t *handle, {struct ocfs2_inode_info *oi =OCFS2_I (inode); - oi->i_sync_tid = handle->h_transaction->t_tid; -if (datasync) - oi->i_datasync_tid = handle->h_transaction->t_tid; +if (!is_handle_aborted (handle)) { + oi->i_sync_tid = handle->h_transaction->t_tid; +if (datasync) + oi->i_datasync_tid = handle->h_transaction->t_tid; + } }#endif /* OCFS2_JOURNAL_H */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 372/399 reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
In reply to Greg Kroah-HartmanFrom: Yunfeng Ye <[email protected]>
[ Upstream commit aacee5446a2a1aa35d0a49dab289552578657fb4 ]
The variable inode may be NULL in reiserfs_insert_item(), but there is no check before accessing the member of inode.
Fix this by adding NULL pointer check before calling reiserfs_debug().
--- fs/reiserfs/stree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/reiserfs/stree.c +2 -1
@@ -2246,7 +2246,8 @@ error_out:/* also releases the path */ unfix_nodes (&s_ins_balance);#ifdef REISERQUOTA_DEBUG -reiserfs_debug (th->t_super,REISERFS_DEBUG_CODE , +if (inode) +reiserfs_debug (th->t_super,REISERFS_DEBUG_CODE ,"reiserquota insert_item(): freeing %u id=%u type=%c" , quota_bytes, inode->i_uid,head2type (ih));#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 355/399 ceph: check availability of mds cluster on mount after wait timeout
In reply to Greg Kroah-HartmanFrom: Xiubo Li <[email protected]>
[ Upstream commit 97820058fb2831a4b203981fa2566ceaaa396103 ]
If all the MDS daemons are down for some reason, then the first mount attempt will fail with EIO after the mount request times out. A mount attempt will also fail with EIO if all of the MDS's are laggy.
This patch changes the code to return -EHOSTUNREACH in these situations and adds a pr_info error message to help the admin determine the cause.
URL: https://tracker.ceph.com/issues/4386
--- fs/ceph/mds_client.c | 3 +-- fs/ceph/super.c | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-)
fs/ceph/mds_client.c +1 -2
@@ -2558,8 +2558,7 @@ static void __do_request(struct ceph_mds_client *mdsc,if (!(mdsc->fsc->mount_options->flags &CEPH_MOUNT_OPT_MOUNTWAIT ) && !ceph_mdsmap_is_cluster_available (mdsc->mdsmap)) { - err = -ENOENT ; -pr_info ("probably no mds server is up\n" ); + err = -EHOSTUNREACH ; goto finish; } }
fs/ceph/super.c +5 -0
@@ -1066,6 +1066,11 @@ static int ceph_get_tree(struct fs_context *fc)return 0 ; out_splat: +if (!ceph_mdsmap_is_cluster_available (fsc->mdsc->mdsmap)) { +pr_info ("No mds server is up or the cluster is laggy\n" ); + err = -EHOSTUNREACH ; + } +ceph_mdsc_close_sessions (fsc->mdsc);deactivate_locked_super (sb); goto out_final;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 374/399 bcache: explicity type cast in bset_bkey_last()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
[ Upstream commit 7c02b0055f774ed9afb6e1c7724f33bf148ffdc0 ]
In bset.h, macro bset_bkey_last() is defined as,
bkey_idx((struct bkey *) (i)->d, (i)->keys)
Parameter i can be variable type of data structure, the macro always works once the type of struct i has member 'd' and 'keys'.
bset_bkey_last() is also used in macro csum_set() to calculate the checksum of a on-disk data structure. When csum_set() is used to calculate checksum of on-disk bcache super block, the parameter 'i' data type is struct cache_sb_disk. Inside struct cache_sb_disk (also in struct cache_sb) the member keys is __u16 type. But bkey_idx() expects unsigned int (a 32bit width), so there is problem when sending parameters via stack to call bkey_idx().
Sparse tool from Intel 0day kbuild system reports this incompatible problem. bkey_idx() is part of user space API, so the simplest fix is to cast the (i)->keys to unsigned int type in macro bset_bkey_last().
--- drivers/md/bcache/bset.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/bset.h +2 -1
@@ -397,7 +397,8 @@ void bch_btree_keys_stats(struct btree_keys *b, struct bset_stats *state);/* Bkey utility code */ -#define bset_bkey_last (i) bkey_idx((struct bkey *) (i)->d, (i)->keys) +#define bset_bkey_last (i) bkey_idx((struct bkey *) (i)->d, \ + (unsigned int)(i)->keys)static inline struct bkey *bset_bkey_idx (struct bset *i,unsigned int idx) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 375/399 bcache: fix incorrect data type usage in btree_flush_write()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
[ Upstream commit d1c3cc34f5a78b38d2b809b289d912c3560545df ]
Dan Carpenter points out that from commit 2aa8c529387c ("bcache: avoid unnecessary btree nodes flushing in btree_flush_write()"), there is a incorrect data type usage which leads to the following static checker warning:
drivers/md/bcache/journal.c:444 btree_flush_write()
warn: 'ref_nr' unsigned <= 0
drivers/md/bcache/journal.c
422 static void btree_flush_write(struct cache_set *c) 423 {
424 struct btree *b, *t, *btree_nodes[BTREE_FLUSH_NR];
425 unsigned int i, nr, ref_nr;
^^^^^^ 426 atomic_t *fifo_front_p, *now_fifo_front_p;
427 size_t mask;
428
429 if (c->journal.btree_flushing)
430 return;
431
432 spin_lock(&c->journal.flush_write_lock);
433 if (c->journal.btree_flushing) {
434 spin_unlock(&c->journal.flush_write_lock);
435 return;
436 }
437 c->journal.btree_flushing = true;
438 spin_unlock(&c->journal.flush_write_lock);
439
440 /* get the oldest journal entry and check its refcount */
441 spin_lock(&c->journal.lock);
442 fifo_front_p = &fifo_front(&c->journal.pin);
443 ref_nr = atomic_read(fifo_front_p);
444 if (ref_nr <= 0) {
^^^^^^^^^^^Unsigned can't be less than zero.
445 /* 446 * do nothing if no btree node references 447 * the oldest journal entry 448 */ 449 spin_unlock(&c->journal.lock); 450 goto out; 451 } 452 spin_unlock(&c->journal.lock);
As the warning information indicates, local varaible ref_nr in unsigned int type is wrong, which does not matche atomic_read() and the "<= 0" checking.
This patch fixes the above error by defining local variable ref_nr as int type.
--- drivers/md/bcache/journal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/journal.c +2 -1
@@ -422,7 +422,8 @@ err:static void btree_flush_write (struct cache_set *c) {struct btree *b, *t, *btree_nodes[BTREE_FLUSH_NR ]; -unsigned int i, nr, ref_nr; +unsigned int i, nr; +int ref_nr;atomic_t *fifo_front_p, *now_fifo_front_p;size_t mask;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 376/399 irqchip/gic-v3-its: Reference to its_invall_cmd descriptor when building INVALL
In reply to Greg Kroah-HartmanFrom: Zenghui Yu <[email protected]>
[ Upstream commit 107945227ac5d4c37911c7841b27c64b489ce9a9 ]
It looks like an obvious mistake to use its_mapc_cmd descriptor when building the INVALL command block. It so far worked by luck because both its_mapc_cmd.col and its_invall_cmd.col sit at the same offset of the ITS command descriptor, but we should not rely on it.
--- drivers/irqchip/irq-gic-v3-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +1 -1
@@ -598,7 +598,7 @@ static struct its_collection *its_build_invall_cmd(struct its_node *its, struct its_cmd_desc *desc) {its_encode_cmd (cmd,GITS_CMD_INVALL ); -its_encode_collection (cmd, desc->its_mapc_cmd.col->col_id); +its_encode_collection (cmd, desc->its_invall_cmd.col->col_id);its_fixup_cmd (cmd);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 377/399 nvmet: Pass lockdep expression to RCU lists
In reply to Greg Kroah-HartmanFrom: Amol Grover <[email protected]>
[ Upstream commit 4ac76436a6d07dec1c3c766f234aa787a16e8f65 ]
ctrl->subsys->namespaces and subsys->namespaces are traversed with list_for_each_entry_rcu outside an RCU read-side critical section but under the protection of ctrl->subsys->lock and subsys->lock respectively.
Hence, add the corresponding lockdep expression to the list traversal primitive to silence false-positive lockdep warnings, and harden RCU lists.
--- drivers/nvme/target/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/nvme/target/core.c +4 -2
@@ -555,7 +555,8 @@ int nvmet_ns_enable(struct nvmet_ns *ns) }else {struct nvmet_ns *old; -list_for_each_entry_rcu (old, &subsys->namespaces, dev_link) { +list_for_each_entry_rcu (old, &subsys->namespaces, dev_link, +lockdep_is_held (&subsys->lock)) {BUG_ON (ns->nsid == old->nsid);if (ns->nsid < old->nsid)break ;
@@ -1172,7 +1173,8 @@ static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl, ctrl->p2p_client =get_device (req->p2p_client); -list_for_each_entry_rcu (ns, &ctrl->subsys->namespaces, dev_link) +list_for_each_entry_rcu (ns, &ctrl->subsys->namespaces, dev_link, +lockdep_is_held (&ctrl->subsys->lock))nvmet_p2pmem_ns_add_p2p (ctrl, ns); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 378/399 nvmet: fix dsm failure when payload does not match sgl descriptor
In reply to Greg Kroah-HartmanFrom: Sagi Grimberg <[email protected]>
[ Upstream commit b716e6889c95f64ba32af492461f6cc9341f3f05 ]
The host is allowed to pass the controller an sgl describing a buffer that is larger than the dsm payload itself, allow it when executing dsm.
--- drivers/nvme/target/core.c | 11 +++++++++++ drivers/nvme/target/io-cmd-bdev.c | 2 +- drivers/nvme/target/io-cmd-file.c | 2 +- drivers/nvme/target/nvmet.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-)
drivers/nvme/target/core.c +11 -0
@@ -939,6 +939,17 @@ bool nvmet_check_data_len(struct nvmet_req *req, size_t data_len) }EXPORT_SYMBOL_GPL (nvmet_check_data_len); +bool nvmet_check_data_len_lte (struct nvmet_req *req,size_t data_len) +{ +if (unlikely (data_len > req->transfer_len)) { + req->error_loc = offsetof(struct nvme_common_command , dptr); +nvmet_req_complete (req,NVME_SC_SGL_INVALID_DATA |NVME_SC_DNR ); +return false; + } + +return true; +} +int nvmet_req_alloc_sgl (struct nvmet_req *req) {struct pci_dev *p2p_dev =NULL ;
drivers/nvme/target/io-cmd-bdev.c +1 -1
@@ -280,7 +280,7 @@ static void nvmet_bdev_execute_discard(struct nvmet_req *req)static void nvmet_bdev_execute_dsm (struct nvmet_req *req) { -if (!nvmet_check_data_len (req,nvmet_dsm_len (req))) +if (!nvmet_check_data_len_lte (req,nvmet_dsm_len (req)))return ;switch (le32_to_cpu (req->cmd->dsm.attributes)) {
drivers/nvme/target/io-cmd-file.c +1 -1
@@ -336,7 +336,7 @@ static void nvmet_file_dsm_work(struct work_struct *w)static void nvmet_file_execute_dsm (struct nvmet_req *req) { -if (!nvmet_check_data_len (req,nvmet_dsm_len (req))) +if (!nvmet_check_data_len_lte (req,nvmet_dsm_len (req)))return ;INIT_WORK (&req->f.work, nvmet_file_dsm_work);schedule_work (&req->f.work);
drivers/nvme/target/nvmet.h +1 -0
@@ -374,6 +374,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, struct nvmet_sq *sq, const struct nvmet_fabrics_ops *ops);void nvmet_req_uninit (struct nvmet_req *req);bool nvmet_check_data_len (struct nvmet_req *req,size_t data_len); +bool nvmet_check_data_len_lte (struct nvmet_req *req,size_t data_len);void nvmet_req_complete (struct nvmet_req *req,u16 status);int nvmet_req_alloc_sgl (struct nvmet_req *req);void nvmet_req_free_sgl (struct nvmet_req *req);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 379/399 nvme-pci: remove nvmeq->tags
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit cfa27356f835dc7755192e7b941d4f4851acbcc7 ]
There is no real need to have a pointer to the tagset in struct nvme_queue, as we only need it in a single place, and that place can derive the used tagset from the device and qid trivially. This fixes a problem with stale pointer exposure when tagsets are reset, and also shrinks the nvme_queue structure. It also matches what most other transports have done since day 1.
--- drivers/nvme/host/pci.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
drivers/nvme/host/pci.c +8 -15
@@ -167,7 +167,6 @@ struct nvme_queue {/* only used for poll queues: */ spinlock_t cq_poll_lock____cacheline_aligned_in_smp ;volatile struct nvme_completion *cqes; -struct blk_mq_tags **tags;dma_addr_t sq_dma_addr;dma_addr_t cq_dma_addr;u32 __iomem *q_db;
@@ -376,29 +375,17 @@ static int nvme_admin_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,WARN_ON (hctx_idx !=0 );WARN_ON (dev->admin_tagset.tags[0 ] != hctx->tags); -WARN_ON (nvmeq->tags); hctx->driver_data = nvmeq; - nvmeq->tags = &dev->admin_tagset.tags[0 ];return 0 ; } -static void nvme_admin_exit_hctx (struct blk_mq_hw_ctx *hctx,unsigned int hctx_idx) -{ -struct nvme_queue *nvmeq = hctx->driver_data; - - nvmeq->tags =NULL ; -} -static int nvme_init_hctx (struct blk_mq_hw_ctx *hctx,void *data,unsigned int hctx_idx) {struct nvme_dev *dev = data;struct nvme_queue *nvmeq = &dev->queues[hctx_idx +1 ]; -if (!nvmeq->tags) - nvmeq->tags = &dev->tagset.tags[hctx_idx]; -WARN_ON (dev->tagset.tags[hctx_idx] != hctx->tags); hctx->driver_data = nvmeq;return 0 ;
@@ -948,6 +935,13 @@ static inline void nvme_ring_cq_doorbell(struct nvme_queue *nvmeq)writel (head, nvmeq->q_db + nvmeq->dev->db_stride); } +static inline struct blk_mq_tags *nvme_queue_tagset (struct nvme_queue *nvmeq) +{ +if (!nvmeq->qid) +return nvmeq->dev->admin_tagset.tags[0 ]; +return nvmeq->dev->tagset.tags[nvmeq->qid -1 ]; +} +static inline void nvme_handle_cqe (struct nvme_queue *nvmeq,u16 idx) {volatile struct nvme_completion *cqe = &nvmeq->cqes[idx];
@@ -972,7 +966,7 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)return ; } - req =blk_mq_tag_to_rq (*nvmeq->tags, cqe->command_id); + req =blk_mq_tag_to_rq (nvme_queue_tagset (nvmeq), cqe->command_id);trace_nvme_sq (req, cqe->sq_head, nvmeq->sq_tail);nvme_end_request (req, cqe->status, cqe->result); }
@@ -1572,7 +1566,6 @@ static const struct blk_mq_ops nvme_mq_admin_ops = { .queue_rq = nvme_queue_rq, .complete = nvme_pci_complete_rq, .init_hctx = nvme_admin_init_hctx, - .exit_hctx = nvme_admin_exit_hctx, .init_request = nvme_init_request, .timeout = nvme_timeout, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 380/399 iwlwifi: mvm: Fix thermal zone registration
In reply to Greg Kroah-HartmanFrom: Andrei Otcheretianski <[email protected]>
[ Upstream commit baa6cf8450b72dcab11f37c47efce7c5b9b8ad0f ]
Use a unique name when registering a thermal zone. Otherwise, with multiple NICS, we hit the following warning during the unregistration.
WARNING: CPU: 2 PID: 3525 at fs/sysfs/group.c:255 RIP: 0010:sysfs_remove_group+0x80/0x90 Call Trace: dpm_sysfs_remove+0x57/0x60 device_del+0x5a/0x350 ? sscanf+0x4e/0x70 device_unregister+0x1a/0x60 hwmon_device_unregister+0x4a/0xa0 thermal_remove_hwmon_sysfs+0x175/0x1d0 thermal_zone_device_unregister+0x188/0x1e0 iwl_mvm_thermal_exit+0xe7/0x100 [iwlmvm] iwl_op_mode_mvm_stop+0x27/0x180 [iwlmvm] _iwl_op_mode_stop.isra.3+0x2b/0x50 [iwlwifi] iwl_opmode_deregister+0x90/0xa0 [iwlwifi] __exit_compat+0x10/0x2c7 [iwlmvm] __x64_sys_delete_module+0x13f/0x270 do_syscall_64+0x5a/0x110 entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/tt.c +3 -1
@@ -734,7 +734,8 @@ static struct thermal_zone_device_ops tzone_ops = {static void iwl_mvm_thermal_zone_register (struct iwl_mvm *mvm) {int i; -char name[] ="iwlwifi" ; +char name[16 ]; +static atomic_t counter =ATOMIC_INIT (0 );if (!iwl_mvm_is_tt_in_fw (mvm)) { mvm->tz_device.tzone =NULL ;
@@ -744,6 +745,7 @@ static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm)BUILD_BUG_ON (ARRAY_SIZE (name) >=THERMAL_NAME_LENGTH ); +sprintf (name,"iwlwifi_%u" ,atomic_inc_return (&counter) &0xFF ); mvm->tz_device.tzone = thermal_zone_device_register(name, IWL_MAX_DTS_TRIPS, IWL_WRITABLE_TRIPS_MSK,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 382/399 asm-generic/tlb: add missing CONFIG symbol
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 27796d03c9c4b2b937ed4cc2b10f21559ad5a8c9 ]
Without this the symbol will not actually end up in .config files.
--- arch/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/Kconfig +3 -0
@@ -399,6 +399,9 @@ config HAVE_RCU_TABLE_FREE config HAVE_MMU_GATHER_PAGE_SIZE bool +config MMU_GATHER_NO_RANGE + bool + config HAVE_MMU_GATHER_NO_GATHER bool
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 356/399 rbd: work around -Wuninitialized warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit a55e601b2f02df5db7070e9a37bd655c9c576a52 ]
gcc -O3 warns about a dummy variable that is passed down into rbd_img_fill_nodata without being initialized:
drivers/block/rbd.c: In function 'rbd_img_fill_nodata':drivers/block/rbd.c:2573:13: error: 'dummy' is used uninitialized in this function [-Werror=uninitialized]
fctx->iter = *fctx->pos;
Since this is a dummy, I assume the warning is harmless, but it's better to initialize it anyway and avoid the warning.
--- drivers/block/rbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rbd.c +1 -1
@@ -2662,7 +2662,7 @@ static int rbd_img_fill_nodata(struct rbd_img_request *img_req, u64 off, u64 len) {struct ceph_file_extent ex = { off, len }; -union rbd_img_fill_iter dummy; +union rbd_img_fill_iter dummy = {};struct rbd_img_fill_ctx fctx = { .pos_type =OBJ_REQUEST_NODATA , .pos = &dummy,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 383/399 tc-testing: add missing nsPlugin to basic.json
In reply to Greg Kroah-HartmanFrom: Davide Caratti <[email protected]>
[ Upstream commit e9ed4fa7b4400d7b2cf03108842a30e6c9bd0eb2 ]
since tdc tests for cls_basic need $DEV1, use 'nsPlugin' so that the following command can be run without errors:
[root@f31 tc-testing]# ./tdc.py -c basic
--- .../tc-testing/tc-tests/filters/basic.json | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+)
tools/testing/selftests/tc-testing/tc-tests/filters/basic.json +51 -0
@@ -6,6 +6,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -25,6 +28,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -44,6 +50,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -63,6 +72,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -82,6 +94,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -101,6 +116,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -120,6 +138,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -139,6 +160,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -158,6 +182,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -177,6 +204,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -196,6 +226,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -215,6 +248,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -234,6 +270,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -253,6 +292,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -272,6 +314,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -291,6 +336,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
@@ -310,6 +358,9 @@ "filter", "basic" ], + "plugins": { + "requires": "nsPlugin" + }, "setup": [ "$TC qdisc add dev $DEV1 ingress" ],
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 384/399 microblaze: Prevent the overflow of the start
In reply to Greg Kroah-HartmanFrom: Shubhrajyoti Datta <[email protected]>
[ Upstream commit 061d2c1d593076424c910cb1b64ecdb5c9a6923f ]
In case the start + cache size is more than the max int the start overflows.
Prevent the same.
--- arch/microblaze/kernel/cpu/cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/microblaze/kernel/cpu/cache.c +2 -1
@@ -92,7 +92,8 @@ static inline void __disable_dcache_nomsr(void)#define CACHE_LOOP_LIMITS (start, end, cache_line_length, cache_size) \ do { \ int align = ~(cache_line_length - 1); \ - end = min(start + cache_size, end); \ + if (start < UINT_MAX - cache_size) \ + end = min(start + cache_size, end); \ start &= align; \ } while (0)
Signature · 1 line
2.20.1