power: supply: sc27xx: Add missing MODULE_DEVICE_TABLE
Subsystems (12)
Sasha Levin
maintainerPATCH 1/28 power: supply: sc27xx: Add missing MODULE_DEVICE_TABLE
From: Zou Wei <[email protected]>
[ Upstream commit 603fcfb9d4ec1cad8d66d3bb37f3613afa8a661a ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/power/supply/sc27xx_fuel_gauge.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/sc27xx_fuel_gauge.c +1 -0
@@ -1215,6 +1215,7 @@ static const struct of_device_id sc27xx_fgu_of_match[] = { { .compatible = "sprd,sc2731-fgu", }, { } }; +MODULE_DEVICE_TABLE (of, sc27xx_fgu_of_match);static struct platform_driver sc27xx_fgu_driver = { .probe = sc27xx_fgu_probe,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 2/28 power: supply: sc2731_charger: Add missing MODULE_DEVICE_TABLE
From: Zou Wei <[email protected]>
[ Upstream commit 2aac79d14d76879c8e307820b31876e315b1b242 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/power/supply/sc2731_charger.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/sc2731_charger.c +1 -0
@@ -524,6 +524,7 @@ static const struct of_device_id sc2731_charger_of_match[] = { { .compatible = "sprd,sc2731-charger", }, { } }; +MODULE_DEVICE_TABLE (of, sc2731_charger_of_match);static struct platform_driver sc2731_charger_driver = { .driver = {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 3/28 pwm: spear: Don't modify HW state in .remove callback
In reply to Sasha LevinFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit b601a18f12383001e7a8da238de7ca1559ebc450 ]
A consumer is expected to disable a PWM before calling pwm_put(). And if they didn't there is hopefully a good reason (or the consumer needs fixing). Also if disabling an enabled PWM was the right thing to do, this should better be done in the framework instead of in each low level driver.
So drop the hardware modification from the .remove() callback.
--- drivers/pwm/pwm-spear.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/pwm/pwm-spear.c +0 -4
@@ -231,10 +231,6 @@ static int spear_pwm_probe(struct platform_device *pdev)static int spear_pwm_remove (struct platform_device *pdev) {struct spear_pwm_chip *pc =platform_get_drvdata (pdev); -int i; - -for (i =0 ; i <NUM_PWM ; i++) -pwm_disable (&pc->chip.pwms[i]);/* clk was prepared in probe, hence unprepare it here */ clk_unprepare (pc->clk);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 4/28 power: supply: ab8500: Avoid NULL pointers
In reply to Sasha LevinFrom: Linus Walleij <[email protected]>
[ Upstream commit 5bcb5087c9dd3dca1ff0ebd8002c5313c9332b56 ]
Sometimes the code will crash because we haven't enabled AC or USB charging and thus not created the corresponding psy device. Fix it by checking that it is there before notifying.
--- drivers/power/supply/ab8500_charger.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/power/supply/ab8500_charger.c +17 -1
@@ -407,6 +407,14 @@ static void ab8500_enable_disable_sw_fallback(struct ab8500_charger *di,static void ab8500_power_supply_changed (struct ab8500_charger *di,struct power_supply *psy) { +/* +* This happens if we get notifications or interrupts and +* the platform has been configured not to support one or +* other type of charging. +*/ +if (!psy) +return ; +if (di->autopower_cfg) { if (!di->usb.charger_connected && !di->ac.charger_connected &&
@@ -433,7 +441,15 @@ static void ab8500_charger_set_usb_connected(struct ab8500_charger *di,if (!connected) di->flags.vbus_drop_end = false; -sysfs_notify (&di->usb_chg.psy->dev.kobj,NULL ,"present" ); +/* +* Sometimes the platform is configured not to support +* USB charging and no psy has been created, but we still +* will get these notifications. +*/ +if (di->usb_chg.psy) { +sysfs_notify (&di->usb_chg.psy->dev.kobj,NULL , +"present" ); + }if (connected) {mutex_lock (&di->charger_attached_mutex);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/28 power: supply: max17042: Do not enforce (incorrect) interrupt trigger type
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7fbf6b731bca347700e460d94b130f9d734b33e9 ]
Interrupt line can be configured on different hardware in different way, even inverted. Therefore driver should not enforce specific trigger type - edge falling - but instead rely on Devicetree to configure it.
The Maxim 17047/77693 datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU therefore the edge falling is not correct.
The interrupt line is shared between PMIC and RTC driver, so using level sensitive interrupt is here especially important to avoid races. With an edge configuration in case if first PMIC signals interrupt followed shortly after by the RTC, the interrupt might not be yet cleared/acked thus the second one would not be noticed.
--- drivers/power/supply/max17042_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +1 -1
@@ -1076,7 +1076,7 @@ static int max17042_probe(struct i2c_client *client, }if (client->irq) { -unsigned int flags =IRQF_TRIGGER_FALLING |IRQF_ONESHOT ; +unsigned int flags =IRQF_ONESHOT ;/* * On ACPI systems the IRQ may be handled by ACPI-event code,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/28 power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Bixuan Cui <[email protected]>
[ Upstream commit ed3443fb4df4e140a22f65144546c8a8e1e27f4e ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/power/reset/gpio-poweroff.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/reset/gpio-poweroff.c +1 -0
@@ -90,6 +90,7 @@ static const struct of_device_id of_gpio_poweroff_match[] = { { .compatible = "gpio-poweroff", }, {}, }; +MODULE_DEVICE_TABLE (of, of_gpio_poweroff_match);static struct platform_driver gpio_poweroff_driver = { .probe = gpio_poweroff_probe,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/28 ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
In reply to Sasha LevinFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 8b95a7d90ce8160ac5cffd5bace6e2eba01a871e ]
There's a few instructions that GAS infers operands but Clang doesn't; from what I can tell the Arm ARM doesn't say these are optional.
F5.1.257 TBB, TBH T1 Halfword variant
F5.1.238 STREXD T1 variant
F5.1.84 LDREXD T1 variant
--- arch/arm/probes/kprobes/test-thumb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/probes/kprobes/test-thumb.c +5 -5
@@ -441,21 +441,21 @@ void kprobe_thumb32_test_cases(void) "3: mvn r0, r0 \n\t" "2: nop \n\t") - TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,"]", + TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,", lsl #1]", "9: \n\t" ".short (2f-1b-4)>>1 \n\t" ".short (3f-1b-4)>>1 \n\t" "3: mvn r0, r0 \n\t" "2: nop \n\t") - TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,"]", + TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,", lsl #1]", "9: \n\t" ".short (2f-1b-4)>>1 \n\t" ".short (3f-1b-4)>>1 \n\t" "3: mvn r0, r0 \n\t" "2: nop \n\t") -TEST_RRX ("tbh [r" ,1 ,9f ,", r" ,14 ,1 ,"]" , +TEST_RRX ("tbh [r" ,1 ,9f ,", r" ,14 ,1 ,", lsl #1]" ,"9: \n\t" ".short (2f-1b-4)>>1 \n\t" ".short (3f-1b-4)>>1 \n\t"
@@ -468,10 +468,10 @@ void kprobe_thumb32_test_cases(void) TEST_UNSUPPORTED("strexb r0, r1, [r2]") TEST_UNSUPPORTED("strexh r0, r1, [r2]") - TEST_UNSUPPORTED("strexd r0, r1, [r2]") + TEST_UNSUPPORTED("strexd r0, r1, r2, [r2]") TEST_UNSUPPORTED("ldrexb r0, [r1]") TEST_UNSUPPORTED("ldrexh r0, [r1]") - TEST_UNSUPPORTED("ldrexd r0, [r1]") + TEST_UNSUPPORTED("ldrexd r0, r1, [r1]")TEST_GROUP ("Data-processing (shifted register) and (modified immediate)" )
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 8/28 PCI/P2PDMA: Avoid pci_get_slot(), which may sleep
In reply to Sasha LevinFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 3ec0c3ec2d92c09465534a1ff9c6f9d9506ffef6 ]
In order to use upstream_bridge_distance_warn() from a dma_map function, it must not sleep. However, pci_get_slot() takes the pci_bus_sem so it might sleep.
In order to avoid this, try to get the host bridge's device from the first element in the device list. It should be impossible for the host bridge's device to go away while references are held on child devices, so the first element should not be able to change and, thus, this should be safe.
Introduce a static function called pci_host_bridge_dev() to obtain the host bridge's root device.
--- drivers/pci/p2pdma.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-)
drivers/pci/p2pdma.c +32 -2
@@ -292,10 +292,41 @@ static const struct pci_p2pdma_whitelist_entry { {} }; +/* +* This lookup function tries to find the PCI device corresponding to a given +* host bridge. +* +* It assumes the host bridge device is the first PCI device in the +* bus->devices list and that the devfn is 00.0. These assumptions should hold +* for all the devices in the whitelist above. +* +* This function is equivalent to pci_get_slot(host->bus, 0), however it does +* not take the pci_bus_sem lock seeing __host_bridge_whitelist() must not +* sleep. +* +* For this to be safe, the caller should hold a reference to a device on the +* bridge, which should ensure the host_bridge device will not be freed +* or removed from the head of the devices list. +*/ +static struct pci_dev *pci_host_bridge_dev (struct pci_host_bridge *host) +{ +struct pci_dev *root; + + root =list_first_entry_or_null (&host->bus->devices, + struct pci_dev, bus_list); + +if (!root) +return NULL ; +if (root->devfn !=PCI_DEVFN (0 ,0 )) +return NULL ; + +return root; +} +static bool __host_bridge_whitelist (struct pci_host_bridge *host,bool same_host_bridge) { -struct pci_dev *root =pci_get_slot (host->bus,PCI_DEVFN (0 ,0 )); +struct pci_dev *root =pci_host_bridge_dev (host);const struct pci_p2pdma_whitelist_entry *entry;unsigned short vendor, device;
@@ -304,7 +335,6 @@ static bool __host_bridge_whitelist(struct pci_host_bridge *host, vendor = root->vendor; device = root->device; -pci_dev_put (root);for (entry = pci_p2pdma_whitelist; entry->vendor; entry++) {if (vendor != entry->vendor || device != entry->device)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 9/28 watchdog: Fix possible use-after-free in wdt_startup()
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit c08a6b31e4917034f0ed0cb457c3bb209576f542 ]
This module's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/watchdog/sbc60xxwdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sbc60xxwdt.c +1 -1
@@ -146,7 +146,7 @@ static void wdt_startup(void)static void wdt_turnoff (void ) {/* Stop the timer */ -del_timer (&timer); +del_timer_sync (&timer);inb_p (wdt_stop);pr_info ("Watchdog timer is now disabled...\n" ); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 10/28 watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit 90b7c141132244e8e49a34a4c1e445cce33e07f4 ]
This module's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/watchdog/sc520_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sc520_wdt.c +1 -1
@@ -186,7 +186,7 @@ static int wdt_startup(void)static int wdt_turnoff (void ) {/* Stop the timer */ -del_timer (&timer); +del_timer_sync (&timer);/* Stop the watchdog */ wdt_config (0 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 11/28 watchdog: Fix possible use-after-free by calling del_timer_sync()
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit d0212f095ab56672f6f36aabc605bda205e1e0bf ]
This driver's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/watchdog/lpc18xx_wdt.c | 2 +- drivers/watchdog/w83877f_wdt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/lpc18xx_wdt.c +1 -1
@@ -292,7 +292,7 @@ static int lpc18xx_wdt_remove(struct platform_device *pdev)struct lpc18xx_wdt_dev *lpc18xx_wdt =platform_get_drvdata (pdev);dev_warn (&pdev->dev,"I quit now, hardware will probably reboot!\n" ); -del_timer (&lpc18xx_wdt->timer); +del_timer_sync (&lpc18xx_wdt->timer);return 0 ; }
drivers/watchdog/w83877f_wdt.c +1 -1
@@ -166,7 +166,7 @@ static void wdt_startup(void)static void wdt_turnoff (void ) {/* Stop the timer */ -del_timer (&timer); +del_timer_sync (&timer);wdt_change (WDT_DISABLE );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 12/28 watchdog: imx_sc_wdt: fix pretimeout
In reply to Sasha LevinFrom: Stefan Eichenberger <[email protected]>
[ Upstream commit 854478a381078ee86ae2a7908a934b1ded399130 ]
If the WDIOF_PRETIMEOUT flag is not set when registering the device the driver will not show the sysfs entries or register the default governor. By moving the registering after the decision whether pretimeout is supported this gets fixed.
--- drivers/watchdog/imx_sc_wdt.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/watchdog/imx_sc_wdt.c +4 -7
@@ -185,16 +185,12 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)watchdog_stop_on_reboot (wdog);watchdog_stop_on_unregister (wdog); - ret =devm_watchdog_register_device (dev, wdog); -if (ret) -return ret; - ret =imx_scu_irq_group_enable (SC_IRQ_GROUP_WDOG ,SC_IRQ_WDOG , true);if (ret) {dev_warn (dev,"Enable irq failed, pretimeout NOT supported\n" ); -return 0 ; + goto register_device; } imx_sc_wdd->wdt_notifier.notifier_call = imx_sc_wdt_notify;
@@ -205,7 +201,7 @@ static int imx_sc_wdt_probe(struct platform_device *pdev) false);dev_warn (dev,"Register irq notifier failed, pretimeout NOT supported\n" ); -return 0 ; + goto register_device; } ret = devm_add_action_or_reset(dev, imx_sc_wdt_action,
@@ -215,7 +211,8 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)else dev_warn (dev,"Add action failed, pretimeout NOT supported\n" ); -return 0 ; +register_device: +return devm_watchdog_register_device (dev, wdog); }static int __maybe_unused imx_sc_wdt_suspend (struct device *dev)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 13/28 watchdog: iTCO_wdt: Account for rebooting on second timeout
In reply to Sasha LevinFrom: Jan Kiszka <[email protected]>
[ Upstream commit cb011044e34c293e139570ce5c01aed66a34345c ]
This was already attempted to fix via 1fccb73011ea: If the BIOS did not enable TCO SMIs, the timer definitely needs to trigger twice in order to cause a reboot. If TCO SMIs are on, as well as SMIs in general, we can continue to assume that the BIOS will perform a reboot on the first timeout.
QEMU with its ICH9 and related BIOS falls into the former category, currently taking twice the configured timeout in order to reboot the machine. For iTCO version that fall under turn_SMI_watchdog_clear_off, this is also true and was currently only addressed for v1, irrespective of the turn_SMI_watchdog_clear_off value.
--- drivers/watchdog/iTCO_wdt.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/watchdog/iTCO_wdt.c +9 -3
@@ -72,6 +72,8 @@#define TCOBASE (p) ((p)->tco_res->start)/* SMI Control and Enable Register */ #define SMI_EN (p) ((p)->smi_res->start) +#define TCO_EN (1 << 13) +#define GBL_SMI_EN (1 << 0)#define TCO_RLD (p) (TCOBASE(p) + 0x00)/* TCO Timer Reload/Curr. Value */ #define TCOv1_TMR (p) (TCOBASE(p) + 0x01)/* TCOv1 Timer Initial Value*/
@@ -344,8 +346,12 @@ static int iTCO_wdt_set_timeout(struct watchdog_device *wd_dev, unsigned int t) tmrval =seconds_to_ticks (p, t); -/* For TCO v1 the timer counts down twice before rebooting */ -if (p->iTCO_version ==1 ) +/* +* If TCO SMIs are off, the timer counts down twice before rebooting. +* Otherwise, the BIOS generally reboots when the SMI triggers. +*/ +if (p->smi_res && + (SMI_EN (p) & (TCO_EN |GBL_SMI_EN )) != (TCO_EN |GBL_SMI_EN )) tmrval /=2 ;/* from the specs: */
@@ -510,7 +516,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev)* Disables TCO logic generating an SMI# */ val32 =inl (SMI_EN (p)); - val32 &=0xffffdfff ;/* Turn off SMI clearing watchdog */ + val32 &= ~TCO_EN ;/* Turn off SMI clearing watchdog */ outl (val32,SMI_EN (p)); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 14/28 x86/fpu: Return proper error codes from user access functions
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit aee8c67a4faa40a8df4e79316dbfc92d123989c1 ]
When *RSTOR from user memory raises an exception, there is no way to differentiate them. That's bad because it forces the slow path even when the failure was not a fault. If the operation raised eg. #GP then going through the slow path is pointless.
Use _ASM_EXTABLE_FAULT() which stores the trap number and let the exception fixup return the negated trap number as error.
This allows to separate the fast path and let it handle faults directly and avoid the slow path for all other exceptions.
--- arch/x86/include/asm/fpu/internal.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
arch/x86/include/asm/fpu/internal.h +12 -7
@@ -102,6 +102,7 @@ static inline void fpstate_init_fxstate(struct fxregs_state *fx) }extern void fpstate_sanitize_xstate (struct fpu *fpu); +/* Returns 0 or the negated trap number, which results in -EFAULT for #PF */ #define user_insn(insn, output, input...) \ ({ \ int err; \
@@ -109,14 +110,14 @@ extern void fpstate_sanitize_xstate(struct fpu *fpu);might_fault (); \ \ asm volatile(ASM_STAC "\n" \ - "1:" #insn "\n\t" \ + "1: " #insn "\n" \ "2: " ASM_CLAC "\n" \ ".section .fixup,\"ax\"\n" \ - "3: movl $-1,%[err]\n" \ + "3: negl %%eax\n" \ " jmp 2b\n" \ ".previous\n" \ - _ASM_EXTABLE(1b, 3b) \ - : [err] "=r" (err), output \ + _ASM_EXTABLE_FAULT(1b, 3b) \ + : [err] "=a" (err), output \ : "0"(0), input); \ err; \ })
@@ -210,16 +211,20 @@ static inline void copy_fxregs_to_kernel(struct fpu *fpu)#define XRSTOR ".byte " REX_PREFIX "0x0f,0xae,0x2f"#define XRSTORS ".byte " REX_PREFIX "0x0f,0xc7,0x1f" +/* +* After this @err contains 0 on success or the negated trap number when +* the operation raises an exception. For faults this results in -EFAULT. +*/ #define XSTATE_OP (op, st, lmask, hmask, err) \ asm volatile("1:" op "\n\t" \ "xor %[err], %[err]\n" \ "2:\n\t" \ ".pushsection .fixup,\"ax\"\n\t" \ - "3: movl $-2,%[err]\n\t" \ + "3: negl %%eax\n\t" \ "jmp 2b\n\t" \ ".popsection\n\t" \ - _ASM_EXTABLE(1b, 3b) \ - : [err] "=r" (err) \ + _ASM_EXTABLE_FAULT(1b, 3b) \ + : [err] "=a" (err) \ : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \ : "memory")
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 15/28 PCI: tegra: Add missing MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit 7bf475a4614a9722b9b989e53184a02596cf16d1 ]
Add missing MODULE_DEVICE_TABLE definition so we generate correct modalias for automatic loading of this driver when it is built as a module.
--- drivers/pci/controller/pci-tegra.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/controller/pci-tegra.c +1 -0
@@ -2613,6 +2613,7 @@ static const struct of_device_id tegra_pcie_of_match[] = { { .compatible = "nvidia,tegra20-pcie", .data = &tegra20_pcie }, { }, }; +MODULE_DEVICE_TABLE (of, tegra_pcie_of_match);static void *tegra_pcie_ports_seq_start (struct seq_file *s,loff_t *pos) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 16/28 orangefs: fix orangefs df output.
In reply to Sasha LevinFrom: Mike Marshall <[email protected]>
[ Upstream commit 0fdec1b3c9fbb5e856a40db5993c9eaf91c74a83 ]
Orangefs df output is whacky. Walt Ligon suggested this might fix it. It seems way more in line with reality now...
--- fs/orangefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/super.c +1 -1
@@ -209,7 +209,7 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_bavail = (sector_t ) new_op->downcall.resp.statfs.blocks_avail; buf->f_files = (sector_t ) new_op->downcall.resp.statfs.files_total; buf->f_ffree = (sector_t ) new_op->downcall.resp.statfs.files_avail; - buf->f_frsize = sb->s_blocksize; + buf->f_frsize =0 ; out_op_release:op_release (new_op);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 17/28 ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
In reply to Sasha LevinFrom: Jeff Layton <[email protected]>
[ Upstream commit 22d41cdcd3cfd467a4af074165357fcbea1c37f5 ]
The checks for page->mapping are odd, as set_page_dirty is an address_space operation, and I don't see where it would be called on a non-pagecache page.
The warning about the page lock also seems bogus. The comment over set_page_dirty() says that it can be called without the page lock in some rare cases. I don't think we want to warn if that's the case.
--- fs/ceph/addr.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
fs/ceph/addr.c +1 -9
@@ -76,10 +76,6 @@ static int ceph_set_page_dirty(struct page *page)struct inode *inode;struct ceph_inode_info *ci;struct ceph_snap_context *snapc; -int ret; - -if (unlikely (!mapping)) -return !TestSetPageDirty (page);if (PageDirty (page)) { dout("%p set_page_dirty %p idx %lu -- already dirty\n",
@@ -125,11 +121,7 @@ static int ceph_set_page_dirty(struct page *page) page->private = (unsigned long )snapc;SetPagePrivate (page); - ret =__set_page_dirty_nobuffers (page); -WARN_ON (!PageLocked (page)); -WARN_ON (!page->mapping); - -return ret; +return __set_page_dirty_nobuffers (page); }/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 18/28 NFS: nfs_find_open_context() may only select open files
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit e97bc66377bca097e1f3349ca18ca17f202ff659 ]
If a file has already been closed, then it should not be selected to support further I/O.
--- fs/nfs/inode.c | 4 ++++ include/linux/nfs_fs.h | 1 + 2 files changed, 5 insertions(+)
fs/nfs/inode.c +4 -0
@@ -1048,6 +1048,7 @@ EXPORT_SYMBOL_GPL(nfs_inode_attach_open_context);void nfs_file_set_open_context (struct file *filp,struct nfs_open_context *ctx) { filp->private_data =get_nfs_open_context (ctx); +set_bit (NFS_CONTEXT_FILE_OPEN , &ctx->flags);if (list_empty (&ctx->list))nfs_inode_attach_open_context (ctx); }
@@ -1067,6 +1068,8 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, const structcontinue ;if ((pos->mode & (FMODE_READ |FMODE_WRITE )) != mode)continue ; +if (!test_bit (NFS_CONTEXT_FILE_OPEN , &pos->flags)) +continue ; ctx =get_nfs_open_context (pos);if (ctx)break ;
@@ -1082,6 +1085,7 @@ void nfs_file_clear_open_context(struct file *filp)if (ctx) {struct inode *inode =d_inode (ctx->dentry); +clear_bit (NFS_CONTEXT_FILE_OPEN , &ctx->flags);/* * We fatal error on write before. Try to writeback * every page again.
include/linux/nfs_fs.h +1 -0
@@ -79,6 +79,7 @@ struct nfs_open_context {#define NFS_CONTEXT_RESEND_WRITES (1)#define NFS_CONTEXT_BAD (2)#define NFS_CONTEXT_UNLOCK (3) +#define NFS_CONTEXT_FILE_OPEN (4)int error;struct list_head list;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 19/28 power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit 073b5d5b1f9cc94a3eea25279fbafee3f4f5f097 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/power/supply/charger-manager.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/charger-manager.c +1 -0
@@ -1470,6 +1470,7 @@ static const struct of_device_id charger_manager_match[] = { }, {}, }; +MODULE_DEVICE_TABLE (of, charger_manager_match);static struct charger_desc *of_cm_parse_desc (struct device *dev) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 20/28 power: supply: ab8500: add missing MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit dfe52db13ab8d24857a9840ec7ca75eef800c26c ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/power/supply/ab8500_btemp.c | 1 + drivers/power/supply/ab8500_charger.c | 1 + drivers/power/supply/ab8500_fg.c | 1 + 3 files changed, 3 insertions(+)
drivers/power/supply/ab8500_btemp.c +1 -0
@@ -1120,6 +1120,7 @@ static const struct of_device_id ab8500_btemp_match[] = { { .compatible = "stericsson,ab8500-btemp", }, { }, }; +MODULE_DEVICE_TABLE (of, ab8500_btemp_match);static struct platform_driver ab8500_btemp_driver = { .probe = ab8500_btemp_probe,
drivers/power/supply/ab8500_charger.c +1 -0
@@ -3633,6 +3633,7 @@ static const struct of_device_id ab8500_charger_match[] = { { .compatible = "stericsson,ab8500-charger", }, { }, }; +MODULE_DEVICE_TABLE (of, ab8500_charger_match);static struct platform_driver ab8500_charger_driver = { .probe = ab8500_charger_probe,
drivers/power/supply/ab8500_fg.c +1 -0
@@ -3230,6 +3230,7 @@ static const struct of_device_id ab8500_fg_match[] = { { .compatible = "stericsson,ab8500-fg", }, { }, }; +MODULE_DEVICE_TABLE (of, ab8500_fg_match);static struct platform_driver ab8500_fg_driver = { .probe = ab8500_fg_probe,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 21/28 pwm: img: Fix PM reference leak in img_pwm_enable()
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit fde25294dfd8e36e4e30b693c27a86232864002a ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/pwm/pwm-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-img.c +1 -1
@@ -156,7 +156,7 @@ static int img_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)struct img_pwm_chip *pwm_chip =to_img_pwm_chip (chip);int ret; - ret =pm_runtime_get_sync (chip->dev); + ret =pm_runtime_resume_and_get (chip->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 22/28 pwm: tegra: Don't modify HW state in .remove callback
In reply to Sasha LevinFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 86f7fa71cd830d18d7ebcaf719dffd5ddfe1acdd ]
A consumer is expected to disable a PWM before calling pwm_put(). And if they didn't there is hopefully a good reason (or the consumer needs fixing). Also if disabling an enabled PWM was the right thing to do, this should better be done in the framework instead of in each low level driver.
So drop the hardware modification from the .remove() callback.
--- drivers/pwm/pwm-tegra.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/pwm/pwm-tegra.c +0 -13
@@ -232,7 +232,6 @@ static int tegra_pwm_probe(struct platform_device *pdev)static int tegra_pwm_remove (struct platform_device *pdev) {struct tegra_pwm_chip *pc =platform_get_drvdata (pdev); -unsigned int i;int err;if (WARN_ON (!pc))
@@ -242,18 +241,6 @@ static int tegra_pwm_remove(struct platform_device *pdev)if (err <0 )return err; -for (i =0 ; i < pc->chip.npwm; i++) { -struct pwm_device *pwm = &pc->chip.pwms[i]; - -if (!pwm_is_enabled (pwm)) -if (clk_prepare_enable (pc->clk) <0 ) -continue ; - -pwm_writel (pc, i,0 ); - -clk_disable_unprepare (pc->clk); - } -reset_control_assert (pc->rst);clk_disable_unprepare (pc->clk);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 23/28 ACPI: AMBA: Fix resource name in /proc/iomem
In reply to Sasha LevinFrom: Liguang Zhang <[email protected]>
[ Upstream commit 7718629432676b5ebd9a32940782fe297a0abf8d ]
In function amba_handler_attach(), dev->res.name is initialized by amba_device_alloc. But when address_found is false, dev->res.name is assigned to null value, which leads to wrong resource name display in /proc/iomem, "<BAD>" is seen for those resources.
--- drivers/acpi/acpi_amba.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/acpi_amba.c +1 -0
@@ -76,6 +76,7 @@ static int amba_handler_attach(struct acpi_device *adev,case IORESOURCE_MEM :if (!address_found) { dev->res = *rentry->res; + dev->res.name =dev_name (&dev->dev); address_found = true; }break ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 24/28 ACPI: video: Add quirk for the Dell Vostro 3350
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 9249c32ec9197e8d34fe5179c9e31668a205db04 ]
The Dell Vostro 3350 ACPI video-bus device reports spurious ACPI_VIDEO_NOTIFY_CYCLE events resulting in spurious KEY_SWITCHVIDEOMODE events being reported to userspace (and causing trouble there).
Add a quirk setting the report_key_events mask to REPORT_BRIGHTNESS_KEY_EVENTS so that the ACPI_VIDEO_NOTIFY_CYCLE events will be ignored, while still reporting brightness up/down hotkey-presses to userspace normally.
--- drivers/acpi/acpi_video.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/acpi/acpi_video.c +9 -0
@@ -543,6 +543,15 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), }, }, + { + .callback = video_set_report_key_events, + .driver_data = (void *)((uintptr_t)REPORT_BRIGHTNESS_KEY_EVENTS), + .ident = "Dell Vostro 3350", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3350"), + }, + },/* * Some machines change the brightness themselves when a brightness * hotkey gets pressed, despite us telling them not to. In this case
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 25/28 virtio-blk: Fix memory leak among suspend/resume procedure
In reply to Sasha LevinFrom: Xie Yongji <[email protected]>
[ Upstream commit b71ba22e7c6c6b279c66f53ee7818709774efa1f ]
The vblk->vqs should be freed before we call init_vqs() in virtblk_restore().
--- drivers/block/virtio_blk.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/virtio_blk.c +2 -0
@@ -1057,6 +1057,8 @@ static int virtblk_freeze(struct virtio_device *vdev)blk_mq_quiesce_queue (vblk->disk->queue); vdev->config->del_vqs (vdev); +kfree (vblk->vqs); +return 0 ; }
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Sasha Levin
maintainerPATCH 26/28 virtio_net: Fix error handling in virtnet_restore()
In reply to Sasha LevinFrom: Xie Yongji <[email protected]>
[ Upstream commit 3f2869cace829fb4b80fc53b3ddaa7f4ba9acbf1 ]
Do some cleanups in virtnet_restore() when virtnet_cpu_notif_add() failed.
--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +4 -1
@@ -3282,8 +3282,11 @@ static __maybe_unused int virtnet_restore(struct virtio_device *vdev)virtnet_set_queues (vi, vi->curr_queue_pairs); err =virtnet_cpu_notif_add (vi); -if (err) +if (err) { +virtnet_freeze_down (vdev); +remove_vq_common (vi);return err; + }return 0 ; }
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Sasha Levin
maintainerPATCH 27/28 virtio_console: Assure used length from device is limited
In reply to Sasha LevinFrom: Xie Yongji <[email protected]>
[ Upstream commit d00d8da5869a2608e97cfede094dfc5e11462a46 ]
The buf->len might come from an untrusted device. This ensures the value would not exceed the size of the buffer to avoid data corruption or loss.
--- drivers/char/virtio_console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/virtio_console.c +2 -2
@@ -475,7 +475,7 @@ static struct port_buffer *get_inbuf(struct port *port) buf =virtqueue_get_buf (port->in_vq, &len);if (buf) { - buf->len = len; + buf->len =min_t (size_t, len, buf->size); buf->offset =0 ; port->stats.bytes_received += len; }
@@ -1714,7 +1714,7 @@ static void control_work_handler(struct work_struct *work)while ((buf =virtqueue_get_buf (vq, &len))) {spin_unlock (&portdev->c_ivq_lock); - buf->len = len; + buf->len =min_t (size_t, len, buf->size); buf->offset =0 ;handle_control_message (vq->vdev, portdev, buf);
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Sasha Levin
maintainerPATCH 28/28 virtio: fix up virtio_disable_cb
In reply to Sasha LevinFrom: "Michael S. Tsirkin" <[email protected]>
[ Upstream commit 8d622d21d24803408b256d96463eac4574dcf067 ]
virtio_disable_cb is currently a nop for split ring with event index. This is because it used to be always called from a callback when we know device won't trigger more events until we update the index. However, now that we run with interrupts enabled a lot we also poll without a callback so that is different: disabling callbacks will help reduce the number of spurious interrupts.
Further, if using event index with a packed ring, and if being called from a callback, we actually do disable interrupts which is unnecessary.
Fix both issues by tracking whenever we get a callback. If that is the case disabling interrupts with event index can be a nop. If not the case disable interrupts. Note: with a split ring there's no explicit "no interrupts" value. For now we write a fixed value so our chance of triggering an interupt is 1/ring size. It's probably better to write something related to the last used index there to reduce the chance even further. For now I'm keeping it simple.
--- drivers/virtio/virtio_ring.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +25 -1
@@ -113,6 +113,9 @@ struct vring_virtqueue {/* Last used index we've seen. */ u16 last_used_idx; +/* Hint for event idx: already triggered no need to disable. */ +bool event_triggered; + union { /* Available for split ring */ struct {
@@ -739,7 +742,10 @@ static void virtqueue_disable_cb_split(struct virtqueue *_vq)if (!(vq->split.avail_flags_shadow &VRING_AVAIL_F_NO_INTERRUPT )) { vq->split.avail_flags_shadow |=VRING_AVAIL_F_NO_INTERRUPT ; -if (!vq->event) +if (vq->event) +/* TODO: this is a hack. Figure out a cleaner value to write. */ +vring_used_event (&vq->split.vring) =0x0 ; +else vq->split.vring.avail->flags =cpu_to_virtio16 (_vq->vdev, vq->split.avail_flags_shadow);
@@ -1605,6 +1611,7 @@ static struct virtqueue *vring_create_virtqueue_packed( vq->weak_barriers = weak_barriers; vq->broken = false; vq->last_used_idx =0 ; + vq->event_triggered = false; vq->num_added =0 ; vq->packed_ring = true; vq->use_dma_api =vring_use_dma_api (vdev);
@@ -1919,6 +1926,12 @@ void virtqueue_disable_cb(struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); +/* If device triggered an event already it won't trigger one again: +* no need to disable. +*/ +if (vq->event_triggered) +return ; +if (vq->packed_ring)virtqueue_disable_cb_packed (_vq);else
@@ -1942,6 +1955,9 @@ unsigned virtqueue_enable_cb_prepare(struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); +if (vq->event_triggered) + vq->event_triggered = false; +return vq->packed_ring ?virtqueue_enable_cb_prepare_packed (_vq) :virtqueue_enable_cb_prepare_split (_vq); }
@@ -2005,6 +2021,9 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); +if (vq->event_triggered) + vq->event_triggered = false; +return vq->packed_ring ?virtqueue_enable_cb_delayed_packed (_vq) :virtqueue_enable_cb_delayed_split (_vq); }
@@ -2044,6 +2063,10 @@ irqreturn_t vring_interrupt(int irq, void *_vq)if (unlikely (vq->broken))return IRQ_HANDLED ; +/* Just a hint for performance: so it's ok that this can be racy! */ +if (vq->event) + vq->event_triggered = true; +pr_debug ("virtqueue callback for %p (%p)\n" , vq, vq->vq.callback);if (vq->vq.callback) vq->vq.callback (&vq->vq);
@@ -2083,6 +2106,7 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, vq->weak_barriers = weak_barriers; vq->broken = false; vq->last_used_idx =0 ; + vq->event_triggered = false; vq->num_added =0 ; vq->use_dma_api =vring_use_dma_api (vdev);#ifdef DEBUG
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerRe: [PATCH AUTOSEL 5.4 28/28] virtio: fix up virtio_disable_cb
Quoted 22 lines · Sasha Levin
From: "Michael S. Tsirkin" <[email protected]>
[ Upstream commit
8d622d21d24803408b256d96463eac4574dcf067]
virtio_disable_cbis currently a nop for split ring with event index. This is because it used to be always called from a callback when we know device won't trigger more events until we update the index. However, now that we run with interrupts enabled a lot we also poll without a callback so that is different: disabling callbacks will help reduce the number of spurious interrupts.
Further, if using event index with a packed ring, and if being called from a callback, we actually do disable interrupts which is unnecessary.Fix both issues by tracking whenever we get a callback. If that is the case disabling interrupts with event index can be a nop. If not the case disable interrupts. Note: with a split ring there's no explicit "no interrupts" value. For now we write a fixed value so our chance of triggering an interupt is 1/ring size. It's probably better to write something related to the last used index there to reduce the chance even further. For now I'm keeping it simple.
Quoted 2 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Signed-off-by Sasha Levin <[email protected]>
I don't think we should have it in stable just yet. Let's make sure it fixes the issue first.
Quoted 92 lines
--- drivers/virtio/virtio_ring.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)drivers/virtio/virtio_ring.c +25
-1@@ -113,6 +113,9 @@ struct vring_virtqueue {/* Last used index we've seen. */ u16 last_used_idx; +/* Hint for event idx: already triggered no need to disable. */ +bool event_triggered; + union { /* Available for split ring */ struct {@@ -739,7 +742,10 @@ static void virtqueue_disable_cb_split(struct virtqueue *_vq)if (!(vq->split.avail_flags_shadow &VRING_AVAIL_F_NO_INTERRUPT )) { vq->split.avail_flags_shadow |=VRING_AVAIL_F_NO_INTERRUPT ; -if (!vq->event) +if (vq->event) +/* TODO: this is a hack. Figure out a cleaner value to write. */ +vring_used_event (&vq->split.vring) =0x0 ; +else vq->split.vring.avail->flags =cpu_to_virtio16 (_vq->vdev, vq->split.avail_flags_shadow);@@ -1605,6 +1611,7 @@ static struct virtqueue *vring_create_virtqueue_packed( vq->weak_barriers = weak_barriers; vq->broken = false; vq->last_used_idx =0 ; + vq->event_triggered = false; vq->num_added =0 ; vq->packed_ring = true; vq->use_dma_api =vring_use_dma_api (vdev);@@ -1919,6 +1926,12 @@ void virtqueue_disable_cb(struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); +/* If device triggered an event already it won't trigger one again: +* no need to disable. +*/ +if (vq->event_triggered) +return ; +if (vq->packed_ring)virtqueue_disable_cb_packed (_vq);else @@ -1942,6 +1955,9 @@ unsigned virtqueue_enable_cb_prepare(struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); +if (vq->event_triggered) + vq->event_triggered = false; +return vq->packed_ring ?virtqueue_enable_cb_prepare_packed (_vq) :virtqueue_enable_cb_prepare_split (_vq); }@@ -2005,6 +2021,9 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); +if (vq->event_triggered) + vq->event_triggered = false; +return vq->packed_ring ?virtqueue_enable_cb_delayed_packed (_vq) :virtqueue_enable_cb_delayed_split (_vq); }@@ -2044,6 +2063,10 @@ irqreturn_t vring_interrupt(int irq, void *_vq)if (unlikely (vq->broken))return IRQ_HANDLED ; +/* Just a hint for performance: so it's ok that this can be racy! */ +if (vq->event) + vq->event_triggered = true; +pr_debug ("virtqueue callback for %p (%p)\n" , vq, vq->vq.callback);if (vq->vq.callback) vq->vq.callback (&vq->vq);@@ -2083,6 +2106,7 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, vq->weak_barriers = weak_barriers; vq->broken = false; vq->last_used_idx =0 ; + vq->event_triggered = false; vq->num_added =0 ; vq->use_dma_api =vring_use_dma_api (vdev);#ifdef DEBUG Signature · 1 line
2.30.2