Skip to contentSkip to conversation

Revert "serial: 8250: Make SERIAL_8250_RUNTIME_UARTS work correctly"

PATCH Kyle McMartin 2 participants 6 messages Jun 3, 2013 2 messages not in the archive TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

This reverts commit cfcec52e9781f08948c6eb98198d65c45be75a70.

This regresses a longstanding behaviour on X86 systems, which end up with PCI serial ports moving between ttyS4 and ttyS0 when you bisect to opposite sides of this commit, resulting in the need to constantly modify the console setting in order to bisect across it.

Please revert, we can work on solving this for ARM platforms in a less disruptive way.

drivers/tty/serial/8250/8250_core.c +7 -7
@@ -2755,7 +2755,7 @@ static void __init serial8250_isa_init_ports(void)
 	if (nr_uarts > UART_NR)
 		nr_uarts = UART_NR;
 
-	for (i = 0; i < UART_NR; i++) {
+	for (i = 0; i < nr_uarts; i++) {
 		struct uart_8250_port *up = &serial8250_ports[i];
 		struct uart_port *port = &up->port;
 
@@ -2916,7 +2916,7 @@ static int __init serial8250_console_setup(struct console *co, char *options)
 	 * if so, search for the first available port that does have
 	 * console support.
 	 */
-	if (co->index >= UART_NR)
+	if (co->index >= nr_uarts)
 		co->index = 0;
 	port = &serial8250_ports[co->index].port;
 	if (!port->iobase && !port->membase)
@@ -2957,7 +2957,7 @@ int serial8250_find_port(struct uart_port *p)
 	int line;
 	struct uart_port *port;
 
-	for (line = 0; line < UART_NR; line++) {
+	for (line = 0; line < nr_uarts; line++) {
 		port = &serial8250_ports[line].port;
 		if (uart_match_port(p, port))
 			return line;
@@ -3110,7 +3110,7 @@ static int serial8250_remove(struct platform_device *dev)
 {
 	int i;
 
-	for (i = 0; i < UART_NR; i++) {
+	for (i = 0; i < nr_uarts; i++) {
 		struct uart_8250_port *up = &serial8250_ports[i];
 
 		if (up->port.dev == &dev->dev)
@@ -3178,7 +3178,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
 	/*
 	 * First, find a port entry which matches.
 	 */
-	for (i = 0; i < UART_NR; i++)
+	for (i = 0; i < nr_uarts; i++)
 		if (uart_match_port(&serial8250_ports[i].port, port))
 			return &serial8250_ports[i];
 
@@ -3187,7 +3187,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
 	 * free entry.  We look for one which hasn't been previously
 	 * used (indicated by zero iobase).
 	 */
-	for (i = 0; i < UART_NR; i++)
+	for (i = 0; i < nr_uarts; i++)
 		if (serial8250_ports[i].port.type == PORT_UNKNOWN &&
 		    serial8250_ports[i].port.iobase == 0)
 			return &serial8250_ports[i];
@@ -3196,7 +3196,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
 	 * That also failed.  Last resort is to find any entry which
 	 * doesn't have a real port associated with it.
 	 */
-	for (i = 0; i < UART_NR; i++)
+	for (i = 0; i < nr_uarts; i++)
 		if (serial8250_ports[i].port.type == PORT_UNKNOWN)
 			return &serial8250_ports[i];
 
maintainer
#1 lore raw
Quoted 9 lines · Kyle McMartin

This reverts commit cfcec52e9781f08948c6eb98198d65c45be75a70.

This regresses a longstanding behaviour on X86 systems, which end up with PCI serial ports moving between ttyS4 and ttyS0 when you bisect to opposite sides of this commit, resulting in the need to constantly modify the console setting in order to bisect across it.

Please revert, we can work on solving this for ARM platforms in a less disruptive way.

Ugh, how did this break x86 systems? Karthik, you said this wouldn't affect anyone else, what did you test it on?

Quoted 1 line

I'll go queue this up for the next -rc release, thanks Kyle.

greg k-h

#2 lore raw
Quoted 11 lines · Greg KH
Quoted 9 lines · Kyle McMartin

This reverts commit cfcec52e9781f08948c6eb98198d65c45be75a70.

This regresses a longstanding behaviour on X86 systems, which end up with PCI serial ports moving between ttyS4 and ttyS0 when you bisect to opposite sides of this commit, resulting in the need to constantly modify the console setting in order to bisect across it.

Please revert, we can work on solving this for ARM platforms in a less disruptive way.

Quoted 7 lines

Ugh, how did this break x86 systems? Karthik, you said this wouldn't affect anyone else, what did you test it on?

Quoted 1 line

I'll go queue this up for the next -rc release, thanks Kyle.

No worries, I undertand what Karthik is talking about, so I'll try to figure this out.

CONFIG_SERIAL_8250_NR_UARTS=32
CONFIG_SERIAL_8250_RUNTIME_UARTS=4

is what was set in my .config, resulting in:

[3.9.y]
0: uart:16550A port:00001030 irq:16 tx:16522 rx:0 RTS|CTS|DTR|CD 1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3

[3.10-rc2]
0: uart:unknown port:000003F8 irq:4
1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3
4: uart:16550A port:00001030 irq:16 tx:16226 rx:0 RTS|CTS|DTR|CD

There's undeniably something wrong if RUNTIME_UARTS=0 doesn't result in his serial ports showing up, I'll try to help debug that, but I think the 3.9 behaviour is desireable if no "legacy" uarts are found.

regards, Kyle

maintainer
#3 lore raw
Quoted 34 lines · Kyle McMartin
Quoted 11 lines · Greg KH
Quoted 9 lines · Kyle McMartin

This reverts commit cfcec52e9781f08948c6eb98198d65c45be75a70.

This regresses a longstanding behaviour on X86 systems, which end up with PCI serial ports moving between ttyS4 and ttyS0 when you bisect to opposite sides of this commit, resulting in the need to constantly modify the console setting in order to bisect across it.

Please revert, we can work on solving this for ARM platforms in a less disruptive way.

Quoted 7 lines

Ugh, how did this break x86 systems? Karthik, you said this wouldn't affect anyone else, what did you test it on?

Quoted 1 line

I'll go queue this up for the next -rc release, thanks Kyle.

No worries, I undertand what Karthik is talking about, so I'll try to figure this out.

CONFIG_SERIAL_8250_NR_UARTS=32
CONFIG_SERIAL_8250_RUNTIME_UARTS=4

is what was set in my .config, resulting in:

[3.9.y]
0: uart:16550A port:00001030 irq:16 tx:16522 rx:0 RTS|CTS|DTR|CD 1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3

Quoted 6 lines

[3.10-rc2]
0: uart:unknown port:000003F8 irq:4
1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3
4: uart:16550A port:00001030 irq:16 tx:16226 rx:0 RTS|CTS|DTR|CD

That's not good to have happen, so I'll do the revert.

Quoted 3 lines

There's undeniably something wrong if RUNTIME_UARTS=0 doesn't result in his serial ports showing up, I'll try to help debug that, but I think the 3.9 behaviour is desireable if no "legacy" uarts are found.

I agree, it is.

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CAES2cWxYsxgjWzgNuhrWDoC7t2XrZQdeTe47ftWaCdg-2QoHUg@mail.gmail.com

maintainer
#5 lore raw
Quoted 27 lines · Karthik Manamcheri
Quoted 5 lines

No worries, I undertand what Karthik is talking about, so I'll try to figure this out.

CONFIG_SERIAL_8250_NR_UARTS=32
CONFIG_SERIAL_8250_RUNTIME_UARTS=4

The description for "CONFIG_SERIAL_8250_RUNTIME_UARTS" is "Set this to the maximum number of serial ports you want the kernel to register at boot time." Setting it to 4 means that you want to use 4 legacy ports! If you do not have any legacy UARTs, you are to set this to 0.

Quoted 9 lines

is what was set in my .config, resulting in:

[3.9.y]
0: uart:16550A port:00001030 irq:16 tx:16522 rx:0 RTS|CTS|DTR|CD 1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3

Quoted 6 lines

[3.10-rc2]
0: uart:unknown port:000003F8 irq:4
1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3
4: uart:16550A port:00001030 irq:16 tx:16226 rx:0 RTS|CTS|DTR|CD

Quoted 5 lines

You have five ports because you set CONFIG_SERIAL_8250_RUNTIME_UARTS to 4 and then you have to PCI port. This is exactly what my change addressed. We had issues with the ghost ports created in the system. In your case, if you set CONFIG_SERIAL_8250_RUNTIME_UARTS to 0, you'll have just one port which is the working available port.

But it is now named something differently, which is a regression, and we can't have that, sorry.

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CAES2cWwPSpsqYdBHH51gVsCFdh_YVnADwzU+SKXqgzQwZMUVEA@mail.gmail.com

maintainer
#7 lore raw
Quoted 41 lines · Karthik Manamcheri
Quoted 10 lines · Greg KH
Quoted 8 lines · Karthik Manamcheri
Quoted 5 lines

No worries, I undertand what Karthik is talking about, so I'll try to figure this out.

CONFIG_SERIAL_8250_NR_UARTS=32
CONFIG_SERIAL_8250_RUNTIME_UARTS=4

The description for "CONFIG_SERIAL_8250_RUNTIME_UARTS" is "Set this to the maximum number of serial ports you want the kernel to register at boot

time."

Quoted 1 line
Quoted 1 line

Setting it to 4 means that you want to use 4 legacy ports! If you do not

have

Quoted 11 lines
Quoted 11 lines

any legacy UARTs, you are to set this to 0.

Quoted 9 lines

is what was set in my .config, resulting in:

[3.9.y]
0: uart:16550A port:00001030 irq:16 tx:16522 rx:0 RTS|CTS|DTR|CD 1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

[3.10-rc2]
0: uart:unknown port:000003F8 irq:4
1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3
4: uart:16550A port:00001030 irq:16 tx:16226 rx:0 RTS|CTS|DTR|CD

You have five ports because you set CONFIG_SERIAL_8250_RUNTIME_UARTS to 4

and

Quoted 3 lines
Quoted 3 lines

then you have to PCI port. This is exactly what my change addressed. We had issues with the ghost ports created in the system. In your case, if you set CONFIG_SERIAL_8250_RUNTIME_UARTS to 0, you'll have just one port which is

the

Quoted 1 line
Quoted 1 line

working available port.

Quoted 8 lines
Quoted 2 lines

But it is now named something differently, which is a regression, and we can't have that, sorry.

It is named differently? Where? I am referring to https://git.kernel.org/cgit/
linux/kernel/git/torvalds/linux.git/tree/drivers/tty/serial/8250/Kconfig

My change makes it work as it is in the description. This is not breaking anything except for asking users to use the correct config options.

Your change caused existing kernel configurations to act differently than before, that's not ok, sorry.

Now you can argue that this was broken, but code trumps documentation here, sorry.

greg k-h