* [PATCH] xen: Fix inconsistent callers of panic()
@ 2018-08-30 12:31 Andrew Cooper
2018-08-30 14:07 ` Jan Beulich
2018-09-10 11:21 ` Julien Grall
0 siblings, 2 replies; 13+ messages in thread
From: Andrew Cooper @ 2018-08-30 12:31 UTC (permalink / raw)
To: Xen-devel
Cc: Andrew Cooper, Julien Grall, Stefano Stabellini, Wei Liu,
Jan Beulich
Callers are inconsistent with whether they pass a newline to panic(),
including adjacent calls in the same function using different styles.
painc() not expecting a newline is inconsistent with most other printing
functions, which is most likely why we've gained so many inconsistencies.
Switch panic() to expect a newline, and update all callers which currently
lack a newline to include one.
This actually reduces the size of .rodata (0x07e3e8 down to 0x07e3a8) because
a number of strings are passed to both panic() and printk(). As they
previously differed by \n alone, they couldn't be merged.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
(Restricted to the core arch maintainers as this is a tree-wide piece of
cleanup with no functional impact to other areas.)
The observant amongst you might realise that this reverts parts of c/s
51ad90aea21c - What can I say? Several years of hindsight is very useful, and
at the time I did ask the maintainers which option they thought would be
better...
---
xen/arch/arm/arm32/vfp.c | 2 +-
xen/arch/arm/arm64/traps.c | 2 +-
xen/arch/arm/domain_build.c | 20 ++++++++++----------
xen/arch/arm/gic-v2.c | 24 ++++++++++++------------
xen/arch/arm/gic-v3-its.c | 4 ++--
xen/arch/arm/gic-v3.c | 14 +++++++-------
xen/arch/arm/gic.c | 10 +++++-----
xen/arch/arm/kernel.c | 8 ++++----
xen/arch/arm/mm.c | 2 +-
xen/arch/arm/p2m.c | 2 +-
xen/arch/arm/platform.c | 2 +-
xen/arch/arm/platforms/xgene-storm.c | 6 +++---
xen/arch/arm/setup.c | 12 ++++++------
xen/arch/arm/smpboot.c | 2 +-
xen/arch/arm/time.c | 8 ++++----
xen/arch/arm/traps.c | 8 ++++----
xen/arch/arm/vgic/vgic.c | 2 +-
xen/arch/x86/acpi/power.c | 2 +-
xen/arch/x86/alternative.c | 2 +-
xen/arch/x86/apic.c | 5 ++---
xen/arch/x86/cpu/mcheck/mce.c | 4 ++--
xen/arch/x86/guest/xen.c | 18 +++++++++---------
xen/arch/x86/hvm/dom0_build.c | 2 +-
xen/arch/x86/hvm/svm/intr.c | 2 +-
xen/arch/x86/io_apic.c | 8 ++++----
xen/arch/x86/mm/mm-locks.h | 2 +-
xen/arch/x86/mpparse.c | 10 +++++-----
xen/arch/x86/numa.c | 2 +-
xen/arch/x86/pv/dom0_build.c | 20 ++++++++++----------
xen/arch/x86/pv/shim.c | 2 +-
xen/arch/x86/setup.c | 16 ++++++++--------
xen/arch/x86/smpboot.c | 4 ++--
xen/arch/x86/tboot.c | 2 +-
xen/arch/x86/time.c | 6 +++---
xen/arch/x86/traps.c | 16 ++++++++--------
xen/arch/x86/x86_64/mm.c | 2 +-
xen/arch/x86/x86_64/traps.c | 2 +-
xen/common/domain.c | 2 +-
xen/common/gunzip.c | 2 +-
xen/common/schedule.c | 2 +-
xen/common/ubsan/ubsan.c | 2 +-
xen/common/warning.c | 2 +-
xen/drivers/char/console.c | 2 +-
xen/drivers/passthrough/iommu.c | 5 ++---
xen/drivers/passthrough/pci.c | 2 +-
xen/drivers/passthrough/vtd/dmar.h | 2 +-
xen/drivers/passthrough/vtd/iommu.c | 4 ++--
xen/xsm/flask/hooks.c | 4 ++--
48 files changed, 141 insertions(+), 143 deletions(-)
diff --git a/xen/arch/arm/arm32/vfp.c b/xen/arch/arm/arm32/vfp.c
index 5b80053..0069acd 100644
--- a/xen/arch/arm/arm32/vfp.c
+++ b/xen/arch/arm/arm32/vfp.c
@@ -80,7 +80,7 @@ static __init int vfp_init(void)
vfparch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT;
if ( vfparch < 2 )
- panic("Xen only support VFP 3");
+ panic("Xen only support VFP 3\n");
return 0;
}
diff --git a/xen/arch/arm/arm64/traps.c b/xen/arch/arm/arm64/traps.c
index 38470a1..e524019 100644
--- a/xen/arch/arm/arm64/traps.c
+++ b/xen/arch/arm/arm64/traps.c
@@ -40,7 +40,7 @@ void do_bad_mode(struct cpu_user_regs *regs, int reason)
local_irq_disable();
show_execution_state(regs);
- panic("bad mode");
+ panic("bad mode\n");
}
/*
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index e1c79b2..745153d 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -125,7 +125,7 @@ static bool __init insert_11_bank(struct domain *d,
res = guest_physmap_add_page(d, _gfn(mfn_x(smfn)), smfn, order);
if ( res )
- panic("Failed map pages to DOM0: %d", res);
+ panic("Failed map pages to DOM0: %d\n", res);
kinfo->unassigned_mem -= size;
@@ -289,7 +289,7 @@ static void __init allocate_memory(struct domain *d, struct kernel_info *kinfo)
/* Failed to allocate bank0 under 4GB */
if ( is_32bit_domain(d) )
- panic("Unable to allocate first memory bank.");
+ panic("Unable to allocate first memory bank\n");
/* Try to allocate memory from above 4GB */
printk(XENLOG_INFO "No bank has been allocated below 4GB.\n");
@@ -598,7 +598,7 @@ static int __init make_hypervisor_node(struct domain *d,
*/
if ((addrcells != 1 && addrcells != 2) ||
(sizecells != 1 && sizecells != 2))
- panic("Cannot cope with this size");
+ panic("Cannot cope with this size\n");
/* See linux Documentation/devicetree/bindings/arm/xen.txt */
res = fdt_begin_node(fdt, "hypervisor");
@@ -1586,7 +1586,7 @@ static void __init acpi_map_other_tables(struct domain *d)
if ( res )
{
panic(XENLOG_ERR "Unable to map ACPI region 0x%"PRIx64
- " - 0x%"PRIx64" in domain \n",
+ " - 0x%"PRIx64" in domain\n",
addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1);
}
}
@@ -1994,7 +1994,7 @@ static void __init dtb_load(struct kernel_info *kinfo)
fdt_totalsize(kinfo->fdt));
if ( left != 0 )
- panic("Unable to copy the DTB to dom0 memory (left = %lu bytes)", left);
+ panic("Unable to copy the DTB to dom0 memory (left = %lu bytes)\n", left);
xfree(kinfo->fdt);
}
@@ -2021,30 +2021,30 @@ static void __init initrd_load(struct kernel_info *kinfo)
/* Fix up linux,initrd-start and linux,initrd-end in /chosen */
node = fdt_path_offset(kinfo->fdt, "/chosen");
if ( node < 0 )
- panic("Cannot find the /chosen node");
+ panic("Cannot find the /chosen node\n");
cellp = (__be32 *)val;
dt_set_cell(&cellp, ARRAY_SIZE(val), load_addr);
res = fdt_setprop_inplace(kinfo->fdt, node, "linux,initrd-start",
val, sizeof(val));
if ( res )
- panic("Cannot fix up \"linux,initrd-start\" property");
+ panic("Cannot fix up \"linux,initrd-start\" property\n");
cellp = (__be32 *)val;
dt_set_cell(&cellp, ARRAY_SIZE(val), load_addr + len);
res = fdt_setprop_inplace(kinfo->fdt, node, "linux,initrd-end",
val, sizeof(val));
if ( res )
- panic("Cannot fix up \"linux,initrd-end\" property");
+ panic("Cannot fix up \"linux,initrd-end\" property\n");
initrd = ioremap_wc(paddr, len);
if ( !initrd )
- panic("Unable to map the hwdom initrd");
+ panic("Unable to map the hwdom initrd\n");
res = copy_to_guest_phys_flush_dcache(kinfo->d, load_addr,
initrd, len);
if ( res != 0 )
- panic("Unable to copy the initrd in the hwdom memory");
+ panic("Unable to copy the initrd in the hwdom memory\n");
}
/*
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index d2dcafb..e7eb01f 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -941,7 +941,7 @@ static void gicv2_add_v2m_frame_to_list(paddr_t addr, paddr_t size,
base = ioremap_nocache(addr, size);
if ( !base )
- panic("GICv2: Cannot remap v2m register frame");
+ panic("GICv2: Cannot remap v2m register frame\n");
msi_typer = readl_relaxed(base + V2M_MSI_TYPER);
spi_start = V2M_MSI_TYPER_BASE_SPI(msi_typer);
@@ -960,7 +960,7 @@ static void gicv2_add_v2m_frame_to_list(paddr_t addr, paddr_t size,
/* Allocate an entry to record new v2m frame information. */
v2m_data = xzalloc_bytes(sizeof(struct v2m_data));
if ( !v2m_data )
- panic("GICv2: Cannot allocate memory for v2m frame");
+ panic("GICv2: Cannot allocate memory for v2m frame\n");
INIT_LIST_HEAD(&v2m_data->entry);
v2m_data->addr = addr;
@@ -998,7 +998,7 @@ static void gicv2_extension_dt_init(const struct dt_device_node *node)
/* Get register frame resource from DT. */
if ( dt_device_get_address(v2m, 0, &addr, &size) )
- panic("GICv2: Cannot find a valid v2m frame address");
+ panic("GICv2: Cannot find a valid v2m frame address\n");
/*
* Check whether DT uses msi-base-spi and msi-num-spis properties to
@@ -1024,23 +1024,23 @@ static void __init gicv2_dt_init(void)
res = dt_device_get_address(node, 0, &dbase, NULL);
if ( res )
- panic("GICv2: Cannot find a valid address for the distributor");
+ panic("GICv2: Cannot find a valid address for the distributor\n");
res = dt_device_get_address(node, 1, &cbase, &csize);
if ( res )
- panic("GICv2: Cannot find a valid address for the CPU");
+ panic("GICv2: Cannot find a valid address for the CPU\n");
res = dt_device_get_address(node, 2, &hbase, NULL);
if ( res )
- panic("GICv2: Cannot find a valid address for the hypervisor");
+ panic("GICv2: Cannot find a valid address for the hypervisor\n");
res = dt_device_get_address(node, 3, &vbase, &vsize);
if ( res )
- panic("GICv2: Cannot find a valid address for the virtual CPU");
+ panic("GICv2: Cannot find a valid address for the virtual CPU\n");
res = platform_get_irq(node, 0);
if ( res < 0 )
- panic("GICv2: Cannot find the maintenance IRQ");
+ panic("GICv2: Cannot find the maintenance IRQ\n");
gicv2_info.maintenance_irq = res;
/* TODO: Add check on distributor */
@@ -1215,7 +1215,7 @@ static void __init gicv2_acpi_init(void)
{
const char *msg = acpi_format_exception(status);
- panic("GICv2: Failed to get MADT table, %s", msg);
+ panic("GICv2: Failed to get MADT table, %s\n", msg);
}
/* Collect CPU base addresses */
@@ -1223,7 +1223,7 @@ static void __init gicv2_acpi_init(void)
gic_acpi_parse_madt_cpu, table,
ACPI_MADT_TYPE_GENERIC_INTERRUPT, 0);
if ( count <= 0 )
- panic("GICv2: No valid GICC entries exists");
+ panic("GICv2: No valid GICC entries exists\n");
/*
* Find distributor base address. We expect one distributor entry since
@@ -1233,7 +1233,7 @@ static void __init gicv2_acpi_init(void)
gic_acpi_parse_madt_distributor, table,
ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR, 0);
if ( count <= 0 )
- panic("GICv2: No valid GICD entries exists");
+ panic("GICv2: No valid GICD entries exists\n");
}
#else
static void __init gicv2_acpi_init(void) { }
@@ -1263,7 +1263,7 @@ static int __init gicv2_init(void)
if ( (dbase & ~PAGE_MASK) || (cbase & ~PAGE_MASK) ||
(hbase & ~PAGE_MASK) || (vbase & ~PAGE_MASK) )
- panic("GICv2 interfaces not page aligned");
+ panic("GICv2 interfaces not page aligned\n");
gicv2.map_dbase = ioremap_nocache(dbase, PAGE_SIZE);
if ( !gicv2.map_dbase )
diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 6127894..ba4bc00 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -992,7 +992,7 @@ static void add_to_host_its_list(paddr_t addr, paddr_t size,
its_data = xzalloc(struct host_its);
if ( !its_data )
- panic("GICv3: Cannot allocate memory for ITS frame");
+ panic("GICv3: Cannot allocate memory for ITS frame\n");
its_data->addr = addr;
its_data->size = size;
@@ -1020,7 +1020,7 @@ static void gicv3_its_dt_init(const struct dt_device_node *node)
continue;
if ( dt_device_get_address(its, 0, &addr, &size) )
- panic("GICv3: Cannot find a valid ITS frame address");
+ panic("GICv3: Cannot find a valid ITS frame address\n");
add_to_host_its_list(addr, size, its);
}
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index b2ed0f8..c98a163 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1345,7 +1345,7 @@ static void __init gicv3_init_v2(void)
static void __init gicv3_ioremap_distributor(paddr_t dist_paddr)
{
if ( dist_paddr & ~PAGE_MASK )
- panic("GICv3: Found unaligned distributor address %"PRIpaddr"",
+ panic("GICv3: Found unaligned distributor address %"PRIpaddr"\n",
dbase);
gicv3.map_dbase = ioremap_nocache(dist_paddr, SZ_64K);
@@ -1361,7 +1361,7 @@ static void __init gicv3_dt_init(void)
res = dt_device_get_address(node, 0, &dbase, NULL);
if ( res )
- panic("GICv3: Cannot find a valid distributor address");
+ panic("GICv3: Cannot find a valid distributor address\n");
gicv3_ioremap_distributor(dbase);
@@ -1392,7 +1392,7 @@ static void __init gicv3_dt_init(void)
res = platform_get_irq(node, 0);
if ( res < 0 )
- panic("GICv3: Cannot find the maintenance IRQ");
+ panic("GICv3: Cannot find the maintenance IRQ\n");
gicv3_info.maintenance_irq = res;
/*
@@ -1652,7 +1652,7 @@ static void __init gicv3_acpi_init(void)
count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR,
gic_acpi_parse_madt_distributor, 0);
if ( count <= 0 )
- panic("GICv3: No valid GICD entries exists");
+ panic("GICv3: No valid GICD entries exists\n");
gicv3_ioremap_distributor(dbase);
@@ -1664,7 +1664,7 @@ static void __init gicv3_acpi_init(void)
count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,
gic_acpi_get_madt_cpu_num, 0);
if (count <= 0)
- panic("GICv3: No valid GICR entries exists");
+ panic("GICv3: No valid GICR entries exists\n");
gicr_table = false;
}
@@ -1684,13 +1684,13 @@ static void __init gicv3_acpi_init(void)
count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,
gic_acpi_parse_cpu_redistributor, count);
if ( count <= 0 )
- panic("GICv3: Can't get Redistributor entry");
+ panic("GICv3: Can't get Redistributor entry\n");
/* Collect CPU base addresses */
count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,
gic_acpi_parse_madt_cpu, 0);
if ( count <= 0 )
- panic("GICv3: No valid GICC entries exists");
+ panic("GICv3: No valid GICC entries exists\n");
gicv3.rdist_stride = 0;
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 5474030..e524ad5 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -246,7 +246,7 @@ static void __init gic_dt_preinit(void)
}
}
if ( !num_gics )
- panic("Unable to find compatible GIC in the device tree");
+ panic("Unable to find compatible GIC in the device tree\n");
/* Set the GIC as the primary interrupt controller */
dt_interrupt_controller = node;
@@ -261,12 +261,12 @@ static void __init gic_acpi_preinit(void)
header = acpi_table_get_entry_madt(ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR, 0);
if ( !header )
- panic("No valid GICD entries exists");
+ panic("No valid GICD entries exists\n");
dist = container_of(header, struct acpi_madt_generic_distributor, header);
if ( acpi_device_init(DEVICE_GIC, NULL, dist->version) )
- panic("Unable to find compatible GIC in the ACPI table");
+ panic("Unable to find compatible GIC in the ACPI table\n");
}
#else
static void __init gic_acpi_preinit(void) { }
@@ -287,7 +287,7 @@ void __init gic_preinit(void)
void __init gic_init(void)
{
if ( gic_hw_ops->init() )
- panic("Failed to initialize the GIC drivers");
+ panic("Failed to initialize the GIC drivers\n");
/* Clear LR mask for cpu0 */
clear_cpu_lr_mask();
}
@@ -364,7 +364,7 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)
smp_call_function_interrupt();
break;
default:
- panic("Unhandled SGI %d on CPU%d", sgi, smp_processor_id());
+ panic("Unhandled SGI %d on CPU%d\n", sgi, smp_processor_id());
break;
}
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 000d939..da8410e 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -87,7 +87,7 @@ static void __init place_modules(struct kernel_info *info,
paddr_t modbase;
if ( modsize + kernsize > ramsize )
- panic("Not enough memory in the first bank for the kernel+dtb+initrd");
+ panic("Not enough memory in the first bank for the kernel+dtb+initrd\n");
/*
* DTB must be loaded such that it does not conflict with the
@@ -114,7 +114,7 @@ static void __init place_modules(struct kernel_info *info,
modbase = kernbase - modsize;
else
{
- panic("Unable to find suitable location for dtb+initrd");
+ panic("Unable to find suitable location for dtb+initrd\n");
return;
}
@@ -171,12 +171,12 @@ static void __init kernel_zimage_load(struct kernel_info *info)
kernel = ioremap_wc(paddr, len);
if ( !kernel )
- panic("Unable to map the hwdom kernel");
+ panic("Unable to map the hwdom kernel\n");
rc = copy_to_guest_phys_flush_dcache(info->d, load_addr,
kernel, len);
if ( rc != 0 )
- panic("Unable to copy the kernel in the hwdom memory");
+ panic("Unable to copy the kernel in the hwdom memory\n");
iounmap(kernel);
}
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index de9b965..7a06a33 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -830,7 +830,7 @@ void __init setup_xenheap_mappings(unsigned long base_mfn,
}
if ( base_mfn < mfn_x(xenheap_mfn_start) )
- panic("cannot add xenheap mapping at %lx below heap start %lx",
+ panic("cannot add xenheap mapping at %lx below heap start %lx\n",
base_mfn, mfn_x(xenheap_mfn_start));
end_mfn = base_mfn + nr_mfns;
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 56b5474..1364e59 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1164,7 +1164,7 @@ static void p2m_vmid_allocator_init(void)
vmid_mask = xzalloc_array(unsigned long, BITS_TO_LONGS(MAX_VMID));
if ( !vmid_mask )
- panic("Could not allocate VMID bitmap space");
+ panic("Could not allocate VMID bitmap space\n");
set_bit(INVALID_VMID, vmid_mask);
}
diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
index 3f2989e..6989e58 100644
--- a/xen/arch/arm/platform.c
+++ b/xen/arch/arm/platform.c
@@ -71,7 +71,7 @@ void __init platform_init(void)
res = platform->init();
if ( res )
- panic("Unable to initialize the platform");
+ panic("Unable to initialize the platform\n");
}
int __init platform_init_time(void)
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
index deb8479..fced4d7 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -48,11 +48,11 @@ static void __init xgene_check_pirq_eoi(void)
node = dt_find_interrupt_controller(xgene_dt_int_ctrl_match);
if ( !node )
- panic("%s: Can not find interrupt controller node", __func__);
+ panic("%s: Can not find interrupt controller node\n", __func__);
res = dt_device_get_address(node, 0, &dbase, NULL);
if ( !dbase )
- panic("%s: Cannot find a valid address for the distributor", __func__);
+ panic("%s: Cannot find a valid address for the distributor\n", __func__);
/*
* In old X-Gene Storm firmware and DT, secure mode addresses have
@@ -62,7 +62,7 @@ static void __init xgene_check_pirq_eoi(void)
*/
if ( dbase == XGENE_SEC_GICV2_DIST_ADDR )
panic("OLD X-Gene Firmware is not supported by Xen.\n"
- "Please upgrade your firmware to the latest version");
+ "Please upgrade your firmware to the latest version\n");
}
static uint32_t xgene_storm_quirks(void)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 45f3841..1aafa26 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -424,7 +424,7 @@ static paddr_t __init get_xen_paddr(void)
}
if ( !paddr )
- panic("Not enough memory to relocate Xen");
+ panic("Not enough memory to relocate Xen\n");
printk("Placing Xen at 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
paddr, paddr + min_size);
@@ -482,7 +482,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
void *fdt;
if ( !bootinfo.mem.nr_banks )
- panic("No memory bank");
+ panic("No memory bank\n");
init_pdx();
@@ -537,7 +537,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
} while ( !opt_xenheap_megabytes && xenheap_pages > 32<<(20-PAGE_SHIFT) );
if ( ! e )
- panic("Not not enough space for xenheap");
+ panic("Not not enough space for xenheap\n");
domheap_pages = heap_pages - xenheap_pages;
@@ -713,7 +713,7 @@ void __init start_xen(unsigned long boot_phys_offset,
if ( !device_tree_flattened )
panic("Invalid device tree blob at physical address %#lx.\n"
"The DTB must be 8-byte aligned and must not exceed 2 MB in size.\n\n"
- "Please check your bootloader.",
+ "Please check your bootloader.\n",
fdt_paddr);
fdt_size = boot_fdt_info(device_tree_flattened, fdt_paddr);
@@ -851,10 +851,10 @@ void __init start_xen(unsigned long boot_phys_offset,
dom0 = domain_create(0, &dom0_cfg, true);
if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
- panic("Error creating domain 0");
+ panic("Error creating domain 0\n");
if ( construct_dom0(dom0) != 0)
- panic("Could not set up DOM0 guest OS");
+ panic("Could not set up DOM0 guest OS\n");
heap_init_late();
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index cf3a4ce..25cd445 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -82,7 +82,7 @@ static void setup_cpu_sibling_map(int cpu)
{
if ( !zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, cpu)) ||
!zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)) )
- panic("No memory for CPU sibling/core maps");
+ panic("No memory for CPU sibling/core maps\n");
/* A CPU is a sibling with itself and is always on its own core. */
cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index 1635c88..bbccee7 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -122,7 +122,7 @@ static void __init preinit_dt_xen_time(void)
timer = dt_find_matching_node(NULL, timer_ids);
if ( !timer )
- panic("Unable to find a compatible timer in the device tree");
+ panic("Unable to find a compatible timer in the device tree\n");
dt_device_set_used_by(timer, DOMID_XEN);
@@ -149,7 +149,7 @@ void __init preinit_xen_time(void)
res = platform_init_time();
if ( res )
- panic("Timer: Cannot initialize platform timer");
+ panic("Timer: Cannot initialize platform timer\n");
boot_count = READ_SYSREG64(CNTPCT_EL0);
}
@@ -165,7 +165,7 @@ static void __init init_dt_xen_time(void)
res = platform_get_irq(timer, i);
if ( res < 0 )
- panic("Timer: Unable to retrieve IRQ %u from the device tree", i);
+ panic("Timer: Unable to retrieve IRQ %u from the device tree\n", i);
timer_irq[i] = res;
}
}
@@ -178,7 +178,7 @@ int __init init_xen_time(void)
/* Check that this CPU supports the Generic Timer interface */
if ( !cpu_has_gentimer )
- panic("CPU does not support the Generic Timer v1 interface");
+ panic("CPU does not support the Generic Timer v1 interface\n");
printk("Generic Timer IRQ: phys=%u hyp=%u virt=%u Freq: %lu KHz\n",
timer_irq[TIMER_PHYS_NONSECURE_PPI],
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 9ae64ae..0f4b1f2 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -399,7 +399,7 @@ void panic_PAR(uint64_t par)
second_in_first ? " during second stage lookup" : "",
fsc_level_str(level));
- panic("Error during Hypervisor-to-physical address translation");
+ panic("Error during Hypervisor-to-physical address translation\n");
}
static void cpsr_switch_mode(struct cpu_user_regs *regs, int mode)
@@ -1312,7 +1312,7 @@ int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc)
return 0;
show_execution_state(regs);
- panic("Xen BUG at %s%s:%d", prefix, filename, lineno);
+ panic("Xen BUG at %s%s:%d\n", prefix, filename, lineno);
case BUGFRAME_assert:
/* ASSERT: decode the predicate string pointer. */
@@ -1325,7 +1325,7 @@ int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc)
if ( debugger_trap_fatal(TRAP_invalid_op, regs) )
return 0;
show_execution_state(regs);
- panic("Assertion '%s' failed at %s%s:%d",
+ panic("Assertion '%s' failed at %s%s:%d\n",
predicate, prefix, filename, lineno);
}
@@ -1446,7 +1446,7 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
show_execution_state(regs);
break;
default:
- panic("DOM%d: Unhandled debug trap %#x", domid, code);
+ panic("DOM%d: Unhandled debug trap %#x\n", domid, code);
break;
}
}
diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c
index 832632a..cc5ab67 100644
--- a/xen/arch/arm/vgic/vgic.c
+++ b/xen/arch/arm/vgic/vgic.c
@@ -981,7 +981,7 @@ void vgic_v3_setup_hw(paddr_t dbase,
const struct rdist_region *regions,
unsigned int intid_bits)
{
- panic("New VGIC implementation does not yet support GICv3.");
+ panic("New VGIC implementation does not yet support GICv3\n");
}
#endif
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index a704c7c..93e967f 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -256,7 +256,7 @@ static int enter_state(u32 state)
microcode_resume_cpu(0);
if ( !recheck_cpu_features(0) )
- panic("Missing previously available feature(s).");
+ panic("Missing previously available feature(s)\n");
/* Re-enabled default NMI/#MC use of MSR_SPEC_CTRL. */
ci->spec_ctrl_flags |= (default_spec_ctrl_flags & SCF_ist_wrmsr);
diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index aec4d8d..b8c819a 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -325,7 +325,7 @@ void __init alternative_instructions(void)
mdelay(1);
if ( !ACCESS_ONCE(alt_done) )
- panic("Timed out waiting for alternatives self-NMI to hit");
+ panic("Timed out waiting for alternatives self-NMI to hit\n");
set_nmi_callback(saved_nmi_callback);
}
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index ffa5a69..88ada9d 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -902,8 +902,7 @@ void __init x2apic_bsp_setup(void)
printk("Not enabling x2APIC: depends on iommu_supports_eim.\n");
return;
}
- panic("x2APIC: already enabled by BIOS, but "
- "iommu_supports_eim failed");
+ panic("x2APIC: already enabled by BIOS, but iommu_supports_eim failed\n");
}
if ( (ioapic_entries = alloc_ioapic_entries()) == NULL )
@@ -935,7 +934,7 @@ void __init x2apic_bsp_setup(void)
default:
if ( x2apic_enabled )
panic("Interrupt remapping could not be enabled while "
- "x2APIC is already enabled by BIOS");
+ "x2APIC is already enabled by BIOS\n");
printk(XENLOG_ERR
"Failed to enable Interrupt Remapping: Will not enable x2APIC.\n");
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 32273d9..1eec631 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -1660,7 +1660,7 @@ void mc_panic(char *s)
" The processor has reported a hardware error which cannot\n"
" be recovered from. Xen will now reboot the machine.\n");
mc_panic_dump();
- panic("HARDWARE ERROR");
+ panic("HARDWARE ERROR\n");
}
/*
@@ -1756,7 +1756,7 @@ static int mce_delayed_action(mctelem_cookie_t mctc)
dprintk(XENLOG_ERR, "MCE delayed action failed\n");
is_mc_panic = true;
x86_mcinfo_dump(mctelem_dataptr(mctc));
- panic("MCE: Software recovery failed for the UCR");
+ panic("MCE: Software recovery failed for the UCR\n");
break;
case MCER_RECOVERED:
diff --git a/xen/arch/x86/guest/xen.c b/xen/arch/x86/guest/xen.c
index 2a5554a..cd4acbf 100644
--- a/xen/arch/x86/guest/xen.c
+++ b/xen/arch/x86/guest/xen.c
@@ -99,12 +99,12 @@ static void map_shared_info(void)
unsigned long rc;
if ( hypervisor_alloc_unused_page(&mfn) )
- panic("unable to reserve shared info memory page");
+ panic("unable to reserve shared info memory page\n");
xatp.gpfn = mfn_x(mfn);
rc = xen_hypercall_memory_op(XENMEM_add_to_physmap, &xatp);
if ( rc )
- panic("failed to map shared_info page: %ld", rc);
+ panic("failed to map shared_info page: %ld\n", rc);
set_fixmap(FIX_XEN_SHARED_INFO, mfn_x(mfn) << PAGE_SHIFT);
@@ -168,7 +168,7 @@ static void __init init_memmap(void)
mem = rangeset_new(NULL, "host memory map", 0);
if ( !mem )
- panic("failed to allocate PFN usage rangeset");
+ panic("failed to allocate PFN usage rangeset\n");
/*
* Mark up to the last memory page (or 4GiB) as RAM. This is done because
@@ -178,7 +178,7 @@ static void __init init_memmap(void)
*/
if ( rangeset_add_range(mem, 0, max_t(unsigned long, max_page - 1,
PFN_DOWN(GB(4) - 1))) )
- panic("unable to add RAM to in-use PFN rangeset");
+ panic("unable to add RAM to in-use PFN rangeset\n");
for ( i = 0; i < e820.nr_map; i++ )
{
@@ -186,7 +186,7 @@ static void __init init_memmap(void)
if ( rangeset_add_range(mem, PFN_DOWN(e->addr),
PFN_UP(e->addr + e->size - 1)) )
- panic("unable to add range [%#lx, %#lx] to in-use PFN rangeset",
+ panic("unable to add range [%#lx, %#lx] to in-use PFN rangeset\n",
PFN_DOWN(e->addr), PFN_UP(e->addr + e->size - 1));
}
}
@@ -236,7 +236,7 @@ static void init_evtchn(void)
rc = xen_hypercall_set_evtchn_upcall_vector(this_cpu(vcpu_id),
evtchn_upcall_vector);
if ( rc )
- panic("Unable to set evtchn upcall vector: %d", rc);
+ panic("Unable to set evtchn upcall vector: %d\n", rc);
/* Trick toolstack to think we are enlightened */
{
@@ -309,7 +309,7 @@ static void __init mark_pfn_as_ram(struct e820map *e820, uint64_t pfn)
if ( !e820_change_range_type(e820, pfn << PAGE_SHIFT,
(pfn << PAGE_SHIFT) + PAGE_SIZE,
E820_RESERVED, E820_RAM) )
- panic("Unable to add/change memory type of pfn %#lx to RAM", pfn);
+ panic("Unable to add/change memory type of pfn %#lx to RAM\n", pfn);
}
void __init hypervisor_fixup_e820(struct e820map *e820)
@@ -323,7 +323,7 @@ void __init hypervisor_fixup_e820(struct e820map *e820)
#define MARK_PARAM_RAM(p) ({ \
rc = xen_hypercall_hvm_get_param(p, &pfn); \
if ( rc ) \
- panic("Unable to get " #p); \
+ panic("Unable to get " #p "\n"); \
mark_pfn_as_ram(e820, pfn); \
ASSERT(i < ARRAY_SIZE(reserved_pages)); \
reserved_pages[i++] = pfn << PAGE_SHIFT; \
@@ -367,7 +367,7 @@ void hypervisor_resume(void)
*/
bitmap_zero(vcpu_info_mapped, NR_CPUS);
if ( map_vcpuinfo() && nr_cpu_ids > XEN_LEGACY_MAX_VCPUS )
- panic("unable to remap vCPU info and vCPUs > legacy limit");
+ panic("unable to remap vCPU info and vCPUs > legacy limit\n");
/* Setup event channel upcall vector. */
init_evtchn();
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 5065729..4fe8097 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -319,7 +319,7 @@ static __init void pvh_setup_e820(struct domain *d, unsigned long nr_pages)
*/
d->arch.e820 = xzalloc_array(struct e820entry, e820.nr_map + 1);
if ( !d->arch.e820 )
- panic("Unable to allocate memory for Dom0 e820 map");
+ panic("Unable to allocate memory for Dom0 e820 map\n");
entry_guest = d->arch.e820;
/* Clamp e820 memory map to match the memory assigned to Dom0 */
diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index 8511ff0..5adcd54 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -173,7 +173,7 @@ void svm_intr_assist(void)
/* Guest already enabled an interrupt window. */
return;
default:
- panic("%s: nestedsvm_vcpu_interrupt can't handle value %#x",
+ panic("%s: nestedsvm_vcpu_interrupt can't handle value %#x\n",
__func__, rc);
}
}
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index f959090..daa5e9e 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -123,7 +123,7 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)
if (entry->pin != -1) {
if (irq_2_pin_free_entry >= PIN_MAP_SIZE)
- panic("io_apic.c: whoops");
+ panic("io_apic.c: whoops\n");
entry->next = irq_2_pin_free_entry;
entry = irq_2_pin + entry->next;
irq_2_pin_free_entry = entry->next;
@@ -1425,7 +1425,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
if (!physid_isset(i, phys_id_present_map))
break;
if (i >= get_physical_broadcast())
- panic("Max APIC ID exceeded");
+ panic("Max APIC ID exceeded\n");
printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
i);
mp_ioapics[apic].mpc_apicid = i;
@@ -1993,7 +1993,7 @@ static void __init check_timer(void)
}
printk(" failed :(.\n");
panic("IO-APIC + timer doesn't work! Boot with apic_verbosity=debug "
- "and send a report. Then try booting with the 'noapic' option");
+ "and send a report. Then try booting with the 'noapic' option\n");
}
/*
@@ -2137,7 +2137,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
}
if (i == get_physical_broadcast())
- panic("Max apic_id exceeded");
+ panic("Max apic_id exceeded\n");
printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
"trying %d\n", ioapic, apic_id, i);
diff --git a/xen/arch/x86/mm/mm-locks.h b/xen/arch/x86/mm/mm-locks.h
index e5fceb2..95295b6 100644
--- a/xen/arch/x86/mm/mm-locks.h
+++ b/xen/arch/x86/mm/mm-locks.h
@@ -76,7 +76,7 @@ static inline void _mm_lock(mm_lock_t *l, const char *func, int level, int rec)
l->unlock_level = __get_lock_level();
}
else if ( (unlikely(!rec)) )
- panic("mm lock already held by %s", l->locker_function);
+ panic("mm lock already held by %s\n", l->locker_function);
__set_lock_level(level);
}
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index f3f6d48..f2b6d6b 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -237,7 +237,7 @@ static void __init MP_ioapic_info (struct mpc_config_ioapic *m)
if (nr_ioapics >= MAX_IO_APICS) {
printk(KERN_CRIT "Max # of I/O APICs (%d) exceeded (found %d).\n",
MAX_IO_APICS, nr_ioapics);
- panic("Recompile kernel with bigger MAX_IO_APICS");
+ panic("Recompile kernel with bigger MAX_IO_APICS\n");
}
if (!m->mpc_apicaddr) {
printk(KERN_ERR "WARNING: bogus zero I/O APIC address"
@@ -257,7 +257,7 @@ static void __init MP_intsrc_info (struct mpc_config_intsrc *m)
(m->mpc_irqflag >> 2) & 3, m->mpc_srcbus,
m->mpc_srcbusirq, m->mpc_dstapic, m->mpc_dstirq);
if (++mp_irq_entries == MAX_IRQ_SOURCES)
- panic("Max # of irq sources exceeded");
+ panic("Max # of irq sources exceeded\n");
}
static void __init MP_lintsrc_info (struct mpc_config_lintsrc *m)
@@ -862,7 +862,7 @@ void __init mp_register_ioapic (
if (nr_ioapics >= MAX_IO_APICS) {
printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
"(found %d)\n", MAX_IO_APICS, nr_ioapics);
- panic("Recompile kernel with bigger MAX_IO_APICS");
+ panic("Recompile kernel with bigger MAX_IO_APICS\n");
}
if (!address) {
printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address"
@@ -961,7 +961,7 @@ void __init mp_override_legacy_irq (
mp_irqs[mp_irq_entries] = intsrc;
if (++mp_irq_entries == MAX_IRQ_SOURCES)
- panic("Max # of irq sources exceeded");
+ panic("Max # of irq sources exceeded\n");
return;
}
@@ -1027,7 +1027,7 @@ void __init mp_config_acpi_legacy_irqs (void)
mp_irqs[mp_irq_entries] = intsrc;
if (++mp_irq_entries == MAX_IRQ_SOURCES)
- panic("Max # of irq sources exceeded");
+ panic("Max # of irq sources exceeded\n");
}
}
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index a87987d..0498cbd 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -357,7 +357,7 @@ unsigned int __init arch_get_dma_bitsize(void)
!(node_start_pfn(node) >> (32 - PAGE_SHIFT)) )
break;
if ( node >= MAX_NUMNODES )
- panic("No node with memory below 4Gb");
+ panic("No node with memory below 4Gb\n");
/*
* Try to not reserve the whole node's memory for DMA, but dividing
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 96ff0ee..976ba8d 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -106,13 +106,13 @@ static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
l1_pgentry_t *pl1e = NULL;
if ( v_start <= vphysmap_end && vphysmap_start <= v_end )
- panic("DOM0 P->M table overlaps initial mapping");
+ panic("DOM0 P->M table overlaps initial mapping\n");
while ( vphysmap_start < vphysmap_end )
{
if ( d->tot_pages + ((round_pgup(vphysmap_end) - vphysmap_start)
>> PAGE_SHIFT) + 3 > nr_pages )
- panic("Dom0 allocation too small for initial P->M table");
+ panic("Dom0 allocation too small for initial P->M table\n");
if ( pl1e )
{
@@ -209,7 +209,7 @@ static __init void setup_pv_physmap(struct domain *d, unsigned long pgtbl_pfn,
vphysmap_start &= PAGE_MASK;
}
if ( !page )
- panic("Not enough RAM for DOM0 P->M table");
+ panic("Not enough RAM for DOM0 P->M table\n");
if ( pl1e )
unmap_domain_page(pl1e);
@@ -406,7 +406,7 @@ int __init dom0_construct_pv(struct domain *d,
value = (parms.virt_hv_start_low + mask) & ~mask;
BUG_ON(!is_pv_32bit_domain(d));
if ( value > __HYPERVISOR_COMPAT_VIRT_START )
- panic("Domain 0 expects too high a hypervisor start address");
+ panic("Domain 0 expects too high a hypervisor start address\n");
HYPERVISOR_COMPAT_VIRT_START(d) =
max_t(unsigned int, m2p_compat_vstart, value);
}
@@ -488,7 +488,7 @@ int __init dom0_construct_pv(struct domain *d,
count -= PAGE_ALIGN(initrd_len);
order = get_order_from_bytes(count);
if ( (1UL << order) + PFN_UP(initrd_len) > nr_pages )
- panic("Domain 0 allocation is too small for kernel image");
+ panic("Domain 0 allocation is too small for kernel image\n");
if ( parms.p2m_base != UNSET_ADDR )
{
@@ -497,7 +497,7 @@ int __init dom0_construct_pv(struct domain *d,
}
page = alloc_domheap_pages(d, order, 0);
if ( page == NULL )
- panic("Not enough RAM for domain 0 allocation");
+ panic("Not enough RAM for domain 0 allocation\n");
alloc_spfn = mfn_x(page_to_mfn(page));
alloc_epfn = alloc_spfn + d->tot_pages;
@@ -514,7 +514,7 @@ int __init dom0_construct_pv(struct domain *d,
order = get_order_from_pages(count);
page = alloc_domheap_pages(d, order, 0);
if ( !page )
- panic("Not enough RAM for domain 0 initrd");
+ panic("Not enough RAM for domain 0 initrd\n");
for ( count = -count; order--; )
if ( count & (1UL << order) )
{
@@ -603,7 +603,7 @@ int __init dom0_construct_pv(struct domain *d,
{
page = alloc_domheap_page(d, MEMF_no_owner);
if ( !page )
- panic("Not enough RAM for domain 0 PML4");
+ panic("Not enough RAM for domain 0 PML4\n");
page->u.inuse.type_info = PGT_l4_page_table|PGT_validated|1;
l4start = l4tab = page_to_virt(page);
maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l3_page_table;
@@ -825,7 +825,7 @@ int __init dom0_construct_pv(struct domain *d,
while ( pfn < nr_pages )
{
if ( (page = alloc_chunk(d, nr_pages - d->tot_pages)) == NULL )
- panic("Not enough RAM for DOM0 reservation");
+ panic("Not enough RAM for DOM0 reservation\n");
while ( pfn < d->tot_pages )
{
mfn = mfn_x(page_to_mfn(page));
@@ -904,7 +904,7 @@ int __init dom0_construct_pv(struct domain *d,
pv_destroy_gdt(v);
if ( test_bit(XENFEAT_supervisor_mode_kernel, parms.f_required) )
- panic("Dom0 requires supervisor-mode execution");
+ panic("Dom0 requires supervisor-mode execution\n");
rc = dom0_setup_permissions(d);
BUG_ON(rc != 0);
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 1299112..cdc72f7 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -102,7 +102,7 @@ uint64_t pv_shim_mem(uint64_t avail)
}
if ( total_pages - avail > shim_nrpages )
- panic("pages used by shim > shim_nrpages (%#lx > %#lx)",
+ panic("pages used by shim > shim_nrpages (%#lx > %#lx)\n",
total_pages - avail, shim_nrpages);
shim_nrpages -= total_pages - avail;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index dd11815..5cde011 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -817,7 +817,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
/* Check that we have at least one Multiboot module. */
if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) )
- panic("dom0 kernel not specified. Check bootloader configuration.");
+ panic("dom0 kernel not specified. Check bootloader configuration\n");
if ( pvh_boot )
{
@@ -908,7 +908,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
e820_raw.nr_map = 2;
}
else
- panic("Bootloader provided no memory information.");
+ panic("Bootloader provided no memory information\n");
/* Sanitise the raw E820 map to produce a final clean version. */
max_page = raw_max_page = init_e820(memmap_type, &e820_raw);
@@ -955,7 +955,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
for ( i = 0; !efi_enabled(EFI_LOADER) && i < mbi->mods_count; i++ )
{
if ( mod[i].mod_start & (PAGE_SIZE - 1) )
- panic("Bootloader didn't honor module alignment request.");
+ panic("Bootloader didn't honor module alignment request\n");
mod[i].mod_end -= mod[i].mod_start;
mod[i].mod_start >>= PAGE_SHIFT;
mod[i].reserved = 0;
@@ -1212,7 +1212,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
}
if ( modules_headroom && !mod->reserved )
- panic("Not enough memory to relocate the dom0 kernel image.");
+ panic("Not enough memory to relocate the dom0 kernel image\n");
for ( i = 0; i < mbi->mods_count; ++i )
{
uint64_t s = (uint64_t)mod[i].mod_start << PAGE_SHIFT;
@@ -1221,7 +1221,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
}
if ( !xen_phys_start )
- panic("Not enough memory to relocate Xen.");
+ panic("Not enough memory to relocate Xen\n");
/* This needs to remain in sync with xen_in_range(). */
reserve_e820_ram(&boot_e820, __pa(_stext), __pa(__2M_rwdata_end));
@@ -1680,7 +1680,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
watchdog_setup();
if ( !tboot_protect_mem_regions() )
- panic("Could not protect TXT memory regions");
+ panic("Could not protect TXT memory regions\n");
init_guest_cpuid();
init_guest_msr_policy();
@@ -1698,7 +1698,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
/* Create initial domain 0. */
dom0 = domain_create(get_initial_domain_id(), &dom0_cfg, !pv_shim);
if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
- panic("Error creating domain 0");
+ panic("Error creating domain 0\n");
/* Grab the DOM0 command line. */
cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
@@ -1761,7 +1761,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
if ( construct_dom0(dom0, mod, modules_headroom,
(initrdidx > 0) && (initrdidx < mbi->mods_count)
? mod + initrdidx : NULL, cmdline) != 0)
- panic("Could not set up DOM0 guest OS");
+ panic("Could not set up DOM0 guest OS\n");
if ( cpu_has_smap )
{
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index e4e12aa..9976da3 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1107,11 +1107,11 @@ void __init smp_prepare_cpus(void)
socket_cpumask = xzalloc_array(cpumask_t *, nr_sockets);
if ( socket_cpumask == NULL ||
(socket_cpumask[cpu_to_socket(0)] = xzalloc(cpumask_t)) == NULL )
- panic("No memory for socket CPU siblings map");
+ panic("No memory for socket CPU siblings map\n");
if ( !zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, 0)) ||
!zalloc_cpumask_var(&per_cpu(cpu_core_mask, 0)) )
- panic("No memory for boot CPU sibling/core maps");
+ panic("No memory for boot CPU sibling/core maps\n");
set_cpu_sibling_map(0);
diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index d5a5292..7480f8e 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -538,7 +538,7 @@ void tboot_s3_error(int error)
printk("MAC for %s before S3 is: 0x%08"PRIx64"\n", what, orig_mac);
printk("MAC for %s after S3 is: 0x%08"PRIx64"\n", what, resume_mac);
- panic("Memory integrity was lost on resume (%d)", error);
+ panic("Memory integrity was lost on resume (%d)\n", error);
}
int tboot_wake_ap(int apicid, unsigned long sipi_vec)
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 69e9aaf..619f32c 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -798,7 +798,7 @@ static u64 __init init_platform_timer(void)
}
if ( rc <= 0 )
- panic("Unable to find usable platform timer");
+ panic("Unable to find usable platform timer\n");
printk("Platform timer is %s %s\n",
freq_string(pts->frequency), pts->name);
@@ -914,7 +914,7 @@ static unsigned long get_cmos_time(void)
cmos_rtc_probe = false;
else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
panic("System with no CMOS RTC advertised must be booted from EFI"
- " (or with command line option \"cmos-rtc-probe\")");
+ " (or with command line option \"cmos-rtc-probe\")\n");
for ( ; ; )
{
@@ -959,7 +959,7 @@ static unsigned long get_cmos_time(void)
}
if ( unlikely(cmos_rtc_probe) )
- panic("No CMOS RTC found - system must be booted from EFI");
+ panic("No CMOS RTC found - system must be booted from EFI\n");
return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
}
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d8325a3..7c17806 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -712,7 +712,7 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote)
}
panic("FATAL TRAP: vector = %d (%s)\n"
- "[error_code=%04x] %s",
+ "[error_code=%04x] %s\n",
trapnr, trapstr(trapnr), regs->error_code,
(regs->eflags & X86_EFLAGS_IF) ? "" : ", IN INTERRUPT CONTEXT");
}
@@ -725,7 +725,7 @@ static void do_reserved_trap(struct cpu_user_regs *regs)
return;
show_execution_state(regs);
- panic("FATAL RESERVED TRAP %#x: %s", trapnr, trapstr(trapnr));
+ panic("FATAL RESERVED TRAP %#x: %s\n", trapnr, trapstr(trapnr));
}
static void do_trap(struct cpu_user_regs *regs)
@@ -764,7 +764,7 @@ static void do_trap(struct cpu_user_regs *regs)
show_execution_state(regs);
panic("FATAL TRAP: vector = %d (%s)\n"
- "[error_code=%04x]",
+ "[error_code=%04x]\n",
trapnr, trapstr(trapnr), regs->error_code);
}
@@ -1047,7 +1047,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
return;
show_execution_state(regs);
- panic("Xen BUG at %s%s:%d", prefix, filename, lineno);
+ panic("Xen BUG at %s%s:%d\n", prefix, filename, lineno);
case BUGFRAME_assert:
/* ASSERT: decode the predicate string pointer. */
@@ -1062,7 +1062,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
return;
show_execution_state(regs);
- panic("Assertion '%s' failed at %s%s:%d",
+ panic("Assertion '%s' failed at %s%s:%d\n",
predicate, prefix, filename, lineno);
}
@@ -1078,7 +1078,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
return;
show_execution_state(regs);
- panic("FATAL TRAP: vector = %d (invalid opcode)", TRAP_invalid_op);
+ panic("FATAL TRAP: vector = %d (invalid opcode)\n", TRAP_invalid_op);
}
void do_int3(struct cpu_user_regs *regs)
@@ -1439,7 +1439,7 @@ void do_page_fault(struct cpu_user_regs *regs)
show_page_walk(addr);
panic("FATAL PAGE FAULT\n"
"[error_code=%04x]\n"
- "Faulting linear address: %p",
+ "Faulting linear address: %p\n",
error_code, _p(addr));
}
@@ -1577,7 +1577,7 @@ void do_general_protection(struct cpu_user_regs *regs)
return;
show_execution_state(regs);
- panic("GENERAL PROTECTION FAULT\n[error_code=%04x]", regs->error_code);
+ panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
}
static void pci_serr_softirq(void)
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 989a534..606508c 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -684,7 +684,7 @@ void __init paging_init(void)
return;
nomem:
- panic("Not enough memory for m2p table");
+ panic("Not enough memory for m2p table\n");
}
void __init zap_low_mappings(void)
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index 606b1b0..c855752 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -264,7 +264,7 @@ void do_double_fault(struct cpu_user_regs *regs)
show_code(regs);
show_stack_overflow(cpu, regs);
- panic("DOUBLE FAULT -- system shutdown");
+ panic("DOUBLE FAULT -- system shutdown\n");
}
static unsigned int write_stub_trampoline(
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 171d25e..e903050 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -328,7 +328,7 @@ struct domain *domain_create(domid_t domid,
if ( domid == 0 || domid == hardware_domid )
{
if ( hardware_domid < 0 || hardware_domid >= DOMID_FIRST_RESERVED )
- panic("The value of hardware_dom must be a valid domain ID");
+ panic("The value of hardware_dom must be a valid domain ID\n");
d->is_pinned = opt_dom0_vcpus_pin;
d->disable_migrate = 1;
old_hwdom = hardware_domain;
diff --git a/xen/common/gunzip.c b/xen/common/gunzip.c
index 41d71ef..db4efcd 100644
--- a/xen/common/gunzip.c
+++ b/xen/common/gunzip.c
@@ -57,7 +57,7 @@ static void flush_window(void);
static __init void error(char *x)
{
- panic("%s", x);
+ panic("%s\n", x);
}
static __init int fill_inbuf(void)
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 05281d6..e35bafb 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1799,7 +1799,7 @@ void __init scheduler_init(void)
printk("Using scheduler: %s (%s)\n", ops.name, ops.opt_name);
if ( SCHED_OP(&ops, init) )
- panic("scheduler returned error on init");
+ panic("scheduler returned error on init\n");
if ( sched_ratelimit_us &&
(sched_ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index fddd6be..50a4e14 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -478,7 +478,7 @@ __ubsan_handle_builtin_unreachable(struct unreachable_data *data)
ubsan_prologue(&data->location, &flags);
pr_err("calling __builtin_unreachable()\n");
ubsan_epilogue(&flags);
- panic("can't return from __builtin_unreachable()");
+ panic("can't return from __builtin_unreachable()\n");
}
EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable);
diff --git a/xen/common/warning.c b/xen/common/warning.c
index 8bdd299..0269c67 100644
--- a/xen/common/warning.c
+++ b/xen/common/warning.c
@@ -11,7 +11,7 @@ static const char *__initdata warnings[WARNING_ARRAY_SIZE];
void __init warning_add(const char *warning)
{
if ( nr_warnings >= WARNING_ARRAY_SIZE )
- panic("Too many pieces of warning text.");
+ panic("Too many pieces of warning text\n");
warnings[nr_warnings] = warning;
nr_warnings++;
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index a911958..e48039d 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1254,7 +1254,7 @@ void panic(const char *fmt, ...)
console_start_sync();
printk("\n****************************************\n");
printk("Panic on CPU %d:\n", smp_processor_id());
- printk("%s\n", buf);
+ printk("%s", buf);
printk("****************************************\n\n");
if ( opt_noreboot )
printk("Manual reset required ('noreboot' specified)\n");
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 70d218f..e917901 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -159,8 +159,7 @@ static void __hwdom_init check_hwdom_reqs(struct domain *d)
arch_iommu_check_autotranslated_hwdom(d);
if ( iommu_passthrough )
- panic("Dom0 uses paging translated mode, dom0-passthrough must not be "
- "enabled\n");
+ panic("Dom0 uses paging translated mode, dom0-passthrough must not be enabled\n");
iommu_dom0_strict = 1;
}
@@ -384,7 +383,7 @@ int __init iommu_setup(void)
if ( (force_iommu && !iommu_enabled) ||
(force_intremap && !iommu_intremap) )
- panic("Couldn't enable %s and iommu=required/force",
+ panic("Couldn't enable %s and iommu=required/force\n",
!iommu_enabled ? "IOMMU" : "Interrupt Remapping");
if ( !iommu_intremap )
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index d1adffa..b3f75c6 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -130,7 +130,7 @@ void __init pci_segments_init(void)
{
radix_tree_init(&pci_segments);
if ( !alloc_pseg(0) )
- panic("Could not initialize PCI segment 0");
+ panic("Could not initialize PCI segment 0\n");
}
int __init pci_add_segment(u16 seg)
diff --git a/xen/drivers/passthrough/vtd/dmar.h b/xen/drivers/passthrough/vtd/dmar.h
index 8f1b18e..95bb132 100644
--- a/xen/drivers/passthrough/vtd/dmar.h
+++ b/xen/drivers/passthrough/vtd/dmar.h
@@ -119,7 +119,7 @@ do { \
if ( !kexecing ) \
{ \
dump_execution_state(); \
- panic("DMAR hardware malfunction"); \
+ panic("DMAR hardware malfunction\n"); \
} \
break; \
} \
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 1710256..8d768a4 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -759,7 +759,7 @@ static void iommu_enable_translation(struct acpi_drhd_unit *drhd)
if ( !is_igd_vt_enabled_quirk() )
{
if ( force_iommu )
- panic("BIOS did not enable IGD for VT properly, crash Xen for security purpose");
+ panic("BIOS did not enable IGD for VT properly, crash Xen for security purpose\n");
printk(XENLOG_WARNING VTDPREFIX
"BIOS did not enable IGD for VT properly. Disabling IGD VT-d engine.\n");
@@ -2571,7 +2571,7 @@ static void vtd_resume(void)
return;
if ( init_vtd_hw() != 0 && force_iommu )
- panic("IOMMU setup failed, crash Xen for security purpose");
+ panic("IOMMU setup failed, crash Xen for security purpose\n");
for_each_drhd_unit ( drhd )
{
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index a4fbe62..87bee96 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1878,13 +1878,13 @@ void __init flask_init(const void *policy_buffer, size_t policy_size)
avc_init();
if ( register_xsm(&flask_ops) )
- panic("Flask: Unable to register with XSM");
+ panic("Flask: Unable to register with XSM\n");
if ( policy_size && flask_bootparam != FLASK_BOOTPARAM_LATELOAD )
ret = security_load_policy(policy_buffer, policy_size);
if ( ret && flask_bootparam == FLASK_BOOTPARAM_ENFORCING )
- panic("Unable to load FLASK policy");
+ panic("Unable to load FLASK policy\n");
if ( ret )
printk(XENLOG_INFO "Flask: Access controls disabled until policy is loaded.\n");
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-30 12:31 [PATCH] xen: Fix inconsistent callers of panic() Andrew Cooper
@ 2018-08-30 14:07 ` Jan Beulich
2018-08-30 17:08 ` Andrew Cooper
2018-09-10 11:21 ` Julien Grall
1 sibling, 1 reply; 13+ messages in thread
From: Jan Beulich @ 2018-08-30 14:07 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Julien Grall, Stefano Stabellini, Wei Liu, Xen-devel
>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
> Callers are inconsistent with whether they pass a newline to panic(),
> including adjacent calls in the same function using different styles.
>
> painc() not expecting a newline is inconsistent with most other printing
> functions, which is most likely why we've gained so many inconsistencies.
>
> Switch panic() to expect a newline, and update all callers which currently
> lack a newline to include one.
>
> This actually reduces the size of .rodata (0x07e3e8 down to 0x07e3a8) because
> a number of strings are passed to both panic() and printk(). As they
> previously differed by \n alone, they couldn't be merged.
I agree this is a nice side effect, but ...
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
>
> (Restricted to the core arch maintainers as this is a tree-wide piece of
> cleanup with no functional impact to other areas.)
>
> The observant amongst you might realise that this reverts parts of c/s
> 51ad90aea21c - What can I say? Several years of hindsight is very useful, and
> at the time I did ask the maintainers which option they thought would be
> better...
... I think both the earlier and this change are heading in the
wrong direction: I would much rather see the newline omitted
everywhere, _including_ in panic() itself: This causes one line
less to scroll off the screen in case you don't have a serial
console.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-30 14:07 ` Jan Beulich
@ 2018-08-30 17:08 ` Andrew Cooper
2018-08-31 6:33 ` Jan Beulich
0 siblings, 1 reply; 13+ messages in thread
From: Andrew Cooper @ 2018-08-30 17:08 UTC (permalink / raw)
To: Jan Beulich; +Cc: Julien Grall, Stefano Stabellini, Wei Liu, Xen-devel
On 30/08/18 15:07, Jan Beulich wrote:
>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>> Callers are inconsistent with whether they pass a newline to panic(),
>> including adjacent calls in the same function using different styles.
>>
>> painc() not expecting a newline is inconsistent with most other printing
>> functions, which is most likely why we've gained so many inconsistencies.
>>
>> Switch panic() to expect a newline, and update all callers which currently
>> lack a newline to include one.
>>
>> This actually reduces the size of .rodata (0x07e3e8 down to 0x07e3a8) because
>> a number of strings are passed to both panic() and printk(). As they
>> previously differed by \n alone, they couldn't be merged.
> I agree this is a nice side effect, but ...
>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>> CC: Jan Beulich <JBeulich@suse.com>
>> CC: Wei Liu <wei.liu2@citrix.com>
>> CC: Stefano Stabellini <sstabellini@kernel.org>
>> CC: Julien Grall <julien.grall@arm.com>
>>
>> (Restricted to the core arch maintainers as this is a tree-wide piece of
>> cleanup with no functional impact to other areas.)
>>
>> The observant amongst you might realise that this reverts parts of c/s
>> 51ad90aea21c - What can I say? Several years of hindsight is very useful, and
>> at the time I did ask the maintainers which option they thought would be
>> better...
> ... I think both the earlier and this change are heading in the
> wrong direction: I would much rather see the newline omitted
> everywhere, _including_ in panic() itself: This causes one line
> less to scroll off the screen in case you don't have a serial
> console.
I don't expect that suggestion would get anywhere if you put it to a
vote with The REST.
For one, it breaks any ability to construct a single line of text from
multiple printk() calls (which we have plenty of examples of in the
codebase), and it further deviates from everyone’s expectation of how
printk() works (which is the very reason we've picked up all these
inconsistencies since I last made them consistent).
IMO, such a change would be detrimental, because either the code will
get out of sync again (most likely), or there will extra review
aggravation as people submitting code to normal expectations have their
code rejected.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-30 17:08 ` Andrew Cooper
@ 2018-08-31 6:33 ` Jan Beulich
2018-08-31 6:43 ` Juergen Gross
2018-09-07 16:42 ` Andrew Cooper
0 siblings, 2 replies; 13+ messages in thread
From: Jan Beulich @ 2018-08-31 6:33 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Julien Grall, Stefano Stabellini, Wei Liu, Xen-devel
>>> On 30.08.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
> On 30/08/18 15:07, Jan Beulich wrote:
>>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>>> The observant amongst you might realise that this reverts parts of c/s
>>> 51ad90aea21c - What can I say? Several years of hindsight is very useful, and
>>> at the time I did ask the maintainers which option they thought would be
>>> better...
>> ... I think both the earlier and this change are heading in the
>> wrong direction: I would much rather see the newline omitted
>> everywhere, _including_ in panic() itself: This causes one line
>> less to scroll off the screen in case you don't have a serial
>> console.
>
> I don't expect that suggestion would get anywhere if you put it to a
> vote with The REST.
Well, I can certainly live with being the only one here, should
that turn out to be the case.
> For one, it breaks any ability to construct a single line of text from
> multiple printk() calls (which we have plenty of examples of in the
> codebase), and it further deviates from everyone’s expectation of how
> printk() works (which is the very reason we've picked up all these
> inconsistencies since I last made them consistent).
Let me understand this: Are you suggesting two (by their names
and purposes) completely different functions need to adhere to
some common principle? If so, I don't think I can agree with you
here.
> IMO, such a change would be detrimental, because either the code will
> get out of sync again (most likely), or there will extra review
> aggravation as people submitting code to normal expectations have their
> code rejected.
Quite frequently people follow existing practice when adding new
code. If all panic() invocations omitted the newline, chances are
pretty good that new instances would do so as well. Chances are
even so good that people tend to copy and paste buggy code
without paying attention.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-31 6:33 ` Jan Beulich
@ 2018-08-31 6:43 ` Juergen Gross
2018-08-31 7:04 ` Jan Beulich
2018-09-07 16:42 ` Andrew Cooper
1 sibling, 1 reply; 13+ messages in thread
From: Juergen Gross @ 2018-08-31 6:43 UTC (permalink / raw)
To: Jan Beulich, Andrew Cooper
Cc: Julien Grall, Stefano Stabellini, Wei Liu, Xen-devel
On 31/08/18 08:33, Jan Beulich wrote:
>>>> On 30.08.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
>> On 30/08/18 15:07, Jan Beulich wrote:
>>>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>>>> The observant amongst you might realise that this reverts parts of c/s
>>>> 51ad90aea21c - What can I say? Several years of hindsight is very useful, and
>>>> at the time I did ask the maintainers which option they thought would be
>>>> better...
>>> ... I think both the earlier and this change are heading in the
>>> wrong direction: I would much rather see the newline omitted
>>> everywhere, _including_ in panic() itself: This causes one line
>>> less to scroll off the screen in case you don't have a serial
>>> console.
Can't we just drop printing the extra \n in panic()?
- printk("%s\n", buf);
+ printk("%s", buf);
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-31 6:43 ` Juergen Gross
@ 2018-08-31 7:04 ` Jan Beulich
2018-08-31 7:12 ` Juergen Gross
0 siblings, 1 reply; 13+ messages in thread
From: Jan Beulich @ 2018-08-31 7:04 UTC (permalink / raw)
To: Andrew Cooper, Juergen Gross
Cc: Julien Grall, Stefano Stabellini, Wei Liu, Xen-devel
>>> On 31.08.18 at 08:43, <jgross@suse.com> wrote:
> On 31/08/18 08:33, Jan Beulich wrote:
>>>>> On 30.08.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
>>> On 30/08/18 15:07, Jan Beulich wrote:
>>>>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>>>>> The observant amongst you might realise that this reverts parts of c/s
>>>>> 51ad90aea21c - What can I say? Several years of hindsight is very useful, and
>>>>> at the time I did ask the maintainers which option they thought would be
>>>>> better...
>>>> ... I think both the earlier and this change are heading in the
>>>> wrong direction: I would much rather see the newline omitted
>>>> everywhere, _including_ in panic() itself: This causes one line
>>>> less to scroll off the screen in case you don't have a serial
>>>> console.
>
> Can't we just drop printing the extra \n in panic()?
>
> - printk("%s\n", buf);
> + printk("%s", buf);
That's what I'm suggesting, yes, plus (if there are any) dropping
trailing newlines in panic() invocations.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-31 7:04 ` Jan Beulich
@ 2018-08-31 7:12 ` Juergen Gross
2018-08-31 7:21 ` Jan Beulich
0 siblings, 1 reply; 13+ messages in thread
From: Juergen Gross @ 2018-08-31 7:12 UTC (permalink / raw)
To: Jan Beulich, Andrew Cooper
Cc: Julien Grall, Stefano Stabellini, Wei Liu, Xen-devel
On 31/08/18 09:04, Jan Beulich wrote:
>>>> On 31.08.18 at 08:43, <jgross@suse.com> wrote:
>> On 31/08/18 08:33, Jan Beulich wrote:
>>>>>> On 30.08.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
>>>> On 30/08/18 15:07, Jan Beulich wrote:
>>>>>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>>>>>> The observant amongst you might realise that this reverts parts of c/s
>>>>>> 51ad90aea21c - What can I say? Several years of hindsight is very useful, and
>>>>>> at the time I did ask the maintainers which option they thought would be
>>>>>> better...
>>>>> ... I think both the earlier and this change are heading in the
>>>>> wrong direction: I would much rather see the newline omitted
>>>>> everywhere, _including_ in panic() itself: This causes one line
>>>>> less to scroll off the screen in case you don't have a serial
>>>>> console.
>>
>> Can't we just drop printing the extra \n in panic()?
>>
>> - printk("%s\n", buf);
>> + printk("%s", buf);
>
> That's what I'm suggesting, yes, plus (if there are any) dropping
> trailing newlines in panic() invocations.
Uuh, both?
This would look like:
***********************************
PANIC on cpu 2:
blalblabla**********************************
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-31 7:12 ` Juergen Gross
@ 2018-08-31 7:21 ` Jan Beulich
2018-08-31 7:30 ` Juergen Gross
0 siblings, 1 reply; 13+ messages in thread
From: Jan Beulich @ 2018-08-31 7:21 UTC (permalink / raw)
To: Juergen Gross
Cc: Andrew Cooper, Julien Grall, Stefano Stabellini, Wei Liu,
Xen-devel
>>> On 31.08.18 at 09:12, <jgross@suse.com> wrote:
> On 31/08/18 09:04, Jan Beulich wrote:
>>>>> On 31.08.18 at 08:43, <jgross@suse.com> wrote:
>>> On 31/08/18 08:33, Jan Beulich wrote:
>>>>>>> On 30.08.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
>>>>> On 30/08/18 15:07, Jan Beulich wrote:
>>>>>>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>>>>>>> The observant amongst you might realise that this reverts parts of c/s
>>>>>>> 51ad90aea21c - What can I say? Several years of hindsight is very useful,
> and
>>>>>>> at the time I did ask the maintainers which option they thought would be
>>>>>>> better...
>>>>>> ... I think both the earlier and this change are heading in the
>>>>>> wrong direction: I would much rather see the newline omitted
>>>>>> everywhere, _including_ in panic() itself: This causes one line
>>>>>> less to scroll off the screen in case you don't have a serial
>>>>>> console.
>>>
>>> Can't we just drop printing the extra \n in panic()?
>>>
>>> - printk("%s\n", buf);
>>> + printk("%s", buf);
>>
>> That's what I'm suggesting, yes, plus (if there are any) dropping
>> trailing newlines in panic() invocations.
>
> Uuh, both?
>
> This would look like:
>
> ***********************************
> PANIC on cpu 2:
> blalblabla**********************************
Hmm, the trailing **** would perhaps better also be dropped. As per
my original reply to Andrew, the goal should imo be to have as little
useless output as possible (but as much as necessary/helpful, i.e. I'm
not suggesting to drop the first line of stars), to avoid meaningful
lines scrolling off.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-31 7:21 ` Jan Beulich
@ 2018-08-31 7:30 ` Juergen Gross
2018-08-31 8:48 ` Jan Beulich
0 siblings, 1 reply; 13+ messages in thread
From: Juergen Gross @ 2018-08-31 7:30 UTC (permalink / raw)
To: Jan Beulich
Cc: Andrew Cooper, Julien Grall, Stefano Stabellini, Wei Liu,
Xen-devel
On 31/08/18 09:21, Jan Beulich wrote:
>>>> On 31.08.18 at 09:12, <jgross@suse.com> wrote:
>> On 31/08/18 09:04, Jan Beulich wrote:
>>>>>> On 31.08.18 at 08:43, <jgross@suse.com> wrote:
>>>> On 31/08/18 08:33, Jan Beulich wrote:
>>>>>>>> On 30.08.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
>>>>>> On 30/08/18 15:07, Jan Beulich wrote:
>>>>>>>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>>>>>>>> The observant amongst you might realise that this reverts parts of c/s
>>>>>>>> 51ad90aea21c - What can I say? Several years of hindsight is very useful,
>> and
>>>>>>>> at the time I did ask the maintainers which option they thought would be
>>>>>>>> better...
>>>>>>> ... I think both the earlier and this change are heading in the
>>>>>>> wrong direction: I would much rather see the newline omitted
>>>>>>> everywhere, _including_ in panic() itself: This causes one line
>>>>>>> less to scroll off the screen in case you don't have a serial
>>>>>>> console.
>>>>
>>>> Can't we just drop printing the extra \n in panic()?
>>>>
>>>> - printk("%s\n", buf);
>>>> + printk("%s", buf);
>>>
>>> That's what I'm suggesting, yes, plus (if there are any) dropping
>>> trailing newlines in panic() invocations.
>>
>> Uuh, both?
>>
>> This would look like:
>>
>> ***********************************
>> PANIC on cpu 2:
>> blalblabla**********************************
>
> Hmm, the trailing **** would perhaps better also be dropped. As per
> my original reply to Andrew, the goal should imo be to have as little
> useless output as possible (but as much as necessary/helpful, i.e. I'm
> not suggesting to drop the first line of stars), to avoid meaningful
> lines scrolling off.
I don't think:
***********************************
PANIC on cpu 2:
blalblablaReboot in five seconds...
is what we want.
So one '\n' should stay: either when printing the panic message, or in
the panic message itself.
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-31 7:30 ` Juergen Gross
@ 2018-08-31 8:48 ` Jan Beulich
0 siblings, 0 replies; 13+ messages in thread
From: Jan Beulich @ 2018-08-31 8:48 UTC (permalink / raw)
To: Juergen Gross
Cc: Andrew Cooper, Julien Grall, Stefano Stabellini, Wei Liu,
Xen-devel
>>> On 31.08.18 at 09:30, <jgross@suse.com> wrote:
> On 31/08/18 09:21, Jan Beulich wrote:
>>>>> On 31.08.18 at 09:12, <jgross@suse.com> wrote:
>>> On 31/08/18 09:04, Jan Beulich wrote:
>>>>>>> On 31.08.18 at 08:43, <jgross@suse.com> wrote:
>>>>> On 31/08/18 08:33, Jan Beulich wrote:
>>>>>>>>> On 30.08.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
>>>>>>> On 30/08/18 15:07, Jan Beulich wrote:
>>>>>>>>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>>>>>>>>> The observant amongst you might realise that this reverts parts of c/s
>>>>>>>>> 51ad90aea21c - What can I say? Several years of hindsight is very useful,
>>> and
>>>>>>>>> at the time I did ask the maintainers which option they thought would be
>>>>>>>>> better...
>>>>>>>> ... I think both the earlier and this change are heading in the
>>>>>>>> wrong direction: I would much rather see the newline omitted
>>>>>>>> everywhere, _including_ in panic() itself: This causes one line
>>>>>>>> less to scroll off the screen in case you don't have a serial
>>>>>>>> console.
>>>>>
>>>>> Can't we just drop printing the extra \n in panic()?
>>>>>
>>>>> - printk("%s\n", buf);
>>>>> + printk("%s", buf);
>>>>
>>>> That's what I'm suggesting, yes, plus (if there are any) dropping
>>>> trailing newlines in panic() invocations.
>>>
>>> Uuh, both?
>>>
>>> This would look like:
>>>
>>> ***********************************
>>> PANIC on cpu 2:
>>> blalblabla**********************************
>>
>> Hmm, the trailing **** would perhaps better also be dropped. As per
>> my original reply to Andrew, the goal should imo be to have as little
>> useless output as possible (but as much as necessary/helpful, i.e. I'm
>> not suggesting to drop the first line of stars), to avoid meaningful
>> lines scrolling off.
>
> I don't think:
>
> ***********************************
> PANIC on cpu 2:
> blalblablaReboot in five seconds...
>
> is what we want.
>
> So one '\n' should stay: either when printing the panic message, or in
> the panic message itself.
Oh, all these pretty useless extra lines. In that case I think Andrew's
patch is quite fine, unless we can reach agreement to drop all the
extra cruft such that the actual panic message is last on the screen.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-31 6:33 ` Jan Beulich
2018-08-31 6:43 ` Juergen Gross
@ 2018-09-07 16:42 ` Andrew Cooper
2018-09-10 9:33 ` Jan Beulich
1 sibling, 1 reply; 13+ messages in thread
From: Andrew Cooper @ 2018-09-07 16:42 UTC (permalink / raw)
To: Jan Beulich; +Cc: Julien Grall, Stefano Stabellini, Wei Liu, Xen-devel
On 31/08/18 07:33, Jan Beulich wrote:
>>>> On 30.08.18 at 19:08, <andrew.cooper3@citrix.com> wrote:
>> On 30/08/18 15:07, Jan Beulich wrote:
>>>>>> On 30.08.18 at 14:31, <andrew.cooper3@citrix.com> wrote:
>>>> The observant amongst you might realise that this reverts parts of c/s
>>>> 51ad90aea21c - What can I say? Several years of hindsight is very useful, and
>>>> at the time I did ask the maintainers which option they thought would be
>>>> better...
>>> ... I think both the earlier and this change are heading in the
>>> wrong direction: I would much rather see the newline omitted
>>> everywhere, _including_ in panic() itself: This causes one line
>>> less to scroll off the screen in case you don't have a serial
>>> console.
>> I don't expect that suggestion would get anywhere if you put it to a
>> vote with The REST.
> Well, I can certainly live with being the only one here, should
> that turn out to be the case.
>
>> For one, it breaks any ability to construct a single line of text from
>> multiple printk() calls (which we have plenty of examples of in the
>> codebase), and it further deviates from everyone’s expectation of how
>> printk() works (which is the very reason we've picked up all these
>> inconsistencies since I last made them consistent).
> Let me understand this: Are you suggesting two (by their names
> and purposes) completely different functions
I'm going to stop you mid sentence and object to printk() and panic()
being classified as "completely different".
The are both, first and foremost, used for getting information out onto
the console. panic() just has an extra side effect of crashing the machine.
> need to adhere to some common principle? If so, I don't think I can agree with you
> here.
Functions with common usage should adhere to common principles.
Therefore, panic() and printk() should be consistent on whether they
take a newline or not in their format string.
Furthermore, APIs of ours which are modelled after an existing API, in
this case printf(), should have the same expectations, because that is
how people learn C. Therefore, printk() and panic() should have a
trailing newline in the format string if a newline wants emitting on the
console.
>> IMO, such a change would be detrimental, because either the code will
>> get out of sync again (most likely), or there will extra review
>> aggravation as people submitting code to normal expectations have their
>> code rejected.
> Quite frequently people follow existing practice when adding new
> code. If all panic() invocations omitted the newline, chances are
> pretty good that new instances would do so as well.
This patch is a 3 year case study demonstrating the exact opposite.
I made panic() consistently (not) take a \n, and 3 years later, we have
still got back to a 50% ~mix.
> Chances are even so good that people tend to copy and paste buggy code
> without paying attention.
When everyone is submitting code which seems to slip \n in (including
you - c/s 5784de3 which was the XPTI patch), and none of the
reviewers/committers notice and fix it up, it is obvious that the
current expectations are wrong.
[Merging part of the later conversion]
Reducing the number of lines printed from a panic/backtrace may be a
good thing, but please can we not conflate it with this which is fix an
API inconsistency.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-09-07 16:42 ` Andrew Cooper
@ 2018-09-10 9:33 ` Jan Beulich
0 siblings, 0 replies; 13+ messages in thread
From: Jan Beulich @ 2018-09-10 9:33 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Julien Grall, Stefano Stabellini, Wei Liu, Xen-devel
>>> On 07.09.18 at 18:42, <andrew.cooper3@citrix.com> wrote:
> [Merging part of the later conversion]
>
> Reducing the number of lines printed from a panic/backtrace may be a
> good thing, but please can we not conflate it with this which is fix an
> API inconsistency.
Well, later on in the conversion I've also agreed that due to the
extra stuff getting logged, your change is perhaps the best that
can be done at this point in time. Feel free to read this as
Acked-by: Jan Beulich <jbeulich@suse.com>
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] xen: Fix inconsistent callers of panic()
2018-08-30 12:31 [PATCH] xen: Fix inconsistent callers of panic() Andrew Cooper
2018-08-30 14:07 ` Jan Beulich
@ 2018-09-10 11:21 ` Julien Grall
1 sibling, 0 replies; 13+ messages in thread
From: Julien Grall @ 2018-09-10 11:21 UTC (permalink / raw)
To: Andrew Cooper, Xen-devel; +Cc: Stefano Stabellini, Wei Liu, Jan Beulich
Hi Andrew,
On 30/08/18 13:31, Andrew Cooper wrote:
> Callers are inconsistent with whether they pass a newline to panic(),
> including adjacent calls in the same function using different styles.
>
> painc() not expecting a newline is inconsistent with most other printing
> functions, which is most likely why we've gained so many inconsistencies.
>
> Switch panic() to expect a newline, and update all callers which currently
> lack a newline to include one.
>
> This actually reduces the size of .rodata (0x07e3e8 down to 0x07e3a8) because
> a number of strings are passed to both panic() and printk(). As they
> previously differed by \n alone, they couldn't be merged.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2018-09-10 11:21 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-30 12:31 [PATCH] xen: Fix inconsistent callers of panic() Andrew Cooper
2018-08-30 14:07 ` Jan Beulich
2018-08-30 17:08 ` Andrew Cooper
2018-08-31 6:33 ` Jan Beulich
2018-08-31 6:43 ` Juergen Gross
2018-08-31 7:04 ` Jan Beulich
2018-08-31 7:12 ` Juergen Gross
2018-08-31 7:21 ` Jan Beulich
2018-08-31 7:30 ` Juergen Gross
2018-08-31 8:48 ` Jan Beulich
2018-09-07 16:42 ` Andrew Cooper
2018-09-10 9:33 ` Jan Beulich
2018-09-10 11:21 ` Julien Grall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).