Kernel use earlycon for primary console - linux-kernel

I'd like to continue to use my earlycon console for the rest of my system, not just early boot. I'm working on a VM, and I'm using the 8250 UART as my primary I/O. It has no practical speed limitations.
It's great when the system is booting. The text comes in immediately without delay. But, after the system boots, it switches over to regular console. Then things get much slower.
[ 0.518804] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[ 0.542227] printk: console [ttyS0] disabled
[ 0.542800] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 0, base_baud = 1048576) is a XR16850
[ 0.543623] printk: console [ttyS0] enabled
[ 0.544302] printk: bootconsole [uart8250] disabled
I've tried setting both earlycon and console to no effect.
My current kernel command-line is: ro earlycon=uart8250,mmio,0x10000000,1000000 console=ttyS0
How can I configure Linux to use my boot console, earlycon or console as my primary UART for user I/O and things like inittab, etc.

Related

PCIe aer/dpc interrupt issue

I tried on Latitude 3500 Ubuntu kernel 5.13.1. Its pci switch 1d:0.0 is rp supporting aer/dpc, and connected to Eth port at 1:0.0 that support aer.
With aer_inject I can run all examples, generate aer interrupt from Eth port. I modified dpc.c to enable rp dpc and monitored dpc irq/handler, no dpc irq can be raised. Then I added code on aer_inject to replace the irq_inject_interrupt() with dpc s/w trigger which works. My questions are:
1.Why there is no dpc_inject? any possibility to do a dpc_inject?
2.irq_inject_interrupt() works for aer because its status reg is r/w, not work for dpc because its status reg is RO?
3.Per spec certain aer errors shall raise dpc interrupt, it doesn't work. would the the reason be I used aer_inject no real h/w error happens?

How to enable USB 2.0 Host on AST2500?

I'm trying to enable USB 2.0 Host on an AST2500 based board. I'm using the latest obmc-phosphor-image from GitHub which contains Linux 5.10.30. EHCI seems to start in QEMU but fails on real HW. I enabled ehci0 (or ehci1) in the device tree, added the necessary drivers to Linux and I get the following error message during boot-up:
ehci-platform 1e6a1000.usb: USB 2.0, controller refused to start: -110
I investigated EHCI registers a bit and found that when ehci_run() function in ehci-hcd.c would start EHCI (by setting CMD_RUN bit) it remains halted, HCHalted bit in USBSTS register remains 1.
I also saw that the frame index register starts to count when CMD_RUN is asserted. Clock and reset bits in SCU registers are set properly by pinctrl and clk drivers.
Contents of the periodic list buffer and the asynchronous QH buffer seem to be OK. But EHCI still doesn't start.
Strangely UHCI (USB 1.1 host) seems to work properly.
Did maybe somebody manage to get EHCI working on real AST2500 or similar hardware?
Thanks for any advice.

Turn of kernel logging to serial port but keep logging to oops ramlog

I'm working with a system that have one external serial port, this has been (and still is used in other configurations using the same kernel) for printing the kernel log (and application log). But now the serial port has to be used to communicate with an external device.
I found a way to make getty boot depending on a file on a configuration file on the file system, but I have not been able to turn of the logging to the serial port and still keep the logging to the crash dump, the crash dumps utilize the oops logs stored "persistent" in RAM (i.e. they survive a soft reboot) and stores them at the next boot.
If I use,
dmesg --console-off
it will turn of both the logging to the serial port as well as the logging to the oops logs.
Currently I have bootargs = "console=ttyPS0,115200 loglevel=7 ... the bootargs are shared with another product that, if possible, wishes to keep the log printouts over the serial interface.
Does anyone have any suggestion on how I can prevent the logs to be printed on the serial interface but still be logged in the oops logs? I have the possibility to edit all from the kernel, kernel module/drivers and user space apps.

Why is my ec2 machine failing to load properly after I moved regions?

I am trying to move my host to a different region.
I am following instructions from amazon documentation.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-copy-snapshot.html
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-launch-snapshot.html
But the "health check" fails and I cannot ssh to machine.
I am using a centos image from marketplace. I have validated that the centos image supports the region.
This is the system log I get from aws console (pasted only the end as it is too long).
How can I make this work?
audit: initializing netlink socket (disabled)
type=2000 audit(1423925427.781:1): initialized
HugeTLB registered 2 MB page size, pre-allocated 0 pages
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
msgmni has been set to 1173
alg: No test for stdrng (krng)
ksign: Installing public key data
Loading keyring
- Added public key 5A35DBBA2F61C535
- User ID: CentOS (Kernel Module GPG key)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
pciehp: PCI Express Hot Plug Controller Driver version: 0.4
acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
ipmi message handler version 39.2
IPMI System Interface driver.
ipmi_si: Adding default-specified kcs state machine
ipmi_si: Trying default-specified kcs state machine at i/o address 0xca2, slave address 0x0, irq 0
ipmi_si: Could not set up I/O space
Trying to free nonexistent resource <0000000000000ca2-0000000000000ca2>
Trying to free nonexistent resource <0000000000000ca3-0000000000000ca3>
ipmi_si: Adding default-specified smic state machine
ipmi_si: Trying default-specified smic state machine at i/o address 0xca9, slave address 0x0, irq 0
ipmi_si: Could not set up I/O space
Trying to free nonexistent resource <0000000000000ca9-0000000000000ca9>
Trying to free nonexistent resource <0000000000000caa-0000000000000caa>
Trying to free nonexistent resource <0000000000000cab-0000000000000cab>
ipmi_si: Adding default-specified bt state machine
ipmi_si: Trying default-specified bt state machine at i/o address 0xe4, slave address 0x0, irq 0
ipmi_si: Could not set up I/O space
Trying to free nonexistent resource <00000000000000e4-00000000000000e4>
Trying to free nonexistent resource <00000000000000e5-00000000000000e5>
Trying to free nonexistent resource <00000000000000e6-00000000000000e6>
ipmi_si: Unable to find any System Interface(s)
Non-volatile memory driver v1.3
Linux agpgart interface v0.103
crash memory driver: version 1.1
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
brd: module loaded
loop: module loaded
input: Macintosh mouse button emulation as /devices/virtual/input/input0
Fixed MDIO Bus: probed
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
uhci_hcd: USB Universal Host Controller Interface driver
PNP: No PS/2 controller found. Probing ports directly.
mice: PS/2 mouse device common for all mice
rtc_cmos: probe of rtc_cmos failed with error -16
cpuidle: using governor ladder
cpuidle: using governor menu
EFI Variables Facility v0.08 2004-May-17
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
GRE over IPv4 demultiplexor driver
TCP cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
registered taskstats version 1
XENBUS: Device with no driver: device/vbd/2049
XENBUS: Device with no driver: device/vif/0
XENBUS: Device with no driver: device/console/0
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
Initalizing network drop monitor service
Freeing unused kernel memory: 1280k freed
Write protecting the kernel read-only data: 10240k
Freeing unused kernel memory: 796k freed
Freeing unused kernel memory: 1584k freed
dracut: dracut-004-336.el6_5.2
udev: starting version 147
dracut: Starting plymouth daemon
xlblk_init: register_blkdev major: 202
blkfront: xvde1: barriers disabled
dracut Warning: No root device "block:/dev/xvde" found
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.
dracut Warning: Signal caught!
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.
Kernel panic - not syncing: Attempted to kill init!
Pid: 1, comm: init Not tainted 2.6.32-431.20.3.el6.x86_64 #1
Call Trace:
[<ffffffff8152812c>] ? panic+0xa7/0x16f
[<ffffffff81077332>] ? do_exit+0x862/0x870
[<ffffffff8118a6e5>] ? fput+0x25/0x30
[<ffffffff81077398>] ? do_group_exit+0x58/0xd0
[<ffffffff81077427>] ? sys_exit_group+0x17/0x20
[<ffffffff8100b072>] ? system_call_fastpath+0x16/0x1b
I believe you are experiencing this problem which is specific to RHEL 6.3 onwards and relatings to the incorrect mapping of the virtual disk - you will find some suggestions for a fix here:
https://forums.aws.amazon.com/message.jspa?messageID=255240

how KVM handle interrupt

i have been doing the KVM stuff and have a couple of questions that can not figure out.
1> as we know, normally the external interrupt will cause VMexit and the hypervisor will inject a virtual interrupt if it is for guest. Then which irq will be injected (i mean the interrupt vector for indexing the guest IDT)? How does the KVM get to know about this (associate a host IRQ with a guest virtual IRQ)?
2> if for assigned device to the guest, the hypervisor will deliver that IRQ to the guest. by tracing the code, i found the host IRQ is different with the guest's (i mean the interrupt vector). how the KVM configure which interrupt vector the guest should use?
3> if we configure not exit on external interrupt by setting some field in VMCS, what will happen during the physical interrupts? will the CPU use the guest IDT for response interrupt? If so, can KVM redirect the CPU to use another IDT for guest (assuming modifying the IDTR)?
4> where is the guest IDT located? it this configured by the qemu while initializing the vcpu and registers (include the IDTR)?
I really hope someone can reply to my questions. I will be very appreciated.
Thanks
1-
2-
The code is in irq_comm.c and very complex. For the guest vector, the hypervisor traps and monitors the PCI configuration space of the guest (this is actually done in QEMU - see for instance kvm_msi_update - however a syscall to the KVM updates it with the data).
3- Yes. For setting another IDT - you need to change the IDTR field in the VMCS.
4- The guest IDT is configured by the guest code. QEMU/KVM is not directly involved in it. You need to configure the execution-controls to trap on LIDT in order to monitor changes for the guest IDTR.
Sounds like you are trying to implement ELI from ASPLOS'12.
Contact me offline (the second author of the paper - NA).

Resources