From: Gabriel Matni <gabriel.matni(a)exfo.com>
Fixes missing characters on kernel console at low baud rates (i.e.9600).
The driver should poll TX_RDY or TX_FIFO_EMP instead of TX_EMP to ensure
that the transmitter holding register (THR) is ready to receive a new byte.
TX_EMP tells us when it is possible to send a break sequence via
SND_BRK_SEQ. While this also indicates that both the THR and the TSR are
empty, it does not guarantee that a new byte can be written just yet.
Fixes: 30530791a7a0 ("serial: mvebu-uart: initial support for Armada-3700 serial port")
Reviewed-by: Miquel Raynal <miquel.raynal(a)bootlin.com>
Acked-by: Gregory CLEMENT <gregory.clement(a)bootlin.com>
Signed-off-by: Gabriel Matni <gabriel.matni(a)exfo.com>
---
Changes since v2:
- use one line for the "Fixes" entry
- removed trailing space between Signed-off-by entry and ---
- start using versioning, previous fixes in v1
Changes since v1:
- patch was corrupt, could not be applied
- fixed line indent
---
drivers/tty/serial/mvebu-uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
index a100e98259d7..f0df0640208e 100644
--- a/drivers/tty/serial/mvebu-uart.c
+++ b/drivers/tty/serial/mvebu-uart.c
@@ -618,7 +618,7 @@ static void wait_for_xmitr(struct uart_port *port)
u32 val;
readl_poll_timeout_atomic(port->membase + UART_STAT, val,
- (val & STAT_TX_EMP), 1, 10000);
+ (val & STAT_TX_RDY(port)), 1, 10000);
}
static void mvebu_uart_console_putchar(struct uart_port *port, int ch)
--
2.7.4
> -----Original Message-----
> From: gregkh(a)linuxfoundation.org <gregkh(a)linuxfoundation.org>
> Sent: March 20, 2018 5:32 AM
> To: Gabriel Matni <gabriel.matni(a)exfo.com>
> Cc: Miquel Raynal <miquel.raynal(a)bootlin.com>; linux-
> serial(a)vger.kernel.org; linux-arm-kernel(a)lists.infradead.org;
> stable(a)vger.kernel.org; Grégory Clement <gregory.clement(a)bootlin.com>;
> Thomas Petazzoni <thomas.petazzoni(a)bootlin.com>
> Subject: Re: [PATCH] serial: mvebu-uart: fix tx lost characters
>
> On Fri, Mar 16, 2018 at 01:45:32PM +0000, Gabriel Matni wrote:
> > From: Gabriel Matni <gabriel.matni(a)exfo.com>
> >
> > Fixes missing characters on kernel console at low baud rates (i.e.9600).
> > The driver should poll TX_RDY or TX_FIFO_EMP instead of TX_EMP to
> ensure
> > that the transmitter holding register (THR) is ready to receive a new byte.
> >
> > TX_EMP tells us when it is possible to send a break sequence via
> > SND_BRK_SEQ. While this also indicates that both the THR and the TSR are
> > empty, it does not guarantee that a new byte can be written just yet.
> >
> > Fixes: 30530791a7a0 ("serial: mvebu-uart: initial support for Armada-3700
> > serial port")
>
> Can all be on one line.
>
> And should this go to the stable trees?
>
> > Reviewed-by: Miquel Raynal <miquel.raynal(a)bootlin.com>
> > Acked-by: Gregory CLEMENT <gregory.clement(a)bootlin.com>
> > Signed-off-by: Gabriel Matni <gabriel.matni(a)exfo.com>
>
> Trailing whitespace?
>
> >
> > ---
> > drivers/tty/serial/mvebu-uart.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> What version of this patch is this? How do I know which to accept?
>
> Please properly version your patch, and include the changes below the
> --- line like the documentation says to do.
>
> thanks,
>
> greg k-h
This is a note to let you know that I've just added the patch titled
scsi: mpt3sas: wait for and flush running commands on shutdown/unload
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scsi-mpt3sas-wait-for-and-flush-running-commands-on-shutdown-unload.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From c666d3be99c000bb889a33353e9be0fa5808d3de Mon Sep 17 00:00:00 2001
From: Sreekanth Reddy <sreekanth.reddy(a)broadcom.com>
Date: Fri, 16 Feb 2018 20:39:58 -0200
Subject: scsi: mpt3sas: wait for and flush running commands on shutdown/unload
From: Sreekanth Reddy <sreekanth.reddy(a)broadcom.com>
commit c666d3be99c000bb889a33353e9be0fa5808d3de upstream.
This patch finishes all outstanding SCSI IO commands (but not other commands,
e.g., task management) in the shutdown and unload paths.
It first waits for the commands to complete (this is done after setting
'ioc->remove_host = 1 ', which prevents new commands to be queued) then it
flushes commands that might still be running.
This avoids triggering error handling (e.g., abort command) for all commands
possibly completed by the adapter after interrupts disabled.
[mauricfo: introduced something in commit message.]
Signed-off-by: Sreekanth Reddy <sreekanth.reddy(a)broadcom.com>
Tested-by: Mauricio Faria de Oliveira <mauricfo(a)linux.vnet.ibm.com>
Signed-off-by: Mauricio Faria de Oliveira <mauricfo(a)linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
[mauricfo: backport to linux-4.14.y (a few updates to context lines)]
Signed-off-by: Mauricio Faria de Oliveira <mauricfo(a)linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 8 ++++----
drivers/scsi/mpt3sas/mpt3sas_base.h | 3 +++
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 10 +++++++++-
3 files changed, 16 insertions(+), 5 deletions(-)
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -5659,14 +5659,14 @@ _base_reset_handler(struct MPT3SAS_ADAPT
}
/**
- * _wait_for_commands_to_complete - reset controller
+ * mpt3sas_wait_for_commands_to_complete - reset controller
* @ioc: Pointer to MPT_ADAPTER structure
*
* This function waiting(3s) for all pending commands to complete
* prior to putting controller in reset.
*/
-static void
-_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
+void
+mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
{
u32 ioc_state;
unsigned long flags;
@@ -5745,7 +5745,7 @@ mpt3sas_base_hard_reset_handler(struct M
is_fault = 1;
}
_base_reset_handler(ioc, MPT3_IOC_PRE_RESET);
- _wait_for_commands_to_complete(ioc);
+ mpt3sas_wait_for_commands_to_complete(ioc);
_base_mask_interrupts(ioc);
r = _base_make_ioc_ready(ioc, type);
if (r)
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1292,6 +1292,9 @@ void mpt3sas_base_update_missing_delay(s
int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc);
+void
+mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc);
+
/* scsih shared API */
u8 mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3960,7 +3960,7 @@ _scsih_flush_running_cmds(struct MPT3SAS
_scsih_set_satl_pending(scmd, false);
mpt3sas_base_free_smid(ioc, smid);
scsi_dma_unmap(scmd);
- if (ioc->pci_error_recovery)
+ if (ioc->pci_error_recovery || ioc->remove_host)
scmd->result = DID_NO_CONNECT << 16;
else
scmd->result = DID_RESET << 16;
@@ -8243,6 +8243,10 @@ static void scsih_remove(struct pci_dev
unsigned long flags;
ioc->remove_host = 1;
+
+ mpt3sas_wait_for_commands_to_complete(ioc);
+ _scsih_flush_running_cmds(ioc);
+
_scsih_fw_event_cleanup_queue(ioc);
spin_lock_irqsave(&ioc->fw_event_lock, flags);
@@ -8313,6 +8317,10 @@ scsih_shutdown(struct pci_dev *pdev)
unsigned long flags;
ioc->remove_host = 1;
+
+ mpt3sas_wait_for_commands_to_complete(ioc);
+ _scsih_flush_running_cmds(ioc);
+
_scsih_fw_event_cleanup_queue(ioc);
spin_lock_irqsave(&ioc->fw_event_lock, flags);
Patches currently in stable-queue which might be from sreekanth.reddy(a)broadcom.com are
queue-4.14/scsi-mpt3sas-wait-for-and-flush-running-commands-on-shutdown-unload.patch
This is a note to let you know that I've just added the patch titled
scsi: mpt3sas: fix oops in error handlers after shutdown/unload
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scsi-mpt3sas-fix-oops-in-error-handlers-after-shutdown-unload.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 9ff549ffb4fb4cc9a4b24d1de9dc3e68287797c4 Mon Sep 17 00:00:00 2001
From: Mauricio Faria de Oliveira <mauricfo(a)linux.vnet.ibm.com>
Date: Fri, 16 Feb 2018 20:39:57 -0200
Subject: scsi: mpt3sas: fix oops in error handlers after shutdown/unload
From: Mauricio Faria de Oliveira <mauricfo(a)linux.vnet.ibm.com>
commit 9ff549ffb4fb4cc9a4b24d1de9dc3e68287797c4 upstream.
This patch adds checks for 'ioc->remove_host' in the SCSI error handlers, so
not to access pointers/resources potentially freed in the PCI shutdown/module
unload path. The error handlers may be invoked after shutdown/unload,
depending on other components.
This problem was observed with kexec on a system with a mpt3sas based adapter
and an infiniband adapter which takes long enough to shutdown:
The mpt3sas driver finished shutting down / disabled interrupt handling, thus
some commands have not finished and timed out.
Since the system was still running (waiting for the infiniband adapter to
shutdown), the scsi error handler for task abort of mpt3sas was invoked, and
hit an oops -- either in scsih_abort() because 'ioc->scsi_lookup' was NULL
without commit dbec4c9040ed ("scsi: mpt3sas: lockless command submission"), or
later up in scsih_host_reset() (with or without that commit), because it
eventually called mpt3sas_base_get_iocstate().
After the above commit, the oops in scsih_abort() does not occur anymore
(_scsih_scsi_lookup_find_by_scmd() is no longer called), but that commit is
too big and out of the scope of linux-stable, where this patch might help, so
still go for the changes.
Also, this might help to prevent similar errors in the future, in case code
changes and possibly tries to access freed stuff.
Note the fix in scsih_host_reset() is still important anyway.
Signed-off-by: Mauricio Faria de Oliveira <mauricfo(a)linux.vnet.ibm.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy(a)broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -2471,7 +2471,8 @@ scsih_abort(struct scsi_cmnd *scmd)
_scsih_tm_display_info(ioc, scmd);
sas_device_priv_data = scmd->device->hostdata;
- if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
+ if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
+ ioc->remove_host) {
sdev_printk(KERN_INFO, scmd->device,
"device been deleted! scmd(%p)\n", scmd);
scmd->result = DID_NO_CONNECT << 16;
@@ -2533,7 +2534,8 @@ scsih_dev_reset(struct scsi_cmnd *scmd)
_scsih_tm_display_info(ioc, scmd);
sas_device_priv_data = scmd->device->hostdata;
- if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
+ if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
+ ioc->remove_host) {
sdev_printk(KERN_INFO, scmd->device,
"device been deleted! scmd(%p)\n", scmd);
scmd->result = DID_NO_CONNECT << 16;
@@ -2595,7 +2597,8 @@ scsih_target_reset(struct scsi_cmnd *scm
_scsih_tm_display_info(ioc, scmd);
sas_device_priv_data = scmd->device->hostdata;
- if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
+ if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
+ ioc->remove_host) {
starget_printk(KERN_INFO, starget, "target been deleted! scmd(%p)\n",
scmd);
scmd->result = DID_NO_CONNECT << 16;
@@ -2652,7 +2655,7 @@ scsih_host_reset(struct scsi_cmnd *scmd)
ioc->name, scmd);
scsi_print_command(scmd);
- if (ioc->is_driver_loading) {
+ if (ioc->is_driver_loading || ioc->remove_host) {
pr_info(MPT3SAS_FMT "Blocking the host reset\n",
ioc->name);
r = FAILED;
Patches currently in stable-queue which might be from mauricfo(a)linux.vnet.ibm.com are
queue-4.14/scsi-mpt3sas-wait-for-and-flush-running-commands-on-shutdown-unload.patch
queue-4.14/scsi-mpt3sas-fix-oops-in-error-handlers-after-shutdown-unload.patch
This is the start of the stable review cycle for the 3.18.101 release.
There are 68 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Wed Mar 21 17:17:59 UTC 2018.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.18.101-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-3.18.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 3.18.101-rc1
Johannes Thumshirn <jthumshirn(a)suse.de>
scsi: sg: only check for dxfer_len greater than 256M
Johannes Thumshirn <jthumshirn(a)suse.de>
scsi: sg: fix static checker warning in sg_is_valid_dxfer
Johannes Thumshirn <jthumshirn(a)suse.de>
scsi: sg: fix SG_DXFER_FROM_DEV transfers
Tejun Heo <tj(a)kernel.org>
fs/aio: Use RCU accessors for kioctx_table->table[]
Tejun Heo <tj(a)kernel.org>
fs/aio: Add explicit RCU grace period when freeing kioctx
Al Viro <viro(a)zeniv.linux.org.uk>
lock_parent() needs to recheck if dentry got __dentry_kill'ed under it
Takashi Iwai <tiwai(a)suse.de>
ALSA: seq: Clear client entry before deleting else at closing
Takashi Iwai <tiwai(a)suse.de>
ALSA: seq: Fix possible UAF in snd_seq_check_queue()
Takashi Iwai <tiwai(a)suse.de>
ALSA: pcm: Fix UAF in snd_pcm_oss_get_formats()
Mimi Zohar <zohar(a)linux.vnet.ibm.com>
ima: relax requiring a file signature for new files with zero length
SeongJae Park <sj38.park(a)gmail.com>
rcutorture/configinit: Fix build directory error message
Dan Carpenter <dan.carpenter(a)oracle.com>
ASoC: nuc900: Fix a loop timeout test
Luca Coelho <luciano.coelho(a)intel.com>
mac80211: remove BUG() when interface type is invalid
Stephen Hemminger <stephen(a)networkplumber.org>
veth: set peer GSO values
Dan Carpenter <dan.carpenter(a)oracle.com>
media: cpia2: Fix a couple off by one bugs
Xose Vazquez Perez <xose.vazquez(a)gmail.com>
scsi: devinfo: apply to HP XP the same flags as Hitachi VSP
Tobias Jordan <Tobias.Jordan(a)elektrobit.com>
spi: sun6i: disable/unprepare clocks on remove
Julien BOIBESSOT <julien.boibessot(a)armadeus.com>
tools/usbip: fixes build with musl libc toolchain
Jagdish Gediya <jagdish.gediya(a)nxp.com>
mtd: nand: ifc: update bufnum mask for ver >= 2.0.0
Andrew F. Davis <afd(a)ti.com>
ARM: dts: omap3-n900: Fix the audio CODEC's reset pin
Andrew F. Davis <afd(a)ti.com>
ARM: dts: am335x-pepper: Fix the audio CODEC's reset pin
Miquel Raynal <miquel.raynal(a)free-electrons.com>
mtd: nand: fix interpretation of NAND_CMD_NONE in nand_command[_lp]()
Lorenzo Colitti <lorenzo(a)google.com>
net: xfrm: allow clearing socket xfrm policies.
Paul E. McKenney <paulmck(a)linux.vnet.ibm.com>
sched: Stop resched_cpu() from sending IPIs to offline CPUs
Jiri Kosina <jkosina(a)suse.cz>
HID: elo: clear BTN_LEFT mapping
Dedy Lansky <qca_dlansky(a)qca.qualcomm.com>
wil6210: fix memory access violation in wil_memcpy_from/toio_32
Masami Hiramatsu <mhiramat(a)kernel.org>
kprobes/x86: Set kprobes pages read-only
Masami Hiramatsu <mhiramat(a)kernel.org>
kprobes/x86: Fix kprobe-booster not to boost far call instructions
Hannes Reinecke <hare(a)suse.de>
scsi: sg: close race condition in sg_remove_sfp_usercontext()
Johannes Thumshirn <jthumshirn(a)suse.de>
scsi: sg: check for valid direction before starting the request
David Carrillo-Cisneros <davidcc(a)google.com>
perf session: Don't rely on evlist in pipe mode
David Carrillo-Cisneros <davidcc(a)google.com>
perf inject: Copy events when reordering events in pipe mode
Yuyang Du <yuyang.du(a)intel.com>
usb: gadget: dummy_hcd: Fix wrong power status bit clear/reset in dummy_hub_control()
Vincent Stehlé <vincent.stehle(a)laposte.net>
regulator: isl9305: fix array size
David Daney <david.daney(a)cavium.com>
MIPS: BPF: Quit clobbering callee saved registers in JIT code.
Christopher James Halse Rogers <christopher.halse.rogers(a)canonical.com>
drm/radeon: Fail fb creation from imported dma-bufs.
Liam Beguin <lbeguin(a)tycoint.com>
video: ARM CLCD: fix dma allocation size
Nate Watterson <nwatters(a)codeaurora.org>
iommu/iova: Fix underflow bug in __alloc_and_insert_iova_range
John Johansen <john.johansen(a)canonical.com>
apparmor: Make path_max parameter readonly
Phil Turnbull <phil.turnbull(a)oracle.com>
fm10k: correctly check if interface is removed
Jan Kara <jack(a)suse.cz>
reiserfs: Make cancel_old_flush() reliable
Andrew Lunn <andrew(a)lunn.ch>
net/faraday: Add missing include of of.h
Anton Blanchard <anton(a)samba.org>
powerpc: Avoid taking a data miss on every userspace instruction miss
Geert Uytterhoeven <geert+renesas(a)glider.be>
ARM: dts: r8a7791: Correct parent of SSI[0-9] clocks
Geert Uytterhoeven <geert+renesas(a)glider.be>
ARM: dts: r8a7790: Correct parent of SSI[0-9] clocks
Samuel Thibault <samuel.thibault(a)ens-lyon.org>
braille-console: Fix value returned by _braille_console_setup
Roger Quadros <rogerq(a)ti.com>
ARM: DRA7: hwmod_data: Prevent wait_target_disable error for usb_otg_ss
Shaohua Li <shli(a)fb.com>
blk-throttle: make sure expire time isn't too big
Kirill A. Shutemov <kirill.shutemov(a)linux.intel.com>
mm: Fix false-positive VM_BUG_ON() in page_cache_{get,add}_speculative()
Gao Feng <fgao(a)ikuai8.com>
tcp: sysctl: Fix a race to avoid unexpected 0 window from space
Akinobu Mita <akinobu.mita(a)gmail.com>
spi: omap2-mcspi: poll OMAP2_MCSPI_CHSTAT_RXS for PIO transfer
Davide Caratti <dcaratti(a)redhat.com>
sched: act_csum: don't mangle TCP and UDP GSO packets
David Engraf <david.engraf(a)sysgo.com>
timers, sched_clock: Update timeout for clock wrap
Janusz Krzysztofik <jmkrzyszt(a)gmail.com>
media: i2c/soc_camera: fix ov6650 sensor getting wrong clock
Brian King <brking(a)linux.vnet.ibm.com>
scsi: ipr: Fix missed EH wakeup
Rob Herring <robh(a)kernel.org>
of: fix of_device_get_modalias returned length when truncating buffers
Andreas Pape <APape(a)phoenixcontact.com>
batman-adv: handle race condition for claims between gateways
Linus Walleij <linus.walleij(a)linaro.org>
ARM: dts: Adjust moxart IRQ controller and flags
Tomasz Kramkowski <tk(a)the-tk.com>
HID: clamp input to logical range if no null state
Mohammed Shafi Shajakhan <mohammed(a)qti.qualcomm.com>
ath10k: disallow DFS simulation if DFS channel is not enabled
Chris Wilson <chris(a)chris-wilson.co.uk>
drm: Defer disabling the vblank IRQ until the next interrupt (for instant-off)
Quan Nguyen <qnguyen(a)apm.com>
drivers: net: xgene: Fix hardware checksum setting
Stephane Eranian <eranian(a)google.com>
perf tools: Make perf_event__synthesize_mmap_events() scale
Alexander Potapenko <glider(a)google.com>
selinux: check for address length in selinux_socket_bind()
Prarit Bhargava <prarit(a)redhat.com>
PCI/MSI: Stop disabling MSI/MSI-X in pci_device_shutdown()
Thomas Petazzoni <thomas.petazzoni(a)free-electrons.com>
net: mvpp2: set dma mask and coherent dma mask on PPv2.2
Valtteri Heikkilä <rnd(a)nic.fi>
HID: reject input outside logical range only if null state is set
H. Nikolaus Schaller <hns(a)goldelico.com>
Input: tsc2007 - check for presence and power down tsc2007 during probe
-------------
Diffstat:
Makefile | 4 +--
arch/arm/boot/dts/am335x-pepper.dts | 2 +-
arch/arm/boot/dts/moxart-uc7112lx.dts | 2 +-
arch/arm/boot/dts/moxart.dtsi | 17 ++++-----
arch/arm/boot/dts/omap3-n900.dts | 4 +--
arch/arm/boot/dts/r8a7790.dtsi | 7 ++--
arch/arm/boot/dts/r8a7791.dtsi | 7 ++--
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 2 ++
arch/mips/net/bpf_jit.c | 16 ++++++---
arch/powerpc/mm/fault.c | 2 +-
arch/x86/kernel/kprobes/core.c | 6 ++++
arch/x86/kernel/kprobes/opt.c | 3 ++
block/blk-throttle.c | 11 ++++++
drivers/gpu/drm/drm_irq.c | 14 ++++++--
drivers/gpu/drm/radeon/radeon_display.c | 6 ++++
drivers/hid/hid-elo.c | 6 ++++
drivers/hid/hid-input.c | 20 +++++++----
drivers/input/touchscreen/tsc2007.c | 8 +++++
drivers/iommu/iova.c | 2 +-
drivers/media/i2c/soc_camera/ov6650.c | 2 +-
drivers/media/usb/cpia2/cpia2_v4l.c | 4 +--
drivers/mtd/nand/fsl_ifc_nand.c | 7 ++++
drivers/mtd/nand/nand_base.c | 9 +++--
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 1 +
drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | 1 +
drivers/net/ethernet/faraday/ftgmac100.c | 1 +
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 2 +-
drivers/net/ethernet/marvell/mvpp2.c | 14 ++++++++
drivers/net/veth.c | 3 ++
drivers/net/wireless/ath/ath10k/debug.c | 9 +++++
drivers/net/wireless/ath/wil6210/main.c | 20 +++++++++--
drivers/of/device.c | 2 +-
drivers/pci/pci-driver.c | 2 --
drivers/scsi/ipr.c | 16 ++++++---
drivers/scsi/scsi_devinfo.c | 2 +-
drivers/scsi/sg.c | 36 +++++++++++--------
drivers/spi/spi-omap2-mcspi.c | 9 ++---
drivers/spi/spi-sun6i.c | 2 +-
drivers/usb/gadget/udc/dummy_hcd.c | 20 +++++------
drivers/video/fbdev/amba-clcd.c | 4 +--
fs/aio.c | 42 +++++++++++++++-------
fs/dcache.c | 11 ++++--
fs/reiserfs/journal.c | 2 +-
fs/reiserfs/reiserfs.h | 1 +
fs/reiserfs/super.c | 21 +++++++----
include/linux/pagemap.h | 4 +--
include/linux/platform_data/isl9305.h | 2 +-
include/net/tcp.h | 8 +++--
kernel/printk/braille.c | 15 ++++----
kernel/printk/braille.h | 13 +++++--
kernel/sched/core.c | 3 +-
kernel/time/sched_clock.c | 5 +++
net/batman-adv/bridge_loop_avoidance.c | 20 ++++++++---
net/mac80211/iface.c | 2 +-
net/sched/act_csum.c | 12 +++++++
net/xfrm/xfrm_policy.c | 2 +-
net/xfrm/xfrm_state.c | 7 ++++
security/apparmor/lsm.c | 2 +-
security/integrity/ima/ima_appraise.c | 3 +-
security/selinux/hooks.c | 8 +++++
sound/core/oss/pcm_oss.c | 10 +++---
sound/core/seq/seq_clientmgr.c | 4 +--
sound/core/seq/seq_prioq.c | 28 +++++++--------
sound/core/seq/seq_prioq.h | 6 ++--
sound/core/seq/seq_queue.c | 28 +++++----------
sound/soc/nuc900/nuc900-ac97.c | 4 +--
tools/perf/util/event.c | 4 +--
tools/perf/util/ordered-events.c | 3 +-
tools/perf/util/session.c | 17 +++++++--
.../testing/selftests/rcutorture/bin/configinit.sh | 2 +-
tools/usb/usbip/src/usbipd.c | 2 +-
71 files changed, 413 insertions(+), 183 deletions(-)
-Stephen Warren
+Stefan Wahren
On Fri, 09 Feb 2018 09:32:40 +0000
Eric Anholt <eric(a)anholt.net> wrote:
> Boris Brezillon <boris.brezillon(a)bootlin.com> writes:
>
> > On Thu, 08 Feb 2018 15:20:16 +0000
> > Eric Anholt <eric(a)anholt.net> wrote:
> >
> >> Boris Brezillon <boris.brezillon(a)bootlin.com> writes:
> >>
> >> > All bcm2835 PLLs should be gated before their rate can be changed.
> >> > Setting CLK_SET_RATE_GATE will let the core enforce that, but this is
> >> > not enough to make the code work in all situations. Indeed, the
> >> > CLK_SET_RATE_GATE flag prevents a user from changing the rate while
> >> > the clock is enabled, but this check only guarantees there's no Linux
> >> > users. In our case, the clock might have been enabled by the
> >> > bootloader/FW, and, because we have CLK_IGNORE_UNUSED set, Linux never
> >> > disables the PLL. So we have to make sure the PLL is actually disabled
> >> > before changing the rate.
> >> >
> >> > Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks")
> >> > Cc: <stable(a)vger.kernel.org>
> >> > Signed-off-by: Boris Brezillon <boris.brezillon(a)bootlin.com>
> >> > ---
> >> > drivers/clk/bcm/clk-bcm2835.c | 14 +++++++++++++-
> >> > 1 file changed, 13 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
> >> > index 6c5d4a8e426c..051ce769c109 100644
> >> > --- a/drivers/clk/bcm/clk-bcm2835.c
> >> > +++ b/drivers/clk/bcm/clk-bcm2835.c
> >> > @@ -678,6 +678,18 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
> >> > u32 ana[4];
> >> > int i;
> >> >
> >> > + /*
> >> > + * Normally, the CLK_SET_RATE_GATE flag prevents a user from changing
> >> > + * the rate while the clock is enabled, but this check only makes sure
> >> > + * there's no Linux users.
> >> > + * In our case, the clock might have been enabled by the bootloader/FW,
> >> > + * and, since CLK_IGNORE_UNUSED flag is set, Linux never disables it.
> >> > + * So we have to make sure the clk is actually disabled before changing
> >> > + * the rate.
> >> > + */
> >> > + if (bcm2835_pll_is_on(hw))
> >> > + bcm2835_pll_off(hw);
> >> > +
> >>
> >> I'm not sure this improves the situation. If the PLL was on, then
> >> presumably there's a divider using it and a CM clock using that, so
> >> we'll probably end up driving some glitches on them.
> >
> > Hm, yes, but if someone is trying to change the rate of the PLL, and the
> > core doesn't know other clks depend on this PLL (which is the case if
> > we reach this point), we're already in big trouble.
> >
> >>
> >> Does the common clk framework have a way to disable unused clocks from
> >> the leaf clocks up to this root, before the general
> >> disable-unused-clocks path happens late in the boot process?
> >
> > Not that I know of. What do you have in mind?
>
> I was hoping that Stephen Boyd or Mike might have an answer for this
> problem.
Having a generic solution for this sort of issue is definitely the
way to go, but I think this temporary hack is needed to make HDMI/SDTV
work properly. If we don't have it and the FW configures and enables
PLLH with a rate that is different from the one the HDMI or SDTV
encoder tries to set, we're screwed, because I doubt the CPRMAN block
allows you to change the rate of the PLL when it's not gated. Which
means the new rate is not applied and the clk user has no way of
knowing that, which in turn means the display output is likely to not
work properly the first time it's enabled.
Of course, this all goes away the second time the HDMI/SDTV encoder is
enabled, because then clk_disable_unprepare() is called which has the
effect of disabling the PLL.
--
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
commit 9ff549ffb4fb4cc9a4b24d1de9dc3e68287797c4 upstream.
This patch adds checks for 'ioc->remove_host' in the SCSI error handlers, so
not to access pointers/resources potentially freed in the PCI shutdown/module
unload path. The error handlers may be invoked after shutdown/unload,
depending on other components.
This problem was observed with kexec on a system with a mpt3sas based adapter
and an infiniband adapter which takes long enough to shutdown:
The mpt3sas driver finished shutting down / disabled interrupt handling, thus
some commands have not finished and timed out.
Since the system was still running (waiting for the infiniband adapter to
shutdown), the scsi error handler for task abort of mpt3sas was invoked, and
hit an oops -- either in scsih_abort() because 'ioc->scsi_lookup' was NULL
without commit dbec4c9040ed ("scsi: mpt3sas: lockless command submission"), or
later up in scsih_host_reset() (with or without that commit), because it
eventually called mpt3sas_base_get_iocstate().
After the above commit, the oops in scsih_abort() does not occur anymore
(_scsih_scsi_lookup_find_by_scmd() is no longer called), but that commit is
too big and out of the scope of linux-stable, where this patch might help, so
still go for the changes.
Also, this might help to prevent similar errors in the future, in case code
changes and possibly tries to access freed stuff.
Note the fix in scsih_host_reset() is still important anyway.
Signed-off-by: Mauricio Faria de Oliveira <mauricfo(a)linux.vnet.ibm.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy(a)broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
---
v3: fix domain in email addresses, rebase on top of 4.14.29.
v2: fix line number in hunk 1
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 33ff691..61a780f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -2471,7 +2471,8 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,
_scsih_tm_display_info(ioc, scmd);
sas_device_priv_data = scmd->device->hostdata;
- if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
+ if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
+ ioc->remove_host) {
sdev_printk(KERN_INFO, scmd->device,
"device been deleted! scmd(%p)\n", scmd);
scmd->result = DID_NO_CONNECT << 16;
@@ -2533,7 +2534,8 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,
_scsih_tm_display_info(ioc, scmd);
sas_device_priv_data = scmd->device->hostdata;
- if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
+ if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
+ ioc->remove_host) {
sdev_printk(KERN_INFO, scmd->device,
"device been deleted! scmd(%p)\n", scmd);
scmd->result = DID_NO_CONNECT << 16;
@@ -2595,7 +2597,8 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,
_scsih_tm_display_info(ioc, scmd);
sas_device_priv_data = scmd->device->hostdata;
- if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
+ if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
+ ioc->remove_host) {
starget_printk(KERN_INFO, starget, "target been deleted! scmd(%p)\n",
scmd);
scmd->result = DID_NO_CONNECT << 16;
@@ -2652,7 +2655,7 @@ int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,
ioc->name, scmd);
scsi_print_command(scmd);
- if (ioc->is_driver_loading) {
+ if (ioc->is_driver_loading || ioc->remove_host) {
pr_info(MPT3SAS_FMT "Blocking the host reset\n",
ioc->name);
r = FAILED;
--
1.8.3.1
The ext4 forced shutdown flag needs to prevent new handles from being
started, but it needs to allow existing handles to complete. So the
forced shutdown flag should not force ext4_journal_get_write_access to
fail.
Signed-off-by: Theodore Ts'o <tytso(a)mit.edu>
Cc: stable(a)vger.kernel.org
---
fs/ext4/ext4_jbd2.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 2d593201cf7a..7c70b08d104c 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -166,13 +166,6 @@ int __ext4_journal_get_write_access(const char *where, unsigned int line,
might_sleep();
if (ext4_handle_valid(handle)) {
- struct super_block *sb;
-
- sb = handle->h_transaction->t_journal->j_private;
- if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) {
- jbd2_journal_abort_handle(handle);
- return -EIO;
- }
err = jbd2_journal_get_write_access(handle, bh);
if (err)
ext4_journal_abort_handle(where, line, __func__, bh,
--
2.16.1.72.g5be1f00a9a