Skip to contentSkip to conversation

linux-2.6.18/xencons: generalize use of add_preferred_console()

PATCH In review Jan Beulich 2 participants 9 messages Dec 13, 2013 – Feb 7, 2014 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-2.6.18/xencons: generalize use of add_preferred_console()

Changeset 762:a070228ac76e ("add hvc compatibility mode to xencons" added this call just for the HVC case, without giving any reason why HVC would be special in this regard. Use the call for all cases.

drivers/xen/console/console.c +2 -2
@@ -214,8 +214,6 @@ static int __init xen_console_init(void)
 		strcpy(kcons_info.name, "hvc");
 		if (xc_num == -1)
 			xc_num = 0;
-		if (!is_initial_xendomain())
-			add_preferred_console(kcons_info.name, xc_num, NULL);
 		break;
 
 	case XC_SERIAL:
@@ -236,6 +234,8 @@ static int __init xen_console_init(void)
 
 	wbuf = alloc_bootmem(wbuf_size);
 
+	if (!is_initial_xendomain())
+		add_preferred_console(kcons_info.name, xc_num, NULL);
 	register_console(&kcons_info);
 
  out:

xencons: generalize use of add_preferred_console()

Changeset 762:a070228ac76e ("add hvc compatibility mode to xencons" added this call just for the HVC case, without giving any reason why HVC would be special in this regard. Use the call for all cases.

drivers/xen/console/console.c +2 -2
@@ -214,8 +214,6 @@ static int __init xen_console_init(void)
 		strcpy(kcons_info.name, "hvc");
 		if (xc_num == -1)
 			xc_num = 0;
-		if (!is_initial_xendomain())
-			add_preferred_console(kcons_info.name, xc_num, NULL);
 		break;
 
 	case XC_SERIAL:
@@ -236,6 +234,8 @@ static int __init xen_console_init(void)
 
 	wbuf = alloc_bootmem(wbuf_size);
 
+	if (!is_initial_xendomain())
+		add_preferred_console(kcons_info.name, xc_num, NULL);
 	register_console(&kcons_info);
 
  out:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw

drivers/xen/console/console.c static int __init xen_console_init(void) · line 239

Quoted 12 lines · Jan Beulich

Changeset 762:a070228ac76e ("add hvc compatibility mode to xencons" added this call just for the HVC case, without giving any reason why HVC would be special in this regard. Use the call for all cases.

+++ b/drivers/xen/console/console.c

drivers/xen/console/console.c +2 -0
@@ -236,6 +234,8 @@ static int __init xen_console_init(void)
 
 	wbuf = alloc_bootmem(wbuf_size);
 
+	if (!is_initial_xendomain())
+		add_preferred_console(kcons_info.name, xc_num, NULL);
 	register_console(&kcons_info);

Why is dom0 special in this case anyway? At least with SLE12, when Xen is booted with 'console=com1 com1=115200' and the kernel is booted without any console= or xencons=, kcons_info.index is still -1 and as a result xvc-1 is registered as name for xvc0. This confuses systemd because kernel name and console name do not match, so login via serial is not possible.

When add_preferred_console is called uncondtionally the login on serial works as expected.

Olaf

#2 lore raw
Quoted 12 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 9 lines · Jan Beulich

Changeset 762:a070228ac76e ("add hvc compatibility mode to xencons" added this call just for the HVC case, without giving any reason why HVC would be special in this regard. Use the call for all cases.

+++ b/drivers/xen/console/console.c

drivers/xen/console/console.c +0 -0
@@ -236,6 +234,8 @@ static int __init xen_console_init(void)
 
 	wbuf = alloc_bootmem(wbuf_size);
 
Quoted 10 lines

drivers/xen/console/console.c static int __init xen_console_init(void) · line 239

Quoted 3 lines
drivers/xen/console/console.c +2 -0
+	if (!is_initial_xendomain())
+		add_preferred_console(kcons_info.name, xc_num, NULL);
 	register_console(&kcons_info);

Why is dom0 special in this case anyway? At least with SLE12, when Xen is booted with 'console=com1 com1=115200' and the kernel is booted without any console= or xencons=, kcons_info.index is still -1 and as a result xvc-1 is registered as name for xvc0. This confuses systemd because kernel name and console name do not match, so login via serial is not possible.

I have to direct this question to Ian, who wrote the original patch (sorry Ian, I know it's been long ago), which the patch above only generalizes.

Quoted 2 lines

When add_preferred_console is called uncondtionally the login on serial works as expected.

They question is what the intended behavior here is: I'd generally expect the lack of console= on the command line for Dom0 to behave just like for a native kernel, which I don't think would show a login prompt on other than the screen in that case. So maybe instead of just dropping the is_initial_xendomain() we should make console registration conditional upon a command line option having requested its presence in the Dom0 case. (Looking at the command line handling code I also wonder whether it isn't a mistake to set console_use_vt even in the xencons=off case, and to not bail upon the right side of the = not being recognized - see 196:52f308b17bae and 153:12c399692d44 for how this evolved.)

Jan

#3 lore raw
Quoted 1 line · Jan Beulich

They question is what the intended behavior here is: I'd generally

In my opinion dom0 is just a child of Xen, which should follow the rules of the parent. If Xen is configured to have its console on serial then the default of dom0 should be to follow just that. Appearently its just a matter of correctly using xvc0.

I'm not sure what the gain would be to have Xen on serial and dom0 somewhere else, and enforcing the need of a console= cmdline option to point dom0 also to serial. Thats just doing things twice.

Olaf

#4 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 1 line · Jan Beulich

They question is what the intended behavior here is: I'd generally

Quoted 8 lines

In my opinion dom0 is just a child of Xen, which should follow the rules of the parent. If Xen is configured to have its console on serial then the default of dom0 should be to follow just that. Appearently its just a matter of correctly using xvc0.

I'm not sure what the gain would be to have Xen on serial and dom0 somewhere else, and enforcing the need of a console= cmdline option to point dom0 also to serial. Thats just doing things twice.

That's a fair point, but leaves aside the case of Xen _not_ using the serial console. Dom0 has no way to know, and hence would still push output there, not knowing that it ends up no-where.

Also the "follow the rules of the parent" already doesn't apply for the VGA console case, where Dom0 makes its own decision too (and it's for that reason that Xen needs to stop sending data to the VGA in order to not interfere). Hence I'm not sure that argument really counts.

Jan

#5 lore raw
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 1 line · Jan Beulich

They question is what the intended behavior here is: I'd generally

In my opinion dom0 is just a child of Xen, which should follow the rules of the parent. If Xen is configured to have its console on serial then the default of dom0 should be to follow just that. Appearently its just a matter of correctly using xvc0.

Quoted 7 lines
Quoted 3 lines

I'm not sure what the gain would be to have Xen on serial and dom0 somewhere else, and enforcing the need of a console= cmdline option to point dom0 also to serial. Thats just doing things twice.

That's a fair point, but leaves aside the case of Xen _not_ using the serial console. Dom0 has no way to know, and hence would still push output there, not knowing that it ends up no-where.

You mean no Xen console= option implies that dom0 writes no-where? I would think dom0 will use the graphics card in this case to send its output.

Quoted 5 lines

Also the "follow the rules of the parent" already doesn't apply for the VGA console case, where Dom0 makes its own decision too (and it's for that reason that Xen needs to stop sending data to the VGA in order to not interfere). Hence I'm not sure that argument really counts.

The details about driving a certain hardware dont really matter. I think the important part is "goes to the wire" vs. "goes to the monitor".

I think the bug is that register_console("xvc") is called without a preceeding add_prefered_console, which with current kernels means a second entry in /proc/consoles. This in turn lets systemd spawn a login for that.

Somehow I think the rules have changed since 2.6.18. I will have a look at this now.

Olaf

#6 lore raw
Quoted 12 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 10 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Olaf Hering

In my opinion dom0 is just a child of Xen, which should follow the rules of the parent. If Xen is configured to have its console on serial then the default of dom0 should be to follow just that. Appearently its just a matter of correctly using xvc0.

I'm not sure what the gain would be to have Xen on serial and dom0 somewhere else, and enforcing the need of a console= cmdline option to point dom0 also to serial. Thats just doing things twice.

Quoted 7 lines
Quoted 3 lines

That's a fair point, but leaves aside the case of Xen _not_ using the serial console. Dom0 has no way to know, and hence would still push output there, not knowing that it ends up no-where.

You mean no Xen console= option implies that dom0 writes no-where? I would think dom0 will use the graphics card in this case to send its output.

"No" to the question. Dom0, without any console= and xencons=, always writes _both_ ways (unless - under EFI only - it detects that there's RAM at address 0xA0000), no matter whether this actually ends up being visible anywhere.

Quoted 6 lines
Quoted 5 lines

Also the "follow the rules of the parent" already doesn't apply for the VGA console case, where Dom0 makes its own decision too (and it's for that reason that Xen needs to stop sending data to the VGA in order to not interfere). Hence I'm not sure that argument really counts.

Quoted 7 lines

The details about driving a certain hardware dont really matter. I think the important part is "goes to the wire" vs. "goes to the monitor".

I think the bug is that register_console("xvc") is called without a preceeding add_prefered_console, which with current kernels means a second entry in /proc/consoles. This in turn lets systemd spawn a login for that.

Yes, I agree that there likely needs to be another change here. I'm just not certain yet which way this should be done.

Jan

#7 lore raw
Quoted 2 lines · Jan Beulich

Yes, I agree that there likely needs to be another change here. I'm just not certain yet which way this should be done.

Jan,

before I start doing software archaeology:
How would you want it to look like?
What combinations of Xen console= and Linux xencons=/console= are useful anyway?

Olaf

#8 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 2 lines · Jan Beulich

Yes, I agree that there likely needs to be another change here. I'm just not certain yet which way this should be done.

before I start doing software archaeology:
How would you want it to look like?
What combinations of Xen console= and Linux xencons=/console= are useful anyway?

I'd really first see if Ian remembers why that original change was done for DomU only.

Jan