Bug 1456882

Summary: qemu-kvm-rhev: Can't control pl011 serial console instantiation
Product: Red Hat Enterprise Linux 7 Reporter: Andrea Bolognani <abologna>
Component: qemu-kvm-rhevAssignee: Andrew Jones <drjones>
Status: CLOSED NOTABUG QA Contact: Sitong Liu <siliu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: chayang, drjones, hhuang, jcm, juzhang, michen, rbalakri, virt-bugs, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: aarch64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1435681 Environment:
Last Closed: 2017-09-04 11:40:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1173755, 1435681    

Description Andrea Bolognani 2017-05-30 15:28:10 UTC
+++ This bug was initially created as a clone of Bug #1435681 +++

Configuring a libvirt guest with

  <console type='pty'>
    <log file='...'/>
  </console>

fails on aarch64 with

  error: unsupported configuration: logfile not supported
         in this QEMU binary

The underlying issue is that, unlike what happens for x86
and ppc64, the guest-side serial console (pl011) is
instantiated implicitly, even when -nodefaults is used, so
libvirt doesn't have a way to assign it a chardev with the
logfile property configured.

---

A way to work around the issue is to use the VirtIO-based
console instead:

  <console type='pty'>
    <log file='...'/>
    <target type='virtio'/>
  </console>

However, that has its own drawbacks, such as not being able
to access early boot or even the bootloader.

Comment 3 Andrew Jones 2017-06-14 07:56:22 UTC
Bumping to 7.5. There's a workaround that can be used for now, which is to use virtio-console.

Comment 4 Andrew Jones 2017-06-22 15:29:10 UTC
I guess this should already work by adding the following to the QEMU command line. Is that sufficient?

	-add-fd set=0,fd=$FD_ID \
	-chardev stdio,id=chardev0,logfile=/dev/fdset/0,logappend=on \
	-serial chardev:chardev0 $FD_ID>>my_logfile

Replacing stdio with pty should also work.

Comment 5 Andrea Bolognani 2017-06-25 02:30:25 UTC
(In reply to Andrew Jones from comment #4)
> I guess this should already work by adding the following to the QEMU command
> line. Is that sufficient?
> 
> 	-add-fd set=0,fd=$FD_ID \
> 	-chardev stdio,id=chardev0,logfile=/dev/fdset/0,logappend=on \
> 	-serial chardev:chardev0 $FD_ID>>my_logfile
> 
> Replacing stdio with pty should also work.

Currently we generate

  -add-fd set=0,fd=$FD_ID \
  -chardev pty,id=charserial0,logfile=/dev/fdset/0,logappend=on \
  -device isa-serial,chardev=charserial0,id=serial0

eg. we use -device to create the device explicitly. Of
course that doesn't work because isa-serial can't be used
on aarch64, but s/isa-serial/virtconsole/ for example does.

Will

  -serial chardev:chardev0

control the implicity pl011 instead? If that's the case,
we might have a winner.

I'll give it a go tomorrow.

Comment 6 Andrew Jones 2017-06-26 06:09:32 UTC
(In reply to Andrea Bolognani from comment #5)
> (In reply to Andrew Jones from comment #4)
> > I guess this should already work by adding the following to the QEMU command
> > line. Is that sufficient?
> > 
> > 	-add-fd set=0,fd=$FD_ID \
> > 	-chardev stdio,id=chardev0,logfile=/dev/fdset/0,logappend=on \
> > 	-serial chardev:chardev0 $FD_ID>>my_logfile
> > 
> > Replacing stdio with pty should also work.
> 
> Currently we generate
> 
>   -add-fd set=0,fd=$FD_ID \
>   -chardev pty,id=charserial0,logfile=/dev/fdset/0,logappend=on \
>   -device isa-serial,chardev=charserial0,id=serial0
> 
> eg. we use -device to create the device explicitly. Of
> course that doesn't work because isa-serial can't be used
> on aarch64,

Right, it would need to be '-device pl011', which won't work, because that
device isn't user creatable.

> but s/isa-serial/virtconsole/ for example does.

But virtconsole won't be available to the guest for early output.

> 
> Will
> 
>   -serial chardev:chardev0
> 
> control the implicity pl011 instead? If that's the case,
> we might have a winner.

Nope, one pl011 will be created automatically just like always, i.e. still not user controllable. However, if the problem is enabling the logfile feature for that single, automatic serial console, then I think we just need do apply the chardev magic above.

Comment 7 Andrea Bolognani 2017-09-04 11:23:15 UTC
Since Bug 1435681 has been addressed, I think we can safely
close this one now.