diff mbox

Revert "serial: amba-pl011: fix incorrect integer size in pl011_fifo_to_tty()"

Message ID 1445594400-29095-1-git-send-email-shijie.huang@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Huang Shijie Oct. 23, 2015, 10 a.m. UTC
The commit 71a5cd8a4 makes the console hang for some times.
This reverts commit 71a5cd8a4a2602a6e9010b557a23af0a54df87b6.

Signed-off-by: Huang Shijie <shijie.huang@arm.com>
---
 drivers/tty/serial/amba-pl011.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dave Martin Oct. 23, 2015, 10:31 a.m. UTC | #1
On Fri, Oct 23, 2015 at 06:00:00PM +0800, Huang Shijie wrote:
> The commit 71a5cd8a4 makes the console hang for some times.
> This reverts commit 71a5cd8a4a2602a6e9010b557a23af0a54df87b6.

What hangs?  Input?  Output?  Both?

Is CREAD set on the terminal?  If only input hangs, it's possible CREAD
is not set and we were previously getting away with it, though I can't
easily see why it should be unset...

Cheers
---Dave

> 
> Signed-off-by: Huang Shijie <shijie.huang@arm.com>
> ---
>  drivers/tty/serial/amba-pl011.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 899a771..fd27e98 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -191,8 +191,8 @@ struct uart_amba_port {
>   */
>  static int pl011_fifo_to_tty(struct uart_amba_port *uap)
>  {
> -	u16 status;
> -	unsigned int ch, flag, max_count = 256;
> +	u16 status, ch;
> +	unsigned int flag, max_count = 256;
>  	int fifotaken = 0;
>  
>  	while (max_count--) {
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Timur Tabi Oct. 23, 2015, 12:35 p.m. UTC | #2
Dave Martin wrote:
>> >The commit 71a5cd8a4 makes the console hang for some times.
>> >This reverts commit 71a5cd8a4a2602a6e9010b557a23af0a54df87b6.
> What hangs?  Input?  Output?  Both?
>
> Is CREAD set on the terminal?  If only input hangs, it's possible CREAD
> is not set and we were previously getting away with it, though I can't
> easily see why it should be unset...

Dave is right, the revert doesn't make any sense. Huang has a user-space 
bug.  Please check to see if CREAD is set.  I'm pretty sure it isn't.
Dave Martin Oct. 23, 2015, 1:34 p.m. UTC | #3
On Fri, Oct 23, 2015 at 07:35:06AM -0500, Timur Tabi wrote:
> Dave Martin wrote:
> >>>The commit 71a5cd8a4 makes the console hang for some times.
> >>>This reverts commit 71a5cd8a4a2602a6e9010b557a23af0a54df87b6.
> >What hangs?  Input?  Output?  Both?
> >
> >Is CREAD set on the terminal?  If only input hangs, it's possible CREAD
> >is not set and we were previously getting away with it, though I can't
> >easily see why it should be unset...
> 
> Dave is right, the revert doesn't make any sense. Huang has a
> user-space bug.  Please check to see if CREAD is set.  I'm pretty
> sure it isn't.

Well, I'm not saying there's definitely no kernel bug, but I can't see
how the patch should cause it.  It may be triggering a latent bug
somewhere else in the driver than hasn't been biting us before, however.

!CREAD is the most obvious cause, so that should definitely be ruled
out first.  If CREAD is clear, we need to figure out why...

Cheers
---Dave
Timur Tabi Oct. 23, 2015, 3:37 p.m. UTC | #4
On 10/23/2015 08:34 AM, Dave P Martin wrote:
> Well, I'm not saying there's definitely no kernel bug, but I can't see
> how the patch should cause it.  It may be triggering a latent bug
> somewhere else in the driver than hasn't been biting us before, however.

Fair enough.

> !CREAD is the most obvious cause, so that should definitely be ruled
> out first.  If CREAD is clear, we need to figure out why...

So I tested this by booting to my console, and then typing in:

	stty -cread

and when I did that, the console ignored all input.

I do admit that since !CREAD has been ignored for so many reason, it 
could be that a lot of userspaces will suddenly have broken consoles.
Dave Martin Oct. 23, 2015, 4:02 p.m. UTC | #5
On Fri, Oct 23, 2015 at 10:37:49AM -0500, Timur Tabi wrote:
> On 10/23/2015 08:34 AM, Dave P Martin wrote:
> >Well, I'm not saying there's definitely no kernel bug, but I can't see
> >how the patch should cause it.  It may be triggering a latent bug
> >somewhere else in the driver than hasn't been biting us before, however.
> 
> Fair enough.
> 
> >!CREAD is the most obvious cause, so that should definitely be ruled
> >out first.  If CREAD is clear, we need to figure out why...
> 
> So I tested this by booting to my console, and then typing in:
> 
> 	stty -cread
> 
> and when I did that, the console ignored all input.
> 
> I do admit that since !CREAD has been ignored for so many reason, it
> could be that a lot of userspaces will suddenly have broken
> consoles.

I'm pretty sure CREAD should default to enabled[1], and that usually
software won't modify it.

Assuming that this is indeed the problem, it's possible that another bug
in the pl011 driver is wrongly clearing this flag.  Sadly I don't have
time to look at the code again just now ... :(

Could be interesting to stick some BUG_ON(!CREAD) in the driver to
try and track down where that's coming from.

Cheers
---Dave

[1] See serial_core.c:uart_register_driver(),
        serial_core.c:uart_set_options().
Timur Tabi Oct. 23, 2015, 4:38 p.m. UTC | #6
On 10/23/2015 11:02 AM, Dave P Martin wrote:
> I'm pretty sure CREAD should default to enabled[1], and that usually
> software won't modify it.
>
> Assuming that this is indeed the problem, it's possible that another bug
> in the pl011 driver is wrongly clearing this flag.  Sadly I don't have
> time to look at the code again just now ...:(

Perhaps, but !CREAD is definitely broken without this patch.  So if the 
driver really is clearing CREAD somewhere else, then that's where the 
real bug is.

>
> Could be interesting to stick some BUG_ON(!CREAD) in the driver to
> try and track down where that's coming from.

CREAD is disabled by default when opening the console.  You need to 
explicitly set it in the termios structure.  I can easily believe that 
Huang's rootfs is just forgetting to set that bit because for the last 
five years, it didn't matter.

Huang,

In the beginning of pl011_set_termios() and sbsa_uart_set_termios(), 
please add this code:

	BUG_ON(!(termios->c_cflag & CREAD));
Peter Hurley Oct. 23, 2015, 5:49 p.m. UTC | #7
On 10/23/2015 12:38 PM, Timur Tabi wrote:
> On 10/23/2015 11:02 AM, Dave P Martin wrote:
>> I'm pretty sure CREAD should default to enabled[1], and that usually
>> software won't modify it.
>>
>> Assuming that this is indeed the problem, it's possible that another bug
>> in the pl011 driver is wrongly clearing this flag.  Sadly I don't have
>> time to look at the code again just now ...:(
> 
> Perhaps, but !CREAD is definitely broken without this patch.  So if the driver really is clearing CREAD somewhere else, then that's where the real bug is.
> 
>>
>> Could be interesting to stick some BUG_ON(!CREAD) in the driver to
>> try and track down where that's coming from.
> 
> CREAD is disabled by default when opening the console.  You need to explicitly set it in the termios structure.

No; the initial termios structure for all serial core-based drivers has
CREAD set:

pl011_probe
   pl011_register_port
      uart_register_driver
         ...
         normal->init_termios.c_cflag = .... | CREAD | ....;

Regards,
Peter Hurley
Huang Shijie Oct. 26, 2015, 1:58 a.m. UTC | #8
The 10/23/2015 11:38, Timur Tabi wrote:
> On 10/23/2015 11:02 AM, Dave P Martin wrote:
> >I'm pretty sure CREAD should default to enabled[1], and that usually
> >software won't modify it.
> >
> >Assuming that this is indeed the problem, it's possible that another bug
> >in the pl011 driver is wrongly clearing this flag.  Sadly I don't have
> >time to look at the code again just now ...:(
>
> Perhaps, but !CREAD is definitely broken without this patch.  So if the
> driver really is clearing CREAD somewhere else, then that's where the real
> bug is.
>
> >
> >Could be interesting to stick some BUG_ON(!CREAD) in the driver to
> >try and track down where that's coming from.
>
> CREAD is disabled by default when opening the console.  You need to
> explicitly set it in the termios structure.  I can easily believe that
> Huang's rootfs is just forgetting to set that bit because for the last five
> years, it didn't matter.
>
> Huang,
>
> In the beginning of pl011_set_termios() and sbsa_uart_set_termios(), please
> add this code:
>
>       BUG_ON(!(termios->c_cflag & CREAD));
>
I added this code to pl011_set_termios() and sbsa_uart_set_termios().
But My console still hang at the login step.

I login in the board with ssh (the network is okay), the following is the kernel log:

 ======================================================================================
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpu
Linux version 4.3.0-rc6-next-20151022-00001-gc3cd913 (root@Huang.Shijie) (gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11) ) #48 SMP PREEMPT Mon Oct 26 09:41:33 CST 2015
Boot CPU: AArch64 Processor [411fd071]
earlycon: Early serial console at MMIO 0x7ff80000 (options '')
bootconsole [uart0] enabled
efi: Getting EFI parameters from FDT:
EFI v2.40 by ARM Juno EFI Mar 17 2015 15:42:19
efi:  ACPI=0xfebae000  ACPI 2.0=0xfebae014
cma: Reserved 16 MiB at 0x00000000fd800000
On node 0 totalpages: 2092816
  DMA zone: 8192 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 519952 pages, LIFO batch:31
  Normal zone: 24576 pages used for memmap
  Normal zone: 1572864 pages, LIFO batch:31
psci: probing for conduit method from DT.
psci: PSCIv1.0 detected in firmware.
psci: Using standard PSCI v0.2 function IDs
psci: Trusted OS migration not required
PERCPU: Embedded 15 pages/cpu @ffffffc97fedb000 s24000 r8192 d29248 u61440
pcpu-alloc: s24000 r8192 d29248 u61440 alloc=15*4096
pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [0] 4 [0] 5
Detected PIPT I-cache on CPU0
CPU features: enabling workaround for ARM erratum 832075
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 2060048
Kernel command line: console=ttyAMA0,115200 earlycon=pl011,0x7ff80000 root=/dev/sda1 rootwait verbose debug sky2.mac_address=0x00,0x02,0xF7,0x00,0x63,0x3C  debug_pagealloc=on
log_buf_len individual max cpu contribution: 4096 bytes
log_buf_len total cpu_extra contributions: 20480 bytes
log_buf_len min size: 16384 bytes
log_buf_len: 65536 bytes
early log buf free: 14288(87%)
PID hash table entries: 4096 (order: 3, 32768 bytes)
Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
software IO TLB [mem 0xf9800000-0xfd800000] (64MB) mapped at [ffffffc079800000-ffffffc07d7fffff]
Memory: 8134528K/8371264K available (5638K kernel code, 537K rwdata, 2440K rodata, 544K init, 213K bss, 220352K reserved, 16384K cma-reserved)
Virtual kernel memory layout:
    vmalloc : 0xffffff8000000000 - 0xffffffbdbfff0000   (   246 GB)
    vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
              0xffffffbdc2000000 - 0xffffffbde8000000   (   608 MB actual)
    fixed   : 0xffffffbffa7fd000 - 0xffffffbffac00000   (  4108 KB)
    PCI I/O : 0xffffffbffae00000 - 0xffffffbffbe00000   (    16 MB)
    modules : 0xffffffbffc000000 - 0xffffffc000000000   (    64 MB)
    memory  : 0xffffffc000000000 - 0xffffffc980000000   ( 38912 MB)
      .init : 0xffffffc000866000 - 0xffffffc0008ee000   (   544 KB)
      .text : 0xffffffc000080000 - 0xffffffc0008659e4   (  8087 KB)
      .data : 0xffffffc0008ff000 - 0xffffffc000985600   (   538 KB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=6, Nodes=1
Preemptible hierarchical RCU implementation.
        Build-time adjustment of leaf fanout to 64.
        RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=6.
RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=6
NR_IRQS:64 nr_irqs:64 0
GIC: Using split EOI/Deactivate mode
GICv2m: Node v2m: range[0x2c1c0000:0x2c1c0fff], SPI[224:256]
Architected cp15 and mmio timer(s) running at 50.00MHz (phys/phys).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xb8812736b, max_idle_ns: 440795202655 ns
sched_clock: 56 bits at 50MHz, resolution 20ns, wraps every 4398046511100ns
Console: colour dummy device 80x25
allocated 16777216 bytes of page_ext
Calibrating delay loop (skipped), value calculated using timer frequency.. 100.00 BogoMIPS (lpj=500000)
pid_max: default: 32768 minimum: 301
Security Framework initialized
Mount-cache hash table entries: 16384 (order: 5, 131072 bytes)
Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes)
Initializing cgroup subsys memory
Initializing cgroup subsys hugetlb
Remapping and enabling EFI services.
  EFI remap 0x0000000008000000 => 0000000040000000
  EFI remap 0x000000001c170000 => 0000000044000000
  EFI remap 0x00000009faf6f000 => 000000004401f000
  EFI remap 0x00000009fff6e000 => 000000004406e000
  EFI remap 0x00000009fffaf000 => 00000000440af000
ASID allocator initialised with 65536 entries
Detected PIPT I-cache on CPU1
CPU1: Booted secondary processor [411fd071]
Detected VIPT I-cache on CPU2
CPU features: enabling workaround for ARM erratum 845719
CPU2: Booted secondary processor [410fd033]
Detected VIPT I-cache on CPU3
CPU3: Booted secondary processor [410fd033]
Detected VIPT I-cache on CPU4
CPU4: Booted secondary processor [410fd033]
Detected VIPT I-cache on CPU5
CPU5: Booted secondary processor [410fd033]
Brought up 6 CPUs
SMP: Total of 6 processors activated.
CPU: All CPU(s) started at EL2
alternatives: patching kernel code
devtmpfs: initialized
DMI not present or invalid.
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
cpuidle: using governor ladder
cpuidle: using governor menu
vdso: 2 pages (1 code @ ffffffc000905000, 1 data @ ffffffc000904000)
hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
DMA: preallocated 256 KiB pool for atomic allocations
Serial: AMBA PL011 UART driver
vgaarb: loaded
SCSI subsystem initialized
libata version 3.00 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
dmi: Firmware registration failed.
clocksource: Switched to clocksource arch_sys_counter
NET: Registered protocol family 2
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
UDP hash table entries: 4096 (order: 5, 131072 bytes)
UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 64
kvm [1]: interrupt-controller@2c04f000 IRQ14
kvm [1]: timer IRQ4
kvm [1]: Hyp mode initialized successfully
futex hash table entries: 2048 (order: 5, 131072 bytes)
audit: initializing netlink subsys (disabled)
audit: type=2000 audit(0.570:1): initialized
HugeTLB registered 2 MB page size, pre-allocated 0 pages
VFS: Disk quotas dquot_6.6.0
VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
fuse init (API version 7.23)
9p: Installing v9fs 9p2000 file system support
io scheduler noop registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
msm_serial: driver initialized
loop: module loaded
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
sky2: driver version 1.30
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
ehci-platform: EHCI generic platform driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-pci: OHCI PCI platform driver
ohci-platform: OHCI generic platform driver
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
rtc-efi rtc-efi: rtc core: registered rtc-efi as rtc0
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
Synopsys Designware Multimedia Card Interface Driver
sdhci-pltfm: SDHCI platform and OF driver helper
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
NET: Registered protocol family 17
9pnet: Installing 9P2000 support
Key type dns_resolver registered
bootconsole [uart0] disabled
registered taskstats version 1
7ff80000.uart: ttyAMA0 at MMIO 0x7ff80000 (irq = 23, base_baud = 0) is a PL011 rev3
console [ttyAMA0] enabled
hw perfevents: enabled with armv8_cortex_a57 PMU driver, 7 counters available
hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
pl061_gpio 1c1d0000.gpio: PL061 GPIO chip @0x000000001c1d0000 registered
libphy: smsc911x-mdio: probed
smsc911x 18000000.ethernet eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=18000000.etherne:01, irq=-1)
smsc911x 18000000.ethernet eth0: MAC Address: 00:02:f7:00:63:3b
ehci-platform 7ffc0000.ehci: EHCI Host Controller
ehci-platform 7ffc0000.ehci: new USB bus registered, assigned bus number 1
ehci-platform 7ffc0000.ehci: irq 26, io mem 0x7ffc0000
ehci-platform 7ffc0000.ehci: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ohci-platform 7ffb0000.ohci: Generic Platform OHCI controller
ohci-platform 7ffb0000.ohci: new USB bus registered, assigned bus number 2
ohci-platform 7ffb0000.ohci: irq 25, io mem 0x7ffb0000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
mmci-pl18x 1c050000.mmci: No vqmmc regulator found
mmci-pl18x 1c050000.mmci: mmc0: PL180 manf 41 rev0 at 0x1c050000 irq 31,0 (pio)
mmci-pl18x 1c050000.mmci: DMA channels RX none, TX none
leds-syscon 1c010000.apbregs:led@08.0: registered LED vexpress:0
leds-syscon 1c010000.apbregs:led@08.1: registered LED vexpress:1
leds-syscon 1c010000.apbregs:led@08.2: registered LED vexpress:2
leds-syscon 1c010000.apbregs:led@08.3: registered LED vexpress:3
leds-syscon 1c010000.apbregs:led@08.4: registered LED vexpress:4
leds-syscon 1c010000.apbregs:led@08.5: registered LED vexpress:5
leds-syscon 1c010000.apbregs:led@08.6: registered LED vexpress:6
leds-syscon 1c010000.apbregs:led@08.7: registered LED vexpress:7
input: smb:motherboard:gpio_keys as /devices/platform/smb/smb:motherboard/smb:motherboard:gpio_keys/input/input1
rtc-efi rtc-efi: setting system clock to 2015-07-06 05:13:05 UTC (1436159585)
uart-pl011 7ff80000.uart: no DMA platform data
usb 1-1: new high-speed USB device number 2 using ehci-platform
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
atkbd serio0: keyboard reset failed on 1c060000.kmi
Waiting for root device /dev/sda1...
usb 1-1.1: new high-speed USB device number 3 using ehci-platform
usb-storage 1-1.1:1.0: USB Mass Storage device detected
scsi host0: usb-storage 1-1.1:1.0
atkbd serio1: keyboard reset failed on 1c070000.kmi
scsi 0:0:0:0: Direct-Access     SanDisk  Ultra            1.00 PQ: 0 ANSI: 6
sd 0:0:0:0: [sda] 242614272 512-byte logical blocks: (124 GB/115 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
EXT2-fs (sda1): error: couldn't mount because of unsupported optional features (244)
EXT4-fs (sda1): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (sda1): INFO: recovery required on readonly filesystem
EXT4-fs (sda1): write access will be enabled during recovery
EXT4-fs (sda1): recovery complete
EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) readonly on device 8:1.
devtmpfs: mounted
Freeing unused kernel memory: 544K (ffffffc000866000 - ffffffc0008ee000)
Freeing alternatives memory: 48K (ffffffc0008ee000 - ffffffc0008fa000)
udevd[839]: starting version 182
EXT4-fs (sda1): re-mounted. Opts: data=ordered
random: dd urandom read with 46 bits of entropy available
smsc911x 18000000.ethernet eth0: SMSC911x/921x identified at 0xffffff8000120000, IRQ: 29
random: nonblocking pool is initialized

 ======================================================================================

 thanks
 Huang Shijie
Huang Shijie Oct. 26, 2015, 2:13 a.m. UTC | #9
The 10/23/2015 11:38, Timur Tabi wrote:
> On 10/23/2015 11:02 AM, Dave P Martin wrote:
> >I'm pretty sure CREAD should default to enabled[1], and that usually
> >software won't modify it.
> >
> >Assuming that this is indeed the problem, it's possible that another bug
> >in the pl011 driver is wrongly clearing this flag.  Sadly I don't have
> >time to look at the code again just now ...:(
>
> Perhaps, but !CREAD is definitely broken without this patch.  So if the
> driver really is clearing CREAD somewhere else, then that's where the real
> bug is.
>
> >
> >Could be interesting to stick some BUG_ON(!CREAD) in the driver to
> >try and track down where that's coming from.
>
> CREAD is disabled by default when opening the console.  You need to
> explicitly set it in the termios structure.  I can easily believe that
> Huang's rootfs is just forgetting to set that bit because for the last five
> years, it didn't matter.
>
> Huang,
>
> In the beginning of pl011_set_termios() and sbsa_uart_set_termios(), please
> add this code:
>
>       BUG_ON(!(termios->c_cflag & CREAD));
>
I find after I reverted this patch, the console also can hang sometimes!

So the hang issue maybe caused by other patches.

thanks
Huang Shijie
Huang Shijie Oct. 26, 2015, 5:47 a.m. UTC | #10
The 10/23/2015 11:31, Dave Martin wrote:
> On Fri, Oct 23, 2015 at 06:00:00PM +0800, Huang Shijie wrote:
> > The commit 71a5cd8a4 makes the console hang for some times.
> > This reverts commit 71a5cd8a4a2602a6e9010b557a23af0a54df87b6.
>
> What hangs?  Input?  Output?  Both?
>
> Is CREAD set on the terminal?  If only input hangs, it's possible CREAD
> is not set and we were previously getting away with it, though I can't
> easily see why it should be unset...
I think the hang is not caused by this patch: 71a5cd8a4a2602a6e9.

I tried to bisect the linux-next today, but i still cannot find the root cause,
the following is the log from bisect:

 =============================================
git bisect start
# bad: [6dcf94ff0c9e28e5790799e53641dd256745f425] Add linux-next specific files for 20151022
git bisect bad 6dcf94ff0c9e28e5790799e53641dd256745f425
# good: [7379047d5585187d1288486d4627873170d0005a] Linux 4.3-rc6
git bisect good 7379047d5585187d1288486d4627873170d0005a
# good: [c3d1cd2b1e542e5ba6a844fd40fa5e62a896cfc2] Merge remote-tracking branch 'block/for-next'
git bisect good c3d1cd2b1e542e5ba6a844fd40fa5e62a896cfc2
# good: [c3af8a28f43315fc46753465a4e77e5619dd9f30] staging: IB/hfi1: use TASK_COMM_LEN in hfi1_ctxtdata
git bisect good c3af8a28f43315fc46753465a4e77e5619dd9f30
# good: [41783383487fc80d2acdd78fb9133d441371510b] Merge remote-tracking branch 'driver-core/driver-core-next'
git bisect good 41783383487fc80d2acdd78fb9133d441371510b
# good: [1709035022efcdcf316010592537de2033335e4e] Merge remote-tracking branch 'target-merge/for-next-merge'
git bisect good 1709035022efcdcf316010592537de2033335e4e
# good: [641e7642617127da14e683da8ec690d8404ea83f] rbtree-clarify-documentation-of-rbtree_postorder_for_each_entry_safe-fix
git bisect good 641e7642617127da14e683da8ec690d8404ea83f
# bad: [a1a15239a59287d6d56cf43e84d3cc878bca828f] Merge remote-tracking branch 'clk/clk-next'
git bisect bad a1a15239a59287d6d56cf43e84d3cc878bca828f
# bad: [87fd47bb754496a1ba005fca022eee1b30b3cee9] Merge remote-tracking branch 'pwm/for-next'
git bisect bad 87fd47bb754496a1ba005fca022eee1b30b3cee9
# good: [ec879f1272283c040bc70e1a1fff5edbb547be59] pinctrl: baytrail: Fix compilation warnings when !CONFIG_PM
git bisect good ec879f1272283c040bc70e1a1fff5edbb547be59
# good: [f32517bf1ae0a2de72b3f27200233bd3ad65bfeb] gpio: pca953x: support ACPI devices found on Galileo Gen2
git bisect good f32517bf1ae0a2de72b3f27200233bd3ad65bfeb
# good: [677b2ff4afd9996eabefc9472c701211b4b49e87] gpio: add a real time compliance checklist
git bisect good 677b2ff4afd9996eabefc9472c701211b4b49e87
# good: [2b8b0ef354cc055f855d8cb86aeae9089517fba7] pwm: atmel-hlcdc: add sama5d2 SoC support.
git bisect good 2b8b0ef354cc055f855d8cb86aeae9089517fba7
# bad: [8706693e4ee14eb6051be8caa9850312d843b88f] Merge remote-tracking branch 'gpio/for-next'
git bisect bad 8706693e4ee14eb6051be8caa9850312d843b88f
# good: [d629f2b585cb766ed9732008976d029cb5d5e584] virtio: introduce avail cache
git bisect good d629f2b585cb766ed9732008976d029cb5d5e584
# bad: [fb4e51e2df938f7f7e3ec3c198beb2d449e2f548] Merge remote-tracking branch 'vhost/linux-next'
git bisect bad fb4e51e2df938f7f7e3ec3c198beb2d449e2f548
# good: [cd5c6b35041cc595ff722226fb80450b9368dbbc] Merge remote-tracking branch 'pinctrl/for-next'
git bisect good cd5c6b35041cc595ff722226fb80450b9368dbbc
# first bad commit: [fb4e51e2df938f7f7e3ec3c198beb2d449e2f548] Merge remote-tracking branch 'vhost/linux-next'

 =============================================
 thanks
 Huang Shijie
diff mbox

Patch

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 899a771..fd27e98 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -191,8 +191,8 @@  struct uart_amba_port {
  */
 static int pl011_fifo_to_tty(struct uart_amba_port *uap)
 {
-	u16 status;
-	unsigned int ch, flag, max_count = 256;
+	u16 status, ch;
+	unsigned int flag, max_count = 256;
 	int fifotaken = 0;
 
 	while (max_count--) {