aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers/char/console.c
Commit message (Collapse)AuthorAgeFilesLines
* patches to support booting from my grubroot2013-10-231-2/+2
|
* console: buffer and show origin of guest PV writesDaniel De Graaf2013-09-101-17/+76
| | | | | | | | | | | | | Guests other than domain 0 using the console output have previously been controlled by the VERBOSE #define, but with no designation of which guest's output was on the console. This patch converts the HVM output buffering to be used by all domains except the hardware domain (dom0): stripping non-printable characters, line buffering the output, and prefixing it with the domain ID. This is especially useful for debugging stub domains during early boot. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Keir Fraser <keir@xen.org>
* watchdog/crash: Always disable watchdog in console_force_unlock()Andrew Cooper2013-08-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | Depending on the state of the conring and serial_tx_buffer, console_force_unlock() can be a long running operation, usually because of serial_start_sync() XenServer testing has found a reliable case where console_force_unlock() on one PCPU takes long enough for another PCPU to timeout due to the watchdog (such as waiting for a tlb flush callin). The watchdog timeout causes the second PCPU to repeat the console_force_unlock(), at which point the first PCPU typically fails an assertion in spin_unlock_irqrestore(&port->tx_lock) (because the tx_lock has been unlocked behind itself). console_force_unlock() is only on emergency paths, so one way or another the host is going down. Disable the watchdog before forcing the console lock to help prevent having pcpus completing with each other to bring the host down. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* watchdog: Move watchdog from being x86 specific to common codeAndrew Cooper2013-08-131-1/+1
| | | | | | | | | | | | | | | Augment watchdog_setup() to be able to possibly return an error, and introduce watchdog_enabled() as a better alternative to knowing the architectures internal details. This patch does not change the x86 implementaion, beyond making it compile. For header files, some includes of xen/nmi.h were only for the watchdog functions, so are replaced rather than adding an extra include of xen/watchdog.h Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* xen/conring: Write to console ring even if console lock is bustedAndrew Cooper2013-08-061-3/+2
| | | | | | | | | | | | | | | | | | console_lock_busted gets set when an NMI/MCE/Double Fault handler decides to bring Xen down in an emergency. conring_puts() cannot block and does not have problematic interactions with the console_lock. Therefore, choosing to not put the string into the console ring simply means that the kexec environment cant find any panic() message caused by an IST interrupt, which is unhelpful for debugging purposes. In the case that two pcpus fight with console_force_unlock(), having slightly garbled strings in the console ring is far more useful than having nothing at all. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Matt Wilson <msw@amazon.com> Acked-by: Keir Fraser <keir@xen.org>
* xen/conring: Clean up writing to the console ringAndrew Cooper2013-08-061-9/+10
| | | | | | | | | | | | Refactor putchar_console_ring() to conring_puts(). This allows for consistency with {sercon,vga}_puts(), prevents needless recalculation of the conring consumer index, and slight cleanup at the two callsites. There is no functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Matt Wilson <msw@amazon.com> Acked-by: Keir Fraser <keir@xen.org>
* use SMP barrier in common code dealing with shared memory protocolsIan Campbell2013-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Xen currently makes no strong distinction between the SMP barriers (smp_mb etc) and the regular barrier (mb etc). In Linux, where we inherited these names from having imported Linux code which uses them, the SMP barriers are intended to be sufficient for implementing shared-memory protocols between processors in an SMP system while the standard barriers are useful for MMIO etc. On x86 with the stronger ordering model there is not much practical difference here but ARM has weaker barriers available which are suitable for use as SMP barriers. Therefore ensure that common code uses the SMP barriers when that is all which is required. On both ARM and x86 both types of barrier are currently identical so there is no actual change. A future patch will change smp_mb to a weaker barrier on ARM. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-211-1/+1
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* x86: move watchdog declarations from config.h to nmi.hJan Beulich2013-02-151-0/+1
| | | | | | | They don't belong into the former. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* xen: Fix some over-long source lines.Keir Fraser2013-01-301-5/+8
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* xen: Define debug_build() based on NDEBUG. Use it in a few printk's.Keir Fraser2013-01-301-6/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* xen: print "debug=y|n" during hypervisor startupDario Faggioli2013-01-301-2/+7
| | | | | | | | So that we can easily figure out whether or not we are running a debug build of Xen (e.g., via `xl dmesg'). Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* xen: infrastructure to have cross-platform video driversStefano Stabellini2013-01-241-6/+6
| | | | | | | | | | | | | | - introduce a new HAS_VIDEO config variable; - build xen/drivers/video/font* if HAS_VIDEO; - rename vga_puts to video_puts; - rename vga_init to video_init; - rename vga_endboot to video_endboot. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen/xsm: Add xsm_default parameter to XSM hooksDaniel De Graaf2013-01-111-1/+1
| | | | | | | | | | | | | | Include the default XSM hook action as the first argument of the hook to facilitate quick understanding of how the call site is expected to be used (dom0-only, arbitrary guest, or device model). This argument does not solely define how a given hook is interpreted, since any changes to the hook's default action need to be made identically to all callers of a hook (if there are multiple callers; most hooks only have one), and may also require changing the arguments of the hook. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Keir Fraser <keir@xen.org>
* xen: use XSM instead of IS_PRIV where duplicatedDaniel De Graaf2013-01-111-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Xen hypervisor has two basic access control function calls: IS_PRIV and the xsm_* functions. Most privileged operations currently require that both checks succeed, and many times the checks are at different locations in the code. This patch eliminates the explicit and implicit IS_PRIV checks that are duplicated in XSM hooks. When XSM_ENABLE is not defined or when the dummy XSM module is used, this patch should not change any functionality. Because the locations of privilege checks have sometimes moved below argument validation, error returns of some functions may change from EPERM to EINVAL or ESRCH if called with invalid arguments and from a domain without permission to perform the operation. Some checks are removed due to non-obvious duplicates in their callers: * acpi_enter_sleep is checked in XENPF_enter_acpi_sleep * map_domain_pirq has IS_PRIV_FOR checked in its callers: * physdev_map_pirq checks when acquiring the RCU lock * ioapic_guest_write is checked in PHYSDEVOP_apic_write * PHYSDEVOP_{manage_pci_add,manage_pci_add_ext,pci_device_add} are checked by xsm_resource_plug_pci in pci_add_device * PHYSDEVOP_manage_pci_remove is checked by xsm_resource_unplug_pci in pci_remove_device * PHYSDEVOP_{restore_msi,restore_msi_ext} are checked by xsm_resource_setup_pci in pci_restore_msi_state * do_console_io has changed to IS_PRIV from an explicit domid==0 Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Jan Beulich <jbeulich@suse.com> Committed-by: Keir Fraser <keir@xen.org>
* xen: replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when appropriateStefano Stabellini2012-10-171-3/+3
| | | | | | | | | | | | Note: these changes don't make any difference on x86. Replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when it is used as an hypercall argument. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen/console: introduce a 'w' debug-key that dumps the console ringMatt Wilson2012-10-011-0/+45
| | | | | | | | | | This patch adds a new 'w' debug-key, chosen from the limited remaining keys only due to its proximity to 'q', that dumps the console ring to configured console devices. It's useful to for tracking down how an unresponsive system got into a broken state via serial console. Signed-off-by: Matt Wilson <msw@amazon.com> Committed-by: Keir Fraser <keir@xen.org>
* console: prepare for non-COMn port supportJan Beulich2012-09-111-2/+4
| | | | | | | | | | Widen SERHND_IDX (and use it where needed), introduce a flush low level driver method, and remove unnecessary peeking of the common code at the (driver specific) serial port identification string in the "console=" command line option value. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* kexec: provide crashinfo_maxaddr_bits if !CONFIG_KEXECDavid Vrabel2012-03-221-2/+0
| | | | | | | | Fix the build where !CONFIG_KEXEC (e.g., arm) by providing a default crashinfo_maxaddr_bits. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* KEXEC: Allocate crash structures in low memoryAndrew Cooper2012-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On 64bit Xen with 32bit dom0 and crashkernel, xmalloc'ing items such as the CPU crash notes will go into the xenheap, which tends to be in upper memory. This causes problems on machines with more than 64GB (or 4GB if no PAE support) of ram as the crashkernel physically cant access the crash notes. The solution is to force Xen to allocate certain structures in lower memory. This is achieved by introducing two new command line parameters; low_crashinfo and crashinfo_maxaddr. Because of the potential impact on 32bit PV guests, and that this problem does not exist for 64bit dom0 on 64bit Xen, this new functionality defaults to the codebase's previous behavior, requiring the user to explicitly add extra command line parameters to change the behavior. This patch consists of 3 logically distinct but closely related changes. 1) Add the two new command line parameters. 2) Change crash note allocation to use lower memory when instructed. 3) Change the conring buffer to use lower memory when instructed. There result is that the crash notes and console ring will be placed in lower memory so useful information can be recovered in the case of a crash. Changes since v1: - Patch xen-command-line.markdown to document new options Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* xen/common/Makefile: introduce HAS_{CPUFREQ,PCI,PASSTHROUGH,NS16550,KEXEC}Stefano Stabellini2012-02-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - make the compilation of ns16550.c depend upon HAS_NS16550; - make the compilation of cpufreq depend upon HAS_CPUFREQ; - make the compilation of pci depend upon HAS_PCI; - make the compilation of passthrough depend upon HAS_PASSTHROUGH; - make the compilation of kexec depend upon HAS_KEXEC. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com> --- xen/arch/ia64/Rules.mk | 5 +++++ xen/arch/x86/Rules.mk | 5 +++++ xen/common/Makefile | 2 +- xen/common/shutdown.c | 4 ++++ xen/drivers/Makefile | 6 +++--- xen/drivers/char/Makefile | 2 +- xen/drivers/char/console.c | 4 ++++ xen/include/asm-ia64/config.h | 1 + xen/include/asm-x86/config.h | 1 + 9 files changed, 25 insertions(+), 5 deletions(-)
* xen: allow global VIRQ handlers to be delegated to other domainsDaniel De Graaf2012-01-281-2/+2
| | | | | | | | | | | | | | | | | This patch sends global VIRQs to a domain designated as the VIRQ handler instead of sending all global VIRQ events to dom0. This is required in order to run xenstored in a stubdom, because VIRQ_DOM_EXC must be sent to xenstored for domain destruction to work properly. This patch was inspired by the xenstored stubdomain patch series sent to xen-devel by Alex Zeffertt in 2009. Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* Console: introduce console=none command line parameterAndrew Cooper2012-01-281-0/+2
| | | | | | | | | | | | | | | | | | Currenty, not specifying 'console=<foo>' on the command line causes Xen to default to 'vga'. Alternativly, the user can explicitly specifiy 'console=vga|com1|com2'. However, there is no way to specify that neither vga nor serial should be used. Specifying 'console=' does have the effect that neither vga nor serial is set up, but at the cost of an "Bad console= option ''" warning. Therefore, expliticly support a 'console=none' option which does not set up vga and does not set up serial, but does not trigger the bad console warning. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* Include some header files that are not automatically included on all archsStefano Stabellini2012-01-231-0/+1
| | | | | | | Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* tasklets: Switch a few tasklets to run in softirq context.Keir Fraser2011-06-161-1/+2
| | | | | | | There are a couple of others which may also be safe. I've converted only the most obvious one. Signed-off-by: Keir Fraser <keir@xen.org>
* xen: Include headers that are actually needed, drop everything else.Christoph Egger2011-05-201-11/+0
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Use bool_t for various boolean variablesKeir Fraser2010-12-241-3/+3
| | | | | | | | | | | ... decreasing cache footprint. As a prerequisite this requires making cmdline_parse() a little more flexible. Also remove a few variables altogether, and adjust sections annotations for several others. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xen.org>
* Remove unused function console_force_lock().Keir Fraser2010-09-161-5/+0
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* console: Make initial static console buffer __initdata.Keir Fraser2010-04-221-19/+8
| | | | | | | | | | | | | The previous scheme --- freeing an area of BSS --- did not interact nicely with device passthrough as IOMMU will not have any Xen BSS area in guest device pagetables. Hence if the freed BSS space gets allocated to a guest, DMAs to guest's own memory can fail. The simple solution here is to always free the static buffer at end of boot (initmem is specially handled for IOMMUs) and require a dynamically-allocated buffer always to be created. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Move tasklet implementation into its own source files.Keir Fraser2010-04-191-0/+1
| | | | | | | | This is preparation for implementing tasklets in vcpu context rather than softirq context. There is no change to the implementation of tasklets in this patch. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Increase default console ring allocation size and reduce default verbosityKeir Fraser2010-03-171-1/+10
| | | | | | | | | | | | | | | | | | | | In order to have better chance that relevant messages fit into the ring buffer, allocate a dynamic (larger) one in more cases, and make the default allocation size depend on both the number of CPUs and the log level. Also free the static buffer if a dynamic one was obtained. In order for "xm dmesg" to retrieve larger buffers, eliminate pyxc_readconsolering()'s 32k limitation resulting from the use of a statically allocated buffer. Finally, suppress on x86 most per-CPU boot time messages (by default, most of them can be re-enabled with a new command line option "cpuinfo", some others are now only printed more than once when there are inconsistencies between CPUs). This reduces both boot time (namely when a graphical console is in use) and pressure on the console ring and serial transmit buffers. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Fix incremental access to hypervisor console logKeir Fraser2010-03-151-1/+1
| | | | | | | "xenconsoled --log=hv" outputs duplicated messages to /var/log/xen/hypervisor.log. Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
* Replace process_pending_timers() with process_pending_softirqs().Keir Fraser2009-12-221-1/+1
| | | | | | | | | This ensures that any critical softirqs are handled in a timely manner (e.g., TIME_CALIBRATE_SOFTIRQ) while still avoiding being preempted by the scheduler (by SCHEDULE_SOFTIRQ), which is the reason for avoiding use of do_softirq() directly. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Miscellaneous data placement adjustmentsKeir Fraser2009-10-281-14/+15
| | | | | | | Make various data items const or __read_mostly where possible/reasonable. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Scattered code arrangement cleanups.Keir Fraser2009-10-071-0/+1
| | | | | | | | - remove redundant declarations - add/move prototypes to headers - move things where they belong to Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Cleanup: Make local functions static and remove unused functions.Keir Fraser2009-09-301-10/+0
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Remove "buffer half full" check from guest_console_writeKeir Fraser2009-09-161-7/+0
| | | | | | | | Checks are made at a lower level in the serial code, and teh policy there is to drop rather than wait. So boot makes progress even when serial hardware is problematic. Signed-off-by: Chris Lalancette <clalance@redhat.com>
* properly __initdata-annotate command line option string buffersKeir Fraser2009-08-311-2/+2
| | | | Signed-off-by: Jan Beulich <jbeulich@novell.com>
* introduce size_param()Keir Fraser2009-08-311-4/+2
| | | | | | | | | | | With there being several instances of custom_param() where the handler is just invoking parse_size_and_unit(), it seems to make sense to introduce a simplifying abstraction. Also fix serial_txbufsz not having been guaranteed to be a power of two. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Adjust non-default sized console ring allocationKeir Fraser2009-08-311-3/+4
| | | | | | | | | | | | | | | Using xmalloc() for objects that are guaranteed to be at least as large as a page is wasteful, as it will always result in more (here: double the amount) being allocated. The other adjustments are more cosmetic: - Updating conring and conring_size can be done so NMI/MCE generated messages don't use the new (larger) size with the old (smaller) buffer. - The size printed can be in KiB (for the value to be easier to grasp) since it is always a multiple of the default of 16KiB. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Add a single trigger for all diagnostic keyhandlersKeir Fraser2009-08-021-2/+6
| | | | | | | | | | Add a new keyhandler that triggers all the side-effect-free keyhandlers. This lets automated tests (and users) log the full set of keyhandlers without having to be aware of which ones might reboot the host. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* New option conring_size= to allow larger console ring.Keir Fraser2009-04-141-11/+50
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Avoid deadlock in tasklet_schedule() after console_force_unlock().Keir Fraser2009-03-091-4/+9
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Do not deadlock in scheduler when sending VIRQ_CON_RING.Keir Fraser2009-03-061-2/+8
| | | | | | Instead defer the virq notification to tasklet context. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Allow memflags to be specified to alloc_xenheap_pages().Keir Fraser2009-01-281-1/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* xen: Fix gcc 4.3 build failure.Keir Fraser2008-11-261-1/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Check the existence of serial port before usingKeir Fraser2008-09-121-3/+11
| | | | | Signed-off-by: Huacai Chen <huacai.chen@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Delay 5 seconds on reboot *after* stopping all CPUs.Keir Fraser2008-08-041-2/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Bring back console_start_log_everything() as a milder alternative toKeir Fraser2008-06-131-0/+12
| | | | | | | | | | console_start_sync(). Revert keyhandler logic to use it. The difference now is that serial logic is updated to not drop characters if inb a log_everything region. Still this is milder than a sync region since the async buffer must be filled before we start to busy-wait on each character. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Improve serial output when dropping characters to drop them in bigKeir Fraser2008-06-131-12/+2
| | | | | | | | batches. Printing one character in one thousand is not useful! Also make debug handlers all print synchronously. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>