Implement a warning_report function
Subsystems (5)
v3 cover Implement a warning_report function
QEMU currently has a standard method to report errors with error_repot(). This ensure a sane and standard format when printing errors. This series is attempting to extend this functionality for warnings and information as well.
This patch renames error_print_loc() function to be more clear, but I didn't bother renaming the others. It seems silly to change error_printf() to error_warning_printf() and printf is already taken so I just left it as is.
v3:
- Regenerate the replacement patch
v1:
- Convert all of the existing warning messages in QEMU
- Add a error_report*_err() functions as well
RFCv3:
- Use more detailed enum and function names
- Add wrapper functions for the info and warning reporting
RFCv2:
- Use enums for ERROR, WARN and INFO with a generic report() function instead of adding new functions
Alistair Francis (8):
util/qemu-error: Rename error_print_loc() to be more generic
error: Functions to report warnings and informational messages Convert error_report() to warn_report()
hw/i386: Improve some of the warning messages
char-socket: Report TCP socket waiting as information
error: Implement the warn and free Error functions Convert error_report*_err() to warn_report*_err()
error: Add a 'error: ' prefix to error_report()
block/backup.c | 10 ++-- block/gluster.c | 4 +- block/iscsi.c | 6 +-- block/nfs.c | 12 ++--- block/rbd.c | 6 +-- block/ssh.c | 4 +- blockdev.c | 2 +- chardev/char-socket.c | 4 +- cpus.c | 2 +- hw/9pfs/9p.c | 2 +- hw/arm/highbank.c | 6 +-- hw/arm/imx25_pdk.c | 6 +-- hw/arm/kzm.c | 6 +-- hw/core/machine.c | 10 ++-- hw/core/qdev-properties.c | 10 ++-- hw/i386/acpi-build.c | 11 +++-- hw/i386/kvm/pci-assign.c | 6 +-- hw/i386/pc.c | 16 +++--- hw/i386/pc_piix.c | 8 +-- hw/i386/pc_q35.c | 6 +-- hw/misc/aspeed_sdmc.c | 8 +-- hw/nvram/fw_cfg.c | 2 +- hw/pci-host/piix.c | 2 +- hw/ppc/pnv.c | 6 +-- hw/ppc/spapr.c | 4 +- hw/ppc/spapr_iommu.c | 2 +- hw/scsi/scsi-bus.c | 6 +-- hw/usb/dev-smartcard-reader.c | 4 +- hw/usb/redirect.c | 2 +- include/qapi/error.h | 11 +++++ include/qemu/error-report.h | 7 +++ net/tap-linux.c | 2 +- scripts/checkpatch.pl | 7 ++- target/i386/cpu.c | 8 +-- target/i386/kvm.c | 4 +- target/s390x/cpu_models.c | 2 +- target/s390x/kvm.c | 2 +- tests/test-qdev-global-props.c | 6 +-- trace/control.c | 4 +- util/error.c | 20 ++++++++ util/qemu-error.c | 107 ++++++++++++++++++++++++++++++++++++++--- vl.c | 20 ++++---- 42 files changed, 254 insertions(+), 119 deletions(-)
Signature · 1 line
2.11.0
PATCH v3 1/8 util/qemu-error: Rename error_print_loc() to be more generic
Rename the error_print_loc() function in preparation for using it to print warnings as well.
---
util/qemu-error.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
util/qemu-error.c +2 -2
@@ -146,7 +146,7 @@ const char *error_get_progname(void)/* * Print current location to current monitor if we have one, else to stderr. */ -static void error_print_loc (void ) +static void print_loc (void ) {const char *sep ="" ;int i;
@@ -197,7 +197,7 @@ void error_vreport(const char *fmt, va_list ap)g_free (timestr); } -error_print_loc (); +print_loc ();error_vprintf (fmt, ap);error_printf ("\n" ); }
Signature · 1 line
2.11.0
PATCH v3 2/8 error: Functions to report warnings and informational messages
In reply to Alistair FrancisAdd warn_report(), warn_vreport() for reporting warnings, and info_report(), info_vreport() for informational messages.
These are implemented them with a helper function factored out of error_vreport(), suitably generalized. This patch makes no changes to the output of the original error_report() function.
---
v2:
- Don't add *vreport() functions to checkpatch
- Maintain original comments for the reporting functions
- Don't change the error report output in this patch
v1:
- Don't expose the generic report and vreport() functions
- Prefix error messages
- Use vreport instead of qmsg_vreport()
RFC V3:
- Change the function and enum names to be more descriptive
- Add wrapper functions for *_report() and *_vreport()
include/qemu/error-report.h | 7 +++ scripts/checkpatch.pl | 6 ++- util/qemu-error.c | 102 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 109 insertions(+), 6 deletions(-)
include/qemu/error-report.h +7 -0
@@ -35,8 +35,15 @@ void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);void error_set_progname (const char *argv0); + void error_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); +void warn_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); +void info_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); + void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +void warn_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +void info_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +const char *error_get_progname (void );extern bool enable_timestamp_msg;
scripts/checkpatch.pl +5 -1
@@ -2535,7 +2535,11 @@ sub process { error_prepend| error_reportf_err| error_vreport| - error_report}x; + report_vreport| + info_vreport| + error_report| + warn_report| + info_report}x; if ($rawline =~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) { ERROR("Error messages should not contain newlines\n" . $herecurr);
util/qemu-error.c +97 -5
134 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v3 2/8] error: Functions to report warnings and informational messages
Quoted 26 lines · Alistair Francis
Add
warn_report(),warn_vreport()for reporting warnings, andinfo_report(),info_vreport()for informational messages.These are implemented them with a helper function factored out of
error_vreport(), suitably generalized. This patch makes no changes to the output of the originalerror_report()function.Signed-off-by Alistair Francis <[email protected]>Reviewed-by Markus Armbruster <[email protected]>---
v2:
- Don't add*vreport()functions to checkpatch
- Maintain original comments for the reporting functions
- Don't change the error report output in this patch
v1:
- Don't expose the generic report andvreport()functions
- Prefix error messages
- Use vreport instead ofqmsg_vreport()
RFC V3:
- Change the function and enum names to be more descriptive
- Add wrapper functions for*_report()and*_vreport()include/qemu/error-report.h | 7 +++ scripts/checkpatch.pl | 6 ++- util/qemu-error.c | 102 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 109 insertions(+), 6 deletions(-)
[...]
scripts/checkpatch.pl sub process { · line 2538
Quoted 10 lines
scripts/checkpatch.pl +1
-1@@ -2535,7 +2535,11 @@ sub process { error_prepend| error_reportf_err| error_vreport| - error_report}x; + report_vreport|
Should be warn_vreport, oops. I can fix this on commit.
Quoted 7 lines
scripts/checkpatch.pl +4
-0+ info_vreport| + error_report| + warn_report| + info_report}x; if ($rawline =~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) { ERROR("Error messages should not contain newlines\n" . $herecurr);
[...]
Re: [Qemu-devel] [PATCH v3 2/8] error: Functions to report warnings and informational messages
Quoted 29 lines · Markus Armbruster
Quoted 26 lines · Alistair Francis
Add
warn_report(),warn_vreport()for reporting warnings, andinfo_report(),info_vreport()for informational messages.These are implemented them with a helper function factored out of
error_vreport(), suitably generalized. This patch makes no changes to the output of the originalerror_report()function.Signed-off-by Alistair Francis <[email protected]>Reviewed-by Markus Armbruster <[email protected]>---
v2:
- Don't add*vreport()functions to checkpatch
- Maintain original comments for the reporting functions
- Don't change the error report output in this patch
v1:
- Don't expose the generic report andvreport()functions
- Prefix error messages
- Use vreport instead ofqmsg_vreport()
RFC V3:
- Change the function and enum names to be more descriptive
- Add wrapper functions for*_report()and*_vreport()include/qemu/error-report.h | 7 +++ scripts/checkpatch.pl | 6 ++- util/qemu-error.c | 102 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 109 insertions(+), 6 deletions(-)[...]
Quoted 12 lines
scripts/checkpatch.pl sub process { · line 2538
Quoted 10 lines
scripts/checkpatch.pl +1
-1@@ -2535,7 +2535,11 @@ sub process { error_prepend| error_reportf_err| error_vreport| - error_report}x; + report_vreport|Should be
warn_vreport, oops. I can fix this on commit.
I have to send a new version anyway so I'll just fix it.
Thanks,
Alistair
Quoted 9 lines
Quoted 8 lines
scripts/checkpatch.pl +4
-0+ info_vreport| + error_report| + warn_report| + info_report}x; if ($rawline =~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) { ERROR("Error messages should not contain newlines\n" . $herecurr);[...]
PATCH v3 3/8 Convert error_report() to warn_report()
In reply to Alistair FrancisConvert all uses of error_report("warning:"... to use warn_report() instead. This helps standardise on a single method of printing warnings to the user.
All of the warnings where changed using these two commands:
find ./* -type f -exec sed -i \
's|error_report(".*warning[,:] |warn_report("|Ig' {} +Then the white space changes where manually fixed afterwards.
The test-qdev-global-props test case was manually updated to ensure that this patch passes make check (as the test cases are case sensitive).
Reviewed by: Peter Chubb <[email protected]>
---
V3:
- Regenerate patch to ensure no manual edits where made
- Tighten regex matches
V2:
- Fix quotation issues
- Update commit message
- Include full command
Just a note:
We will need to do a similar thing for fprintf. There are patches on the list at the moment that conflict with this series (by adding error_report() calls that shsould be warning), so I think I'm giong to have to do a follow up series converting more cases. I'll cover the fprintf cases when I do that. There are some manual cases as well that don't say warning or info, but really should. They will have to be converted as well.
block/backup.c | 10 +++++----- block/gluster.c | 4 ++-- block/iscsi.c | 6 +++--- block/nfs.c | 12 ++++++------ block/rbd.c | 6 +++--- block/ssh.c | 4 ++-- blockdev.c | 2 +- cpus.c | 2 +- hw/9pfs/9p.c | 2 +- hw/arm/highbank.c | 6 +++--- hw/arm/imx25_pdk.c | 6 +++--- hw/arm/kzm.c | 6 +++--- hw/core/machine.c | 10 +++++----- hw/core/qdev-properties.c | 8 ++++---- hw/i386/acpi-build.c | 10 +++++----- hw/i386/kvm/pci-assign.c | 6 +++--- hw/i386/pc.c | 10 +++++----- hw/i386/pc_piix.c | 8 ++++---- hw/i386/pc_q35.c | 6 +++--- hw/misc/aspeed_sdmc.c | 8 ++++---- hw/nvram/fw_cfg.c | 2 +- hw/pci-host/piix.c | 2 +- hw/ppc/pnv.c | 6 +++--- hw/ppc/spapr.c | 4 ++-- hw/ppc/spapr_iommu.c | 2 +- hw/scsi/scsi-bus.c | 6 +++--- hw/usb/dev-smartcard-reader.c | 4 ++-- hw/usb/redirect.c | 2 +- net/tap-linux.c | 2 +- target/i386/cpu.c | 8 ++++---- target/i386/kvm.c | 4 ++-- target/s390x/cpu_models.c | 2 +- target/s390x/kvm.c | 2 +- tests/test-qdev-global-props.c | 6 +++--- trace/control.c | 4 ++-- vl.c | 20 ++++++++++---------- 36 files changed, 104 insertions(+), 104 deletions(-)
block/backup.c +5 -5
@@ -639,11 +639,11 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, ret =bdrv_get_info (target, &bdi);if (ret == -ENOTSUP && !target->backing) {/* Cluster size is not defined */ -error_report ("WARNING: The target block device doesn't provide " -"information about the block size and it doesn't have a " -"backing file. The default block size of %u bytes is " -"used. If the actual block size of the target exceeds " -"this default, the backup may be unusable" , +warn_report ("The target block device doesn't provide " +"information about the block size and it doesn't have a " +"backing file. The default block size of %u bytes is " +"used. If the actual block size of the target exceeds " +"this default, the backup may be unusable" ,BACKUP_CLUSTER_SIZE_DEFAULT ); job->cluster_size =BACKUP_CLUSTER_SIZE_DEFAULT ; }else if (ret <0 && !target->backing) {
block/gluster.c +2 -2
@@ -345,8 +345,8 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, is_unix = true; }else if (!strcmp (uri->scheme,"gluster+rdma" )) { gsconf->type =SOCKET_ADDRESS_TYPE_INET ; -error_report ("Warning: rdma feature is not supported, falling " -"back to tcp" ); +warn_report ("rdma feature is not supported, falling " +"back to tcp" ); }else { ret = -EINVAL ; goto out;
block/iscsi.c +3 -3
@@ -1761,9 +1761,9 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,* filename encoded options */ filename =qdict_get_try_str (options,"filename" );if (filename) { -error_report ("Warning: 'filename' option specified. " -"This is an unsupported option, and may be deprecated " -"in the future" ); +warn_report ("'filename' option specified. " +"This is an unsupported option, and may be deprecated " +"in the future" );iscsi_parse_filename (filename, options, &local_err);if (local_err) { ret = -EINVAL ;
block/nfs.c +6 -6
@@ -558,8 +558,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options, } client->readahead =qemu_opt_get_number (opts,"readahead-size" ,0 );if (client->readahead >QEMU_NFS_MAX_READAHEAD_SIZE ) { -error_report ("NFS Warning: Truncating NFS readahead " -"size to %d" ,QEMU_NFS_MAX_READAHEAD_SIZE ); +warn_report ("Truncating NFS readahead " +"size to %d" ,QEMU_NFS_MAX_READAHEAD_SIZE ); client->readahead =QEMU_NFS_MAX_READAHEAD_SIZE ; }nfs_set_readahead (client->context, client->readahead);
@@ -579,8 +579,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options, } client->pagecache =qemu_opt_get_number (opts,"page-cache-size" ,0 );if (client->pagecache >QEMU_NFS_MAX_PAGECACHE_SIZE ) { -error_report ("NFS Warning: Truncating NFS pagecache " -"size to %d pages" ,QEMU_NFS_MAX_PAGECACHE_SIZE ); +warn_report ("Truncating NFS pagecache " +"size to %d pages" ,QEMU_NFS_MAX_PAGECACHE_SIZE ); client->pagecache =QEMU_NFS_MAX_PAGECACHE_SIZE ; }nfs_set_pagecache (client->context, client->pagecache);
@@ -595,8 +595,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options,/* limit the maximum debug level to avoid potential flooding * of our log files. */ if (client->debug >QEMU_NFS_MAX_DEBUG_LEVEL ) { -error_report ("NFS Warning: Limiting NFS debug level " -"to %d" ,QEMU_NFS_MAX_DEBUG_LEVEL ); +warn_report ("Limiting NFS debug level " +"to %d" ,QEMU_NFS_MAX_DEBUG_LEVEL ); client->debug =QEMU_NFS_MAX_DEBUG_LEVEL ; }nfs_set_debug (client->context, client->debug);
block/rbd.c +3 -3
@@ -555,9 +555,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,* filename encoded options */ filename =qdict_get_try_str (options,"filename" );if (filename) { -error_report ("Warning: 'filename' option specified. " -"This is an unsupported option, and may be deprecated " -"in the future" ); +warn_report ("'filename' option specified. " +"This is an unsupported option, and may be deprecated " +"in the future" );qemu_rbd_parse_filename (filename, options, &local_err);if (local_err) { r = -EINVAL ;
block/ssh.c +2 -2
@@ -1114,8 +1114,8 @@ static coroutine_fn int ssh_co_writev(BlockDriverState *bs,static void unsafe_flush_warning (BDRVSSHState *s,const char *what) {if (!s->unsafe_flush_warning) { -error_report ("warning: ssh server %s does not support fsync" , - s->inet->host); +warn_report ("ssh server %s does not support fsync" , + s->inet->host);if (what) {error_report ("to support fsync, you need %s" , what); }
blockdev.c +1 -1
@@ -914,7 +914,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) copy_on_read =qemu_opt_get_bool (legacy_opts,"copy-on-read" , false);if (read_only && copy_on_read) { -error_report ("warning: disabling copy-on-read on read-only drive" ); +warn_report ("disabling copy-on-read on read-only drive" ); copy_on_read = false; }
cpus.c +1 -1
@@ -557,7 +557,7 @@ void qemu_start_warp_timer(void)if (deadline <0 ) {static bool notified;if (!icount_sleep && !notified) { -error_report ("WARNING: icount sleep disabled and no active timers" ); +warn_report ("icount sleep disabled and no active timers" ); notified = true; }return ;
hw/9pfs/9p.c +1 -1
@@ -2376,7 +2376,7 @@ static void coroutine_fn v9fs_flush(void *opaque)trace_v9fs_flush (pdu->tag, pdu->id, tag);if (pdu->tag == tag) { -error_report ("Warning: the guest sent a self-referencing 9P flush request" ); +warn_report ("the guest sent a self-referencing 9P flush request" ); }else { QLIST_FOREACH(cancel_pdu, &s->active_list, next) {if (cancel_pdu->tag == tag) {
hw/arm/highbank.c +3 -3
@@ -383,9 +383,9 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) highbank_binfo.write_board_setup = hb_write_board_setup; highbank_binfo.secure_board_setup = true; }else { -error_report ("WARNING: cannot load built-in Monitor support " -"if KVM is enabled. Some guests (such as Linux) " -"may not boot." ); +warn_report ("cannot load built-in Monitor support " +"if KVM is enabled. Some guests (such as Linux) " +"may not boot." ); }arm_load_kernel (ARM_CPU (first_cpu), &highbank_binfo);
hw/arm/imx25_pdk.c +3 -3
@@ -80,9 +80,9 @@ static void imx25_pdk_init(MachineState *machine)/* We need to initialize our memory */ if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE )) { -error_report ("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " -"reduced to %x" , machine->ram_size, -FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ); +warn_report ("RAM size " RAM_ADDR_FMT " above max supported, " +"reduced to %x" , machine->ram_size, +FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ); machine->ram_size =FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ; }
hw/arm/kzm.c +3 -3
@@ -79,9 +79,9 @@ static void kzm_init(MachineState *machine)/* Check the amount of memory is compatible with the SOC */ if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE )) { -error_report ("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " -"reduced to %x" , machine->ram_size, -FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ); +warn_report ("RAM size " RAM_ADDR_FMT " above max supported, " +"reduced to %x" , machine->ram_size, +FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ); machine->ram_size =FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ; }
hw/core/machine.c +5 -5
@@ -741,11 +741,11 @@ static void machine_numa_finish_init(MachineState *machine) } }if (s->len && !qtest_enabled ()) { -error_report ("warning: CPU(s) not present in any NUMA nodes: %s" , - s->str); -error_report ("warning: All CPU(s) up to maxcpus should be described " -"in NUMA config, ability to start up with partial NUMA " -"mappings is obsoleted and will be removed in future" ); +warn_report ("CPU(s) not present in any NUMA nodes: %s" , + s->str); +warn_report ("All CPU(s) up to maxcpus should be described " +"in NUMA config, ability to start up with partial NUMA " +"mappings is obsoleted and will be removed in future" ); }g_string_free (s, true); }
hw/core/qdev-properties.c +4 -4
@@ -1132,15 +1132,15 @@ int qdev_prop_check_globals(void) oc =object_class_by_name (prop->driver); oc =object_class_dynamic_cast (oc,TYPE_DEVICE );if (!oc) { -error_report ("Warning: global %s.%s has invalid class name" , - prop->driver, prop->property); +warn_report ("global %s.%s has invalid class name" , + prop->driver, prop->property); ret =1 ;continue ; } dc =DEVICE_CLASS (oc);if (!dc->hotpluggable && !prop->used) { -error_report ("Warning: global %s.%s=%s not used" , - prop->driver, prop->property, prop->value); +warn_report ("global %s.%s=%s not used" , + prop->driver, prop->property, prop->value); ret =1 ;continue ; }
hw/i386/acpi-build.c +5 -5
@@ -2766,17 +2766,17 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) ACPI_BUILD_ALIGN_SIZE);if (tables_blob->len > legacy_table_size) {/* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ -error_report ("Warning: migration may not work." ); +warn_report ("migration may not work." ); }g_array_set_size (tables_blob, legacy_table_size); }else {/* Make sure we have a buffer in case we need to resize the tables. */ if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) {/* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ -error_report ("Warning: ACPI tables are larger than 64k." ); -error_report ("Warning: migration may not work." ); -error_report ("Warning: please remove CPUs, NUMA nodes, " -"memory slots or PCI bridges." ); +warn_report ("ACPI tables are larger than 64k." ); +warn_report ("migration may not work." ); +warn_report ("please remove CPUs, NUMA nodes, " +"memory slots or PCI bridges." ); }acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); }
hw/i386/kvm/pci-assign.c +3 -3
@@ -1353,9 +1353,9 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp) PCI_CAP_ID_EXP);return -EINVAL ; }else if (size !=0x3c ) { -error_report ("WARNING, %s: PCIe cap-id 0x%x has " -"non-standard size 0x%x; std size should be 0x3c" , - __func__,PCI_CAP_ID_EXP , size); +warn_report ("%s: PCIe cap-id 0x%x has " +"non-standard size 0x%x; std size should be 0x3c" , + __func__,PCI_CAP_ID_EXP , size); } }else if (version ==0 ) {uint16_t vid, did;
hw/i386/pc.c +5 -5
@@ -381,8 +381,8 @@ ISADevice *pc_find_fdc0(void) }if (state.multiple) { -error_report ("warning: multiple floppy disk controllers with " -"iobase=0x3f0 have been found" ); +warn_report ("multiple floppy disk controllers with " +"iobase=0x3f0 have been found" );error_printf ("the one being picked for CMOS setup might not reflect " "your intent\n" ); }
@@ -2087,9 +2087,9 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, }if (value < (1ULL <<20 )) { -error_report ("Warning: small max_ram_below_4g(%" PRIu64 -") less than 1M. BIOS may not work.." , - value); +warn_report ("small max_ram_below_4g(%" PRIu64 +") less than 1M. BIOS may not work.." , + value); } pcms->max_ram_below_4g = value;
hw/i386/pc_piix.c +4 -4
@@ -131,10 +131,10 @@ static void pc_init1(MachineState *machine, lowmem =0xc0000000 ; }if (lowmem & ((1ULL <<30 ) -1 )) { -error_report ("Warning: Large machine and max_ram_below_4g " -"(%" PRIu64") not a multiple of 1G; " -"possible bad performance." , - pcms->max_ram_below_4g); +warn_report ("Large machine and max_ram_below_4g " +"(%" PRIu64") not a multiple of 1G; " +"possible bad performance." , + pcms->max_ram_below_4g); } } }
hw/i386/pc_q35.c +3 -3
@@ -101,9 +101,9 @@ static void pc_q35_init(MachineState *machine) lowmem = pcms->max_ram_below_4g;if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL <<30 ) -1 )) { -error_report ("Warning: Large machine and max_ram_below_4g(%" PRIu64 -") not a multiple of 1G; possible bad performance." , - pcms->max_ram_below_4g); +warn_report ("Large machine and max_ram_below_4g(%" PRIu64 +") not a multiple of 1G; possible bad performance." , + pcms->max_ram_below_4g); } }
hw/misc/aspeed_sdmc.c +4 -4
@@ -157,8 +157,8 @@ static int ast2400_rambits(AspeedSDMCState *s) }/* use a common default */ -error_report ("warning: Invalid RAM size 0x%" PRIx64 -". Using default 256M" , s->ram_size); +warn_report ("Invalid RAM size 0x%" PRIx64 +". Using default 256M" , s->ram_size); s->ram_size =256 <<20 ;return ASPEED_SDMC_DRAM_256MB ; }
@@ -179,8 +179,8 @@ static int ast2500_rambits(AspeedSDMCState *s) }/* use a common default */ -error_report ("warning: Invalid RAM size 0x%" PRIx64 -". Using default 512M" , s->ram_size); +warn_report ("Invalid RAM size 0x%" PRIx64 +". Using default 512M" , s->ram_size); s->ram_size =512 <<20 ;return ASPEED_SDMC_AST2500_512MB ; }
hw/nvram/fw_cfg.c +1 -1
@@ -781,7 +781,7 @@ static int get_fw_cfg_order(FWCfgState *s, const char *name) }/* Stick unknown stuff at the end. */ -error_report ("warning: Unknown firmware file in legacy mode: %s" , name); +warn_report ("Unknown firmware file in legacy mode: %s" , name);return FW_CFG_ORDER_OVERRIDE_LAST ; }
hw/pci-host/piix.c +1 -1
@@ -307,7 +307,7 @@ static void i440fx_realize(PCIDevice *dev, Error **errp) dev->config[I440FX_SMRAM ] =0x02 ;if (object_property_get_bool (qdev_get_machine (),"iommu" ,NULL )) { -error_report ("warning: i440fx doesn't support emulated iommu" ); +warn_report ("i440fx doesn't support emulated iommu" ); } }
hw/ppc/pnv.c +3 -3
@@ -160,13 +160,13 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)_FDT ((fdt_setprop_cell (fdt, offset,"d-cache-size" , pcc->l1_dcache_size))); }else { -error_report ("Warning: Unknown L1 dcache size for cpu" ); +warn_report ("Unknown L1 dcache size for cpu" ); }if (pcc->l1_icache_size) {_FDT ((fdt_setprop_cell (fdt, offset,"i-cache-size" , pcc->l1_icache_size))); }else { -error_report ("Warning: Unknown L1 icache size for cpu" ); +warn_report ("Unknown L1 icache size for cpu" ); }_FDT ((fdt_setprop_cell (fdt, offset,"timebase-frequency" , tbfreq)));
@@ -556,7 +556,7 @@ static void ppc_powernv_init(MachineState *machine)/* allocate RAM */ if (machine->ram_size < (1 *G_BYTE )) { -error_report ("Warning: skiboot may not work with < 1GB of RAM" ); +warn_report ("skiboot may not work with < 1GB of RAM" ); } ram =g_new (MemoryRegion,1 );
hw/ppc/spapr.c +2 -2
@@ -534,13 +534,13 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,_FDT ((fdt_setprop_cell (fdt, offset,"d-cache-size" , pcc->l1_dcache_size))); }else { -error_report ("Warning: Unknown L1 dcache size for cpu" ); +warn_report ("Unknown L1 dcache size for cpu" ); }if (pcc->l1_icache_size) {_FDT ((fdt_setprop_cell (fdt, offset,"i-cache-size" , pcc->l1_icache_size))); }else { -error_report ("Warning: Unknown L1 icache size for cpu" ); +warn_report ("Unknown L1 icache size for cpu" ); }_FDT ((fdt_setprop_cell (fdt, offset,"timebase-frequency" , tbfreq)));
hw/ppc/spapr_iommu.c +1 -1
@@ -334,7 +334,7 @@ void spapr_tce_table_enable(sPAPRTCETable *tcet, uint32_t nb_table) {if (tcet->nb_table) { -error_report ("Warning: trying to enable already enabled TCE table" ); +warn_report ("trying to enable already enabled TCE table" );return ; }
hw/scsi/scsi-bus.c +3 -3
@@ -282,9 +282,9 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)continue ;/* claimed */ }if (!dinfo->is_default) { -error_report ("warning: bus=%d,unit=%d is deprecated with this" -" machine type" , - bus->busnr, unit); +warn_report ("bus=%d,unit=%d is deprecated with this" +" machine type" , + bus->busnr, unit); } } scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),
hw/usb/dev-smartcard-reader.c +2 -2
@@ -1314,12 +1314,12 @@ static int ccid_card_init(DeviceState *qdev)int ret =0 ;if (card->slot !=0 ) { -error_report ("Warning: usb-ccid supports one slot, can't add %d" , +warn_report ("usb-ccid supports one slot, can't add %d" , card->slot);return -1 ; }if (s->card !=NULL ) { -error_report ("Warning: usb-ccid card already full, not adding" ); +warn_report ("usb-ccid card already full, not adding" );return -1 ; } ret =ccid_card_initfn (card);
hw/usb/redirect.c +1 -1
@@ -193,7 +193,7 @@ static void usbredir_handle_status(USBRedirDevice *dev, USBPacket *p,#define WARNING (...) \ do { \ if (dev->debug >= usbredirparser_warning) { \ - error_report("usb-redir warning: " __VA_ARGS__); \ + warn_report("" __VA_ARGS__); \ } \ } while (0)#define INFO (...) \
net/tap-linux.c +1 -1
@@ -55,7 +55,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, ifr.ifr_flags =IFF_TAP |IFF_NO_PI ;if (ioctl (fd,TUNGETFEATURES , &features) ==-1 ) { -error_report ("warning: TUNGETFEATURES failed: %s" ,strerror (errno)); +warn_report ("TUNGETFEATURES failed: %s" ,strerror (errno)); features =0 ; }
target/i386/cpu.c +4 -4
@@ -2060,13 +2060,13 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, name = featurestr;if (g_list_find_custom (plus_features, name, compare_string)) { -error_report ("warning: Ambiguous CPU model string. " +warn_report ("Ambiguous CPU model string. " "Don't mix both \"+%s\" and \"%s=%s\"" , name, name, val); ambiguous = true; }if (g_list_find_custom (minus_features, name, compare_string)) { -error_report ("warning: Ambiguous CPU model string. " +warn_report ("Ambiguous CPU model string. " "Don't mix both \"-%s\" and \"%s=%s\"" , name, name, val); ambiguous = true;
@@ -2096,7 +2096,7 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, }if (ambiguous) { -error_report ("warning: Compatibility of ambiguous CPU model " +warn_report ("Compatibility of ambiguous CPU model " "strings won't be kept on future QEMU versions" ); } }
@@ -3547,7 +3547,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)*/ if (cpu->phys_bits != host_phys_bits && cpu->phys_bits !=0 && !warned) { -error_report ("Warning: Host physical bits (%u)" +warn_report ("Host physical bits (%u)" " does not match phys-bits property (%u)" , host_phys_bits, cpu->phys_bits); warned = true;
target/i386/kvm.c +2 -2
@@ -600,7 +600,7 @@ static int kvm_arch_set_tsc_khz(CPUState *cs) kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ) : -ENOTSUP ;if (cur_freq <=0 || cur_freq != env->tsc_khz) { -error_report ("warning: TSC frequency mismatch between " +warn_report ("TSC frequency mismatch between " "VM (%" PRId64" kHz) and host (%d kHz), " "and TSC scaling unavailable" , env->tsc_khz, cur_freq);
@@ -919,7 +919,7 @@ int kvm_arch_init_vcpu(CPUState *cs)error_report ("kvm: LMCE not supported" );return -ENOTSUP ; } -error_report ("warning: Unsupported MCG_CAP bits: 0x%" PRIx64, +warn_report ("Unsupported MCG_CAP bits: 0x%" PRIx64, unsupported_caps); }
target/s390x/cpu_models.c +1 -1
@@ -677,7 +677,7 @@ static void check_consistency(const S390CPUModel *model)for (i =0 ; i <ARRAY_SIZE (dep); i++) {if (test_bit (dep[i][0 ], model->features) && !test_bit (dep[i][1 ], model->features)) { -error_report ("Warning: \'%s\' requires \'%s\'." , +warn_report ("\'%s\' requires \'%s\'." ,s390_feat_def (dep[i][0 ])->name,s390_feat_def (dep[i][1 ])->name); }
target/s390x/kvm.c +1 -1
@@ -2675,7 +2675,7 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)/* enable CMM via CMMA - disable on hugetlbfs */ if (test_bit (S390_FEAT_CMM , model->features)) {if (mem_path) { -error_report ("Warning: CMM will not be enabled because it is not " +warn_report ("CMM will not be enabled because it is not " "compatible to hugetlbfs." ); }else {kvm_s390_enable_cmma ();
tests/test-qdev-global-props.c +3 -3
@@ -232,10 +232,10 @@ static void test_dynamic_globalprop(void)g_test_trap_assert_passed ();g_test_trap_assert_stderr_unmatched ("*prop1*" );g_test_trap_assert_stderr_unmatched ("*prop2*" ); -g_test_trap_assert_stderr ("*Warning: global dynamic-prop-type-bad.prop3 has invalid class name\n*" ); +g_test_trap_assert_stderr ("*warning: global dynamic-prop-type-bad.prop3 has invalid class name\n*" );g_test_trap_assert_stderr_unmatched ("*prop4*" ); -g_test_trap_assert_stderr ("*Warning: global nohotplug-type.prop5=105 not used\n*" ); -g_test_trap_assert_stderr ("*Warning: global nondevice-type.prop6 has invalid class name\n*" ); +g_test_trap_assert_stderr ("*warning: global nohotplug-type.prop5=105 not used\n*" ); +g_test_trap_assert_stderr ("*warning: global nondevice-type.prop6 has invalid class name\n*" );g_test_trap_assert_stdout ("" ); }
trace/control.c +2 -2
@@ -171,7 +171,7 @@ static void do_trace_enable_events(const char *line_buf)while ((ev =trace_event_iter_next (&iter)) !=NULL ) {if (!trace_event_get_state_static (ev)) {if (!is_pattern) { -error_report ("WARNING: trace event '%s' is not traceable" , +warn_report ("trace event '%s' is not traceable" , line_ptr);return ; }
@@ -186,7 +186,7 @@ static void do_trace_enable_events(const char *line_buf) }if (!is_pattern) { -error_report ("WARNING: trace event '%s' does not exist" , +warn_report ("trace event '%s' does not exist" , line_ptr); } }
vl.c +10 -10
@@ -952,8 +952,8 @@ static void bt_vhci_add(int vlan_id)struct bt_scatternet_s *vlan =qemu_find_bt_vlan (vlan_id);if (!vlan->slave) -error_report ("warning: adding a VHCI to an empty scatternet %i" , - vlan_id); +warn_report ("adding a VHCI to an empty scatternet %i" , + vlan_id);bt_vhci_init (bt_new_hci (vlan)); }
@@ -979,8 +979,8 @@ static struct bt_device_s *bt_device_add(const char *opt) vlan =qemu_find_bt_vlan (vlan_id);if (!vlan->slave) -error_report ("warning: adding a slave device to an empty scatternet %i" , - vlan_id); +warn_report ("adding a slave device to an empty scatternet %i" , + vlan_id);if (!strcmp (devname,"keyboard" ))return bt_keyboard_init (vlan);
@@ -2302,8 +2302,8 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)return -1 ; }if (strncmp (name,"opt/" ,4 ) !=0 ) { -error_report ("warning: externally provided fw_cfg item names " -"should be prefixed with \"opt/\"" ); +warn_report ("externally provided fw_cfg item names " +"should be prefixed with \"opt/\"" ); }if (nonempty_str (str)) { size =strlen (str);/* NUL terminator NOT included in fw_cfg blob */
@@ -3760,7 +3760,7 @@ int main(int argc, char **argv, char **envp)qemu_opts_parse_noisily (olist,"accel=tcg" , false);break ;case QEMU_OPTION_no_kvm_pit: { -error_report ("warning: ignoring deprecated option" ); +warn_report ("ignoring deprecated option" );break ; }case QEMU_OPTION_no_kvm_pit_reinjection: {
@@ -3770,8 +3770,8 @@ int main(int argc, char **argv, char **envp) .value = "discard", }; -error_report ("warning: deprecated, replaced by " -"-global kvm-pit.lost_tick_policy=discard" ); +warn_report ("deprecated, replaced by " +"-global kvm-pit.lost_tick_policy=discard" );qdev_prop_register_global (&kvm_pit_lost_tick_policy);break ; }
@@ -3896,7 +3896,7 @@ int main(int argc, char **argv, char **envp) }break ;case QEMU_OPTION_tdf: -error_report ("warning: ignoring deprecated option" ); +warn_report ("ignoring deprecated option" );break ;case QEMU_OPTION_name: opts = qemu_opts_parse_noisily(qemu_find_opts("name"),
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v3 3/8] Convert error_report() to warn_report()
Quoted 116 lines · Alistair Francis
Convert all uses of error_report("warning:"... to use
warn_report()instead. This helps standardise on a single method of printing warnings to the user.All of the warnings where changed using these two commands:
find ./* -type f -exec sed -i \ 's|error_report(".*warning[,:] |warn_report("|Ig' {} +Then the white space changes where manually fixed afterwards.
The test-qdev-global-props test case was manually updated to ensure that this patch passes make check (as the test cases are case sensitive).
Signed-off-by Alistair Francis <[email protected]>Suggested-by Thomas Huth <[email protected]>Cc Jeff Cody <[email protected]>Cc Kevin Wolf <[email protected]>Cc Max Reitz <[email protected]>Cc Ronnie Sahlberg <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Peter Lieven <[email protected]>Cc Josh Durgin <[email protected]>Cc "Richard W.M. Jones" <[email protected]>Cc Markus Armbruster <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Richard Henderson <[email protected]>Cc "Aneesh Kumar K.V" <[email protected]>Cc Greg Kurz <[email protected]>Cc Rob Herring <[email protected]>Cc Peter Maydell <[email protected]>Cc Peter Chubb <[email protected]>Cc Eduardo Habkost <[email protected]>Cc Marcel Apfelbaum <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Cc David Gibson <[email protected]>Cc Alexander Graf <[email protected]>Cc Gerd Hoffmann <[email protected]>Cc Jason Wang <[email protected]>Cc Marcelo Tosatti <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Cornelia Huck <[email protected]>Cc Stefan Hajnoczi <[email protected]>Acked-by David Gibson <[email protected]>Acked-by Greg Kurz <[email protected]>Acked-by Cornelia Huck <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>Reviewed by: Peter Chubb <[email protected]>
Acked-by Max Reitz <[email protected]>Acked-by Marcel Apfelbaum <[email protected]>---
V3:
- Regenerate patch to ensure no manual edits where made
- Tighten regex matches
V2:
- Fix quotation issues
- Update commit message
- Include full commandJust a note:
We will need to do a similar thing for fprintf. There are patches on the list at the moment that conflict with this series (by addingerror_report()calls that shsould be warning), so I think I'm giong to have to do a follow up series converting more cases. I'll cover the fprintf cases when I do that. There are some manual cases as well that don't say warning or info, but really should. They will have to be converted as well.block/backup.c | 10 +++++----- block/gluster.c | 4 ++-- block/iscsi.c | 6 +++--- block/nfs.c | 12 ++++++------ block/rbd.c | 6 +++--- block/ssh.c | 4 ++-- blockdev.c | 2 +- cpus.c | 2 +- hw/9pfs/9p.c | 2 +- hw/arm/highbank.c | 6 +++--- hw/arm/imx25_pdk.c | 6 +++--- hw/arm/kzm.c | 6 +++--- hw/core/machine.c | 10 +++++----- hw/core/qdev-properties.c | 8 ++++---- hw/i386/acpi-build.c | 10 +++++----- hw/i386/kvm/pci-assign.c | 6 +++--- hw/i386/pc.c | 10 +++++----- hw/i386/pc_piix.c | 8 ++++---- hw/i386/pc_q35.c | 6 +++--- hw/misc/aspeed_sdmc.c | 8 ++++---- hw/nvram/fw_cfg.c | 2 +- hw/pci-host/piix.c | 2 +- hw/ppc/pnv.c | 6 +++--- hw/ppc/spapr.c | 4 ++-- hw/ppc/spapr_iommu.c | 2 +- hw/scsi/scsi-bus.c | 6 +++--- hw/usb/dev-smartcard-reader.c | 4 ++-- hw/usb/redirect.c | 2 +- net/tap-linux.c | 2 +- target/i386/cpu.c | 8 ++++---- target/i386/kvm.c | 4 ++-- target/s390x/cpu_models.c | 2 +- target/s390x/kvm.c | 2 +- tests/test-qdev-global-props.c | 6 +++--- trace/control.c | 4 ++-- vl.c | 20 ++++++++++---------- 36 files changed, 104 insertions(+), 104 deletions(-)block/backup.c +0
-1@@ -639,11 +639,11 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, ret =bdrv_get_info (target, &bdi);if (ret == -ENOTSUP && !target->backing) {/* Cluster size is not defined */ - error_report("WARNING: The target block device doesn't provide "
block/backup.c BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, · line 647
Quoted 10 lines
block/backup.c +5
-4-"information about the block size and it doesn't have a " -"backing file. The default block size of %u bytes is " -"used. If the actual block size of the target exceeds " -"this default, the backup may be unusable" , +warn_report ("The target block device doesn't provide " +"information about the block size and it doesn't have a " +"backing file. The default block size of %u bytes is " +"used. If the actual block size of the target exceeds " +"this default, the backup may be unusable" ,BACKUP_CLUSTER_SIZE_DEFAULT );
Sorry I didn't see this before, but this line may need re-indentation as well.
But I'm not too picky (even though maybe I should be O:-)), so my Acked-by can stay either way.
Max
Re: [Qemu-devel] [PATCH v3 3/8] Convert error_report() to warn_report()
In reply to Alistair FrancisQuoted 5 lines · Alistair Francis
Convert all uses of error_report("warning:"... to use
warn_report()instead. This helps standardise on a single method of printing warnings to the user.All of the warnings where changed using these two commands:
s/where/were/
Quoted 111 lines
find ./* -type f -exec sed -i \ 's|error_report(".*warning[,:] |warn_report("|Ig' {} +Then the white space changes where manually fixed afterwards.
The test-qdev-global-props test case was manually updated to ensure that this patch passes make check (as the test cases are case sensitive).
Signed-off-by Alistair Francis <[email protected]>Suggested-by Thomas Huth <[email protected]>Cc Jeff Cody <[email protected]>Cc Kevin Wolf <[email protected]>Cc Max Reitz <[email protected]>Cc Ronnie Sahlberg <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Peter Lieven <[email protected]>Cc Josh Durgin <[email protected]>Cc "Richard W.M. Jones" <[email protected]>Cc Markus Armbruster <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Richard Henderson <[email protected]>Cc "Aneesh Kumar K.V" <[email protected]>Cc Greg Kurz <[email protected]>Cc Rob Herring <[email protected]>Cc Peter Maydell <[email protected]>Cc Peter Chubb <[email protected]>Cc Eduardo Habkost <[email protected]>Cc Marcel Apfelbaum <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Cc David Gibson <[email protected]>Cc Alexander Graf <[email protected]>Cc Gerd Hoffmann <[email protected]>Cc Jason Wang <[email protected]>Cc Marcelo Tosatti <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Cornelia Huck <[email protected]>Cc Stefan Hajnoczi <[email protected]>Acked-by David Gibson <[email protected]>Acked-by Greg Kurz <[email protected]>Acked-by Cornelia Huck <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>Reviewed by: Peter Chubb <[email protected]>
Acked-by Max Reitz <[email protected]>Acked-by Marcel Apfelbaum <[email protected]>---
V3:
- Regenerate patch to ensure no manual edits where made
- Tighten regex matches
V2:
- Fix quotation issues
- Update commit message
- Include full commandJust a note:
We will need to do a similar thing for fprintf. There are patches on the list at the moment that conflict with this series (by addingerror_report()calls that shsould be warning), so I think I'm giong to have to do a follow up series converting more cases. I'll cover the fprintf cases when I do that. There are some manual cases as well that don't say warning or info, but really should. They will have to be converted as well.block/backup.c | 10 +++++----- block/gluster.c | 4 ++-- block/iscsi.c | 6 +++--- block/nfs.c | 12 ++++++------ block/rbd.c | 6 +++--- block/ssh.c | 4 ++-- blockdev.c | 2 +- cpus.c | 2 +- hw/9pfs/9p.c | 2 +- hw/arm/highbank.c | 6 +++--- hw/arm/imx25_pdk.c | 6 +++--- hw/arm/kzm.c | 6 +++--- hw/core/machine.c | 10 +++++----- hw/core/qdev-properties.c | 8 ++++---- hw/i386/acpi-build.c | 10 +++++----- hw/i386/kvm/pci-assign.c | 6 +++--- hw/i386/pc.c | 10 +++++----- hw/i386/pc_piix.c | 8 ++++---- hw/i386/pc_q35.c | 6 +++--- hw/misc/aspeed_sdmc.c | 8 ++++---- hw/nvram/fw_cfg.c | 2 +- hw/pci-host/piix.c | 2 +- hw/ppc/pnv.c | 6 +++--- hw/ppc/spapr.c | 4 ++-- hw/ppc/spapr_iommu.c | 2 +- hw/scsi/scsi-bus.c | 6 +++--- hw/usb/dev-smartcard-reader.c | 4 ++-- hw/usb/redirect.c | 2 +- net/tap-linux.c | 2 +- target/i386/cpu.c | 8 ++++---- target/i386/kvm.c | 4 ++-- target/s390x/cpu_models.c | 2 +- target/s390x/kvm.c | 2 +- tests/test-qdev-global-props.c | 6 +++--- trace/control.c | 4 ++-- vl.c | 20 ++++++++++---------- 36 files changed, 104 insertions(+), 104 deletions(-)block/backup.c +0
-1@@ -639,11 +639,11 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, ret =bdrv_get_info (target, &bdi);if (ret == -ENOTSUP && !target->backing) {/* Cluster size is not defined */ - error_report("WARNING: The target block device doesn't provide "
block/backup.c BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, · line 647
Quoted 10 lines
block/backup.c +5
-4-"information about the block size and it doesn't have a " -"backing file. The default block size of %u bytes is " -"used. If the actual block size of the target exceeds " -"this default, the backup may be unusable" , +warn_report ("The target block device doesn't provide " +"information about the block size and it doesn't have a " +"backing file. The default block size of %u bytes is " +"used. If the actual block size of the target exceeds " +"this default, the backup may be unusable" ,BACKUP_CLUSTER_SIZE_DEFAULT );
As Max noted, indentation's off here.
Preexisting, not this patch's problem: an error or warning message should be a (short!) phrase, not a novel. If additional explanations are needed, they go on separate lines, like this:
warn_report("The target block device doesn't provide "
"information about the block size and it doesn't have a " "backing file");
error_printf("The default block size of %u bytes is used."
" If the actual block size of the target exceeds " "this default, the backup may be unusable.", BACKUP_CLUSTER_SIZE_DEFAULT);
Note that the warning message is a *phrase*, not a sentence, let alone three, and its followed by additional hints, which *are* sentences.
More of the same below. Followup patches welcome.
Quoted 7 lines
block/backup.c +0
-0job->cluster_size =BACKUP_CLUSTER_SIZE_DEFAULT ; }else if (ret <0 && !target->backing) {block/gluster.c +0
-0
block/gluster.c static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, · line 349
Quoted 7 lines
block/gluster.c +2
-2@@ -345,8 +345,8 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, is_unix = true; }else if (!strcmp (uri->scheme,"gluster+rdma" )) { gsconf->type =SOCKET_ADDRESS_TYPE_INET ; -error_report ("Warning: rdma feature is not supported, falling " -"back to tcp" ); +warn_report ("rdma feature is not supported, falling " +"back to tcp" );
Further cleanup:
warn_report("rdma feature is not supported, falling back to tcp");Could be done as a separate patch to keep this one as mechanical as possible, but I think squashing it in would be okay, too. If we do, then the commit message needs to updated. I think
Indentation fixed up manually afterwards.
instead of
Then the white space changes where manually fixed afterwards.
should do.
Quoted 25 lines
block/gluster.c +0
-0}else { ret = -EINVAL ; goto out;block/iscsi.c +3
-3@@ -1761,9 +1761,9 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,* filename encoded options */ filename =qdict_get_try_str (options,"filename" );if (filename) { -error_report ("Warning: 'filename' option specified. " -"This is an unsupported option, and may be deprecated " -"in the future" ); +warn_report ("'filename' option specified. " +"This is an unsupported option, and may be deprecated " +"in the future" );iscsi_parse_filename (filename, options, &local_err);if (local_err) { ret = -EINVAL ;block/nfs.c +0
-0
block/nfs.c static int64_t nfs_client_open(NFSClient *client, QDict *options, · line 562
Quoted 7 lines
block/nfs.c +2
-2@@ -558,8 +558,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options, } client->readahead =qemu_opt_get_number (opts,"readahead-size" ,0 );if (client->readahead >QEMU_NFS_MAX_READAHEAD_SIZE ) { -error_report ("NFS Warning: Truncating NFS readahead " -"size to %d" ,QEMU_NFS_MAX_READAHEAD_SIZE ); +warn_report ("Truncating NFS readahead " +"size to %d" ,QEMU_NFS_MAX_READAHEAD_SIZE );
Similarly:
warn_report("Truncating NFS readahead size to %d",
QEMU_NFS_MAX_READAHEAD_SIZE);
block/nfs.c static int64_t nfs_client_open(NFSClient *client, QDict *options, · line 583
Quoted 11 lines
block/nfs.c +2
-2client->readahead =QEMU_NFS_MAX_READAHEAD_SIZE ; }nfs_set_readahead (client->context, client->readahead);@@ -579,8 +579,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options, } client->pagecache =qemu_opt_get_number (opts,"page-cache-size" ,0 );if (client->pagecache >QEMU_NFS_MAX_PAGECACHE_SIZE ) { -error_report ("NFS Warning: Truncating NFS pagecache " -"size to %d pages" ,QEMU_NFS_MAX_PAGECACHE_SIZE ); +warn_report ("Truncating NFS pagecache " +"size to %d pages" ,QEMU_NFS_MAX_PAGECACHE_SIZE );
Similarly:
warn_report("Truncating NFS pagecache size to %d pages",
QEMU_NFS_MAX_PAGECACHE_SIZE);
block/nfs.c static int64_t nfs_client_open(NFSClient *client, QDict *options, · line 599
Quoted 11 lines
block/nfs.c +2
-2client->pagecache =QEMU_NFS_MAX_PAGECACHE_SIZE ; }nfs_set_pagecache (client->context, client->pagecache);@@ -595,8 +595,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options,/* limit the maximum debug level to avoid potential flooding * of our log files. */ if (client->debug >QEMU_NFS_MAX_DEBUG_LEVEL ) { -error_report ("NFS Warning: Limiting NFS debug level " -"to %d" ,QEMU_NFS_MAX_DEBUG_LEVEL ); +warn_report ("Limiting NFS debug level " +"to %d" ,QEMU_NFS_MAX_DEBUG_LEVEL );
warn_report("Limiting NFS debug level to %d",
QEMU_NFS_MAX_DEBUG_LEVEL);
Quoted 133 lines
block/nfs.c +0
-0client->debug =QEMU_NFS_MAX_DEBUG_LEVEL ; }nfs_set_debug (client->context, client->debug);block/rbd.c +3
-3@@ -555,9 +555,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,* filename encoded options */ filename =qdict_get_try_str (options,"filename" );if (filename) { -error_report ("Warning: 'filename' option specified. " -"This is an unsupported option, and may be deprecated " -"in the future" ); +warn_report ("'filename' option specified. " +"This is an unsupported option, and may be deprecated " +"in the future" );qemu_rbd_parse_filename (filename, options, &local_err);if (local_err) { r = -EINVAL ;block/ssh.c +2
-2@@ -1114,8 +1114,8 @@ static coroutine_fn int ssh_co_writev(BlockDriverState *bs,static void unsafe_flush_warning (BDRVSSHState *s,const char *what) {if (!s->unsafe_flush_warning) { -error_report ("warning: ssh server %s does not support fsync" , - s->inet->host); +warn_report ("ssh server %s does not support fsync" , + s->inet->host);if (what) {error_report ("to support fsync, you need %s" , what); }blockdev.c +1
-1@@ -914,7 +914,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) copy_on_read =qemu_opt_get_bool (legacy_opts,"copy-on-read" , false);if (read_only && copy_on_read) { -error_report ("warning: disabling copy-on-read on read-only drive" ); +warn_report ("disabling copy-on-read on read-only drive" ); copy_on_read = false; }cpus.c +1
-1@@ -557,7 +557,7 @@ void qemu_start_warp_timer(void)if (deadline <0 ) {static bool notified;if (!icount_sleep && !notified) { -error_report ("WARNING: icount sleep disabled and no active timers" ); +warn_report ("icount sleep disabled and no active timers" ); notified = true; }return ;hw/9pfs/9p.c +1
-1@@ -2376,7 +2376,7 @@ static void coroutine_fn v9fs_flush(void *opaque)trace_v9fs_flush (pdu->tag, pdu->id, tag);if (pdu->tag == tag) { -error_report ("Warning: the guest sent a self-referencing 9P flush request" ); +warn_report ("the guest sent a self-referencing 9P flush request" ); }else { QLIST_FOREACH(cancel_pdu, &s->active_list, next) {if (cancel_pdu->tag == tag) {hw/arm/highbank.c +3
-3@@ -383,9 +383,9 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) highbank_binfo.write_board_setup = hb_write_board_setup; highbank_binfo.secure_board_setup = true; }else { -error_report ("WARNING: cannot load built-in Monitor support " -"if KVM is enabled. Some guests (such as Linux) " -"may not boot." ); +warn_report ("cannot load built-in Monitor support " +"if KVM is enabled. Some guests (such as Linux) " +"may not boot." ); }arm_load_kernel (ARM_CPU (first_cpu), &highbank_binfo);hw/arm/imx25_pdk.c +3
-3@@ -80,9 +80,9 @@ static void imx25_pdk_init(MachineState *machine)/* We need to initialize our memory */ if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE )) { -error_report ("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " -"reduced to %x" , machine->ram_size, -FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ); +warn_report ("RAM size " RAM_ADDR_FMT " above max supported, " +"reduced to %x" , machine->ram_size, +FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ); machine->ram_size =FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ; }hw/arm/kzm.c +3
-3@@ -79,9 +79,9 @@ static void kzm_init(MachineState *machine)/* Check the amount of memory is compatible with the SOC */ if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE )) { -error_report ("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " -"reduced to %x" , machine->ram_size, -FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ); +warn_report ("RAM size " RAM_ADDR_FMT " above max supported, " +"reduced to %x" , machine->ram_size, +FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ); machine->ram_size =FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ; }hw/core/machine.c +0
-0@@ -741,11 +741,11 @@ static void machine_numa_finish_init(MachineState *machine) } }if (s->len && !qtest_enabled ()) {
hw/core/machine.c static void machine_numa_finish_init(MachineState *machine) · line 748
Quoted 10 lines
hw/core/machine.c +5
-5-error_report ("warning: CPU(s) not present in any NUMA nodes: %s" , - s->str); -error_report ("warning: All CPU(s) up to maxcpus should be described " -"in NUMA config, ability to start up with partial NUMA " -"mappings is obsoleted and will be removed in future" ); +warn_report ("CPU(s) not present in any NUMA nodes: %s" , + s->str); +warn_report ("All CPU(s) up to maxcpus should be described " +"in NUMA config, ability to start up with partial NUMA " +"mappings is obsoleted and will be removed in future" );
Preexisting, not this patch's problem: the resulting output looks like two independent issues instead of one. Multiple error_report() / warn_report() in a row are almost always inappropriate.
warn_report("CPU(s) not present in any NUMA nodes: %s", s->str); error_printf("All CPU(s) up to maxcpus should be described "
"in NUMA config, ability to start up with partial NUMA " "mappings is obsoleted and will be removed in future");
More of the same below. Followup patches welcome.
Quoted 32 lines
hw/core/machine.c +0
-0}g_string_free (s, true); }hw/core/qdev-properties.c +4
-4@@ -1132,15 +1132,15 @@ int qdev_prop_check_globals(void) oc =object_class_by_name (prop->driver); oc =object_class_dynamic_cast (oc,TYPE_DEVICE );if (!oc) { -error_report ("Warning: global %s.%s has invalid class name" , - prop->driver, prop->property); +warn_report ("global %s.%s has invalid class name" , + prop->driver, prop->property); ret =1 ;continue ; } dc =DEVICE_CLASS (oc);if (!dc->hotpluggable && !prop->used) { -error_report ("Warning: global %s.%s=%s not used" , - prop->driver, prop->property, prop->value); +warn_report ("global %s.%s=%s not used" , + prop->driver, prop->property, prop->value); ret =1 ;continue ; }hw/i386/acpi-build.c +0
-0
hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2769
Quoted 5 lines
hw/i386/acpi-build.c +1
-1@@ -2766,17 +2766,17 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) ACPI_BUILD_ALIGN_SIZE);if (tables_blob->len > legacy_table_size) {/* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ -error_report ("Warning: migration may not work." ); +warn_report ("migration may not work." );
Could use a tree-wide sweep to drop periods from the end of error messages. I'm not asking you to do this now.
Quoted 50 lines
hw/i386/acpi-build.c +4
-4}g_array_set_size (tables_blob, legacy_table_size); }else {/* Make sure we have a buffer in case we need to resize the tables. */ if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) {/* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ -error_report ("Warning: ACPI tables are larger than 64k." ); -error_report ("Warning: migration may not work." ); -error_report ("Warning: please remove CPUs, NUMA nodes, " -"memory slots or PCI bridges." ); +warn_report ("ACPI tables are larger than 64k." ); +warn_report ("migration may not work." ); +warn_report ("please remove CPUs, NUMA nodes, " +"memory slots or PCI bridges." ); }acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); }hw/i386/kvm/pci-assign.c +3
-3@@ -1353,9 +1353,9 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp) PCI_CAP_ID_EXP);return -EINVAL ; }else if (size !=0x3c ) { -error_report ("WARNING, %s: PCIe cap-id 0x%x has " -"non-standard size 0x%x; std size should be 0x3c" , - __func__,PCI_CAP_ID_EXP , size); +warn_report ("%s: PCIe cap-id 0x%x has " +"non-standard size 0x%x; std size should be 0x3c" , + __func__,PCI_CAP_ID_EXP , size); } }else if (version ==0 ) {uint16_t vid, did;hw/i386/pc.c +2
-2@@ -381,8 +381,8 @@ ISADevice *pc_find_fdc0(void) }if (state.multiple) { -error_report ("warning: multiple floppy disk controllers with " -"iobase=0x3f0 have been found" ); +warn_report ("multiple floppy disk controllers with " +"iobase=0x3f0 have been found" );error_printf ("the one being picked for CMOS setup might not reflect " "your intent\n" ); }
hw/i386/pc.c static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, · line 2090
Quoted 7 lines
hw/i386/pc.c +1
-3@@ -2087,9 +2087,9 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, }if (value < (1ULL <<20 )) { -error_report ("Warning: small max_ram_below_4g(%" PRIu64 -") less than 1M. BIOS may not work.." , - value); + warn_report("small max_ram_below_4g(%"PRIu64
Let's insert a space between string literal and PRIu64 while there.
Quoted 29 lines
hw/i386/pc.c +2
-0+") less than 1M. BIOS may not work.." , + value); } pcms->max_ram_below_4g = value;hw/i386/pc_piix.c +4
-4@@ -131,10 +131,10 @@ static void pc_init1(MachineState *machine, lowmem =0xc0000000 ; }if (lowmem & ((1ULL <<30 ) -1 )) { -error_report ("Warning: Large machine and max_ram_below_4g " -"(%" PRIu64") not a multiple of 1G; " -"possible bad performance." , - pcms->max_ram_below_4g); +warn_report ("Large machine and max_ram_below_4g " +"(%" PRIu64") not a multiple of 1G; " +"possible bad performance." , + pcms->max_ram_below_4g); } } }hw/i386/pc_q35.c +0
-0
hw/i386/pc_q35.c static void pc_q35_init(MachineState *machine) · line 106
Quoted 9 lines
hw/i386/pc_q35.c +3
-3@@ -101,9 +101,9 @@ static void pc_q35_init(MachineState *machine) lowmem = pcms->max_ram_below_4g;if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL <<30 ) -1 )) { -error_report ("Warning: Large machine and max_ram_below_4g(%" PRIu64 -") not a multiple of 1G; possible bad performance." , - pcms->max_ram_below_4g); +warn_report ("Large machine and max_ram_below_4g(%" PRIu64 +") not a multiple of 1G; possible bad performance." , + pcms->max_ram_below_4g);
Let's insert a space between string literal and PRIu64 while there.
Quoted 8 lines
hw/i386/pc_q35.c +0
-0} }hw/misc/aspeed_sdmc.c +0
-0
hw/misc/aspeed_sdmc.c static int ast2400_rambits(AspeedSDMCState *s) · line 161
Quoted 7 lines
hw/misc/aspeed_sdmc.c +2
-2@@ -157,8 +157,8 @@ static int ast2400_rambits(AspeedSDMCState *s) }/* use a common default */ -error_report ("warning: Invalid RAM size 0x%" PRIx64 -". Using default 256M" , s->ram_size); +warn_report ("Invalid RAM size 0x%" PRIx64 +". Using default 256M" , s->ram_size);
warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 256M",
s->ram_size);hw/misc/aspeed_sdmc.c static int ast2500_rambits(AspeedSDMCState *s) · line 183
Quoted 11 lines
hw/misc/aspeed_sdmc.c +2
-2s->ram_size =256 <<20 ;return ASPEED_SDMC_DRAM_256MB ; }@@ -179,8 +179,8 @@ static int ast2500_rambits(AspeedSDMCState *s) }/* use a common default */ -error_report ("warning: Invalid RAM size 0x%" PRIx64 -". Using default 512M" , s->ram_size); +warn_report ("Invalid RAM size 0x%" PRIx64 +". Using default 512M" , s->ram_size);
warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 512M",
s->ram_size);Quoted 113 lines
hw/misc/aspeed_sdmc.c +0
-0s->ram_size =512 <<20 ;return ASPEED_SDMC_AST2500_512MB ; }hw/nvram/fw_cfg.c +1
-1@@ -781,7 +781,7 @@ static int get_fw_cfg_order(FWCfgState *s, const char *name) }/* Stick unknown stuff at the end. */ -error_report ("warning: Unknown firmware file in legacy mode: %s" , name); +warn_report ("Unknown firmware file in legacy mode: %s" , name);return FW_CFG_ORDER_OVERRIDE_LAST ; }hw/pci-host/piix.c +1
-1@@ -307,7 +307,7 @@ static void i440fx_realize(PCIDevice *dev, Error **errp) dev->config[I440FX_SMRAM ] =0x02 ;if (object_property_get_bool (qdev_get_machine (),"iommu" ,NULL )) { -error_report ("warning: i440fx doesn't support emulated iommu" ); +warn_report ("i440fx doesn't support emulated iommu" ); } }hw/ppc/pnv.c +3
-3@@ -160,13 +160,13 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)_FDT ((fdt_setprop_cell (fdt, offset,"d-cache-size" , pcc->l1_dcache_size))); }else { -error_report ("Warning: Unknown L1 dcache size for cpu" ); +warn_report ("Unknown L1 dcache size for cpu" ); }if (pcc->l1_icache_size) {_FDT ((fdt_setprop_cell (fdt, offset,"i-cache-size" , pcc->l1_icache_size))); }else { -error_report ("Warning: Unknown L1 icache size for cpu" ); +warn_report ("Unknown L1 icache size for cpu" ); }_FDT ((fdt_setprop_cell (fdt, offset,"timebase-frequency" , tbfreq)));@@ -556,7 +556,7 @@ static void ppc_powernv_init(MachineState *machine)/* allocate RAM */ if (machine->ram_size < (1 *G_BYTE )) { -error_report ("Warning: skiboot may not work with < 1GB of RAM" ); +warn_report ("skiboot may not work with < 1GB of RAM" ); } ram =g_new (MemoryRegion,1 );hw/ppc/spapr.c +2
-2@@ -534,13 +534,13 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,_FDT ((fdt_setprop_cell (fdt, offset,"d-cache-size" , pcc->l1_dcache_size))); }else { -error_report ("Warning: Unknown L1 dcache size for cpu" ); +warn_report ("Unknown L1 dcache size for cpu" ); }if (pcc->l1_icache_size) {_FDT ((fdt_setprop_cell (fdt, offset,"i-cache-size" , pcc->l1_icache_size))); }else { -error_report ("Warning: Unknown L1 icache size for cpu" ); +warn_report ("Unknown L1 icache size for cpu" ); }_FDT ((fdt_setprop_cell (fdt, offset,"timebase-frequency" , tbfreq)));hw/ppc/spapr_iommu.c +1
-1@@ -334,7 +334,7 @@ void spapr_tce_table_enable(sPAPRTCETable *tcet, uint32_t nb_table) {if (tcet->nb_table) { -error_report ("Warning: trying to enable already enabled TCE table" ); +warn_report ("trying to enable already enabled TCE table" );return ; }hw/scsi/scsi-bus.c +3
-3@@ -282,9 +282,9 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)continue ;/* claimed */ }if (!dinfo->is_default) { -error_report ("warning: bus=%d,unit=%d is deprecated with this" -" machine type" , - bus->busnr, unit); +warn_report ("bus=%d,unit=%d is deprecated with this" +" machine type" , + bus->busnr, unit); } } scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),hw/usb/dev-smartcard-reader.c +0
-0
hw/usb/dev-smartcard-reader.c static int ccid_card_init(DeviceState *qdev) · line 1318
Quoted 6 lines
hw/usb/dev-smartcard-reader.c +1
-1@@ -1314,12 +1314,12 @@ static int ccid_card_init(DeviceState *qdev)int ret =0 ;if (card->slot !=0 ) { -error_report ("Warning: usb-ccid supports one slot, can't add %d" , +warn_report ("usb-ccid supports one slot, can't add %d" , card->slot);
Let's fix indentation while there.
Quoted 39 lines
hw/usb/dev-smartcard-reader.c +1
-1return -1 ; }if (s->card !=NULL ) { -error_report ("Warning: usb-ccid card already full, not adding" ); +warn_report ("usb-ccid card already full, not adding" );return -1 ; } ret =ccid_card_initfn (card);hw/usb/redirect.c +1
-1@@ -193,7 +193,7 @@ static void usbredir_handle_status(USBRedirDevice *dev, USBPacket *p,#define WARNING (...) \ do { \ if (dev->debug >= usbredirparser_warning) { \ - error_report("usb-redir warning: " __VA_ARGS__); \ + warn_report("" __VA_ARGS__); \ } \ } while (0)#define INFO (...) \net/tap-linux.c +1
-1@@ -55,7 +55,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, ifr.ifr_flags =IFF_TAP |IFF_NO_PI ;if (ioctl (fd,TUNGETFEATURES , &features) ==-1 ) { -error_report ("warning: TUNGETFEATURES failed: %s" ,strerror (errno)); +warn_report ("TUNGETFEATURES failed: %s" ,strerror (errno)); features =0 ; }target/i386/cpu.c +0
-0
target/i386/cpu.c static void x86_cpu_parse_featurestr(const char *typename, char *features, · line 2065
Quoted 7 lines
target/i386/cpu.c +1
-1@@ -2060,13 +2060,13 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, name = featurestr;if (g_list_find_custom (plus_features, name, compare_string)) { -error_report ("warning: Ambiguous CPU model string. " +warn_report ("Ambiguous CPU model string. " "Don't mix both \"+%s\" and \"%s=%s\"" , name, name, val);
Indentation's off.
target/i386/cpu.c static void x86_cpu_parse_featurestr(const char *typename, char *features, · line 2071
Quoted 7 lines
target/i386/cpu.c +1
-1ambiguous = true; }if (g_list_find_custom (minus_features, name, compare_string)) { -error_report ("warning: Ambiguous CPU model string. " +warn_report ("Ambiguous CPU model string. " "Don't mix both \"-%s\" and \"%s=%s\"" , name, name, val);
Likewise.
target/i386/cpu.c static void x86_cpu_parse_featurestr(const char *typename, char *features, · line 2100
Quoted 8 lines
target/i386/cpu.c +1
-1ambiguous = true;@@ -2096,7 +2096,7 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, }if (ambiguous) { -error_report ("warning: Compatibility of ambiguous CPU model " +warn_report ("Compatibility of ambiguous CPU model " "strings won't be kept on future QEMU versions" );
Likewise.
target/i386/cpu.c static void x86_cpu_realizefn(DeviceState *dev, Error **errp) · line 3552
Quoted 10 lines
target/i386/cpu.c +1
-1} }@@ -3547,7 +3547,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)*/ if (cpu->phys_bits != host_phys_bits && cpu->phys_bits !=0 && !warned) { -error_report ("Warning: Host physical bits (%u)" +warn_report ("Host physical bits (%u)" " does not match phys-bits property (%u)" , host_phys_bits, cpu->phys_bits);
Let's fix indentation while there.
Quoted 6 lines
target/i386/cpu.c +0
-0warned = true;target/i386/kvm.c +0
-0
target/i386/kvm.c static int kvm_arch_set_tsc_khz(CPUState *cs) · line 606
Quoted 8 lines
target/i386/kvm.c +1
-1@@ -600,7 +600,7 @@ static int kvm_arch_set_tsc_khz(CPUState *cs) kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ) : -ENOTSUP ;if (cur_freq <=0 || cur_freq != env->tsc_khz) { -error_report ("warning: TSC frequency mismatch between " +warn_report ("TSC frequency mismatch between " "VM (%" PRId64" kHz) and host (%d kHz), " "and TSC scaling unavailable" , env->tsc_khz, cur_freq);
Indentation's off.
target/i386/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 923
Quoted 7 lines
target/i386/kvm.c +1
-1@@ -919,7 +919,7 @@ int kvm_arch_init_vcpu(CPUState *cs)error_report ("kvm: LMCE not supported" );return -ENOTSUP ; } -error_report ("warning: Unsupported MCG_CAP bits: 0x%" PRIx64, +warn_report ("Unsupported MCG_CAP bits: 0x%" PRIx64, unsupported_caps);
Likewise.
Quoted 7 lines
target/i386/kvm.c +0
-0}target/s390x/cpu_models.c +0
-0
target/s390x/cpu_models.c static void check_consistency(const S390CPUModel *model) · line 682
Quoted 7 lines
target/s390x/cpu_models.c +1
-1@@ -677,7 +677,7 @@ static void check_consistency(const S390CPUModel *model)for (i =0 ; i <ARRAY_SIZE (dep); i++) {if (test_bit (dep[i][0 ], model->features) && !test_bit (dep[i][1 ], model->features)) { -error_report ("Warning: \'%s\' requires \'%s\'." , +warn_report ("\'%s\' requires \'%s\'." ,s390_feat_def (dep[i][0 ])->name,s390_feat_def (dep[i][1 ])->name);
Likewise.
target/s390x/kvm.c void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) · line 2679
Quoted 12 lines
target/s390x/cpu_models.c +0
-0}target/s390x/kvm.c +1
-1@@ -2675,7 +2675,7 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)/* enable CMM via CMMA - disable on hugetlbfs */ if (test_bit (S390_FEAT_CMM , model->features)) {if (mem_path) { -error_report ("Warning: CMM will not be enabled because it is not " +warn_report ("CMM will not be enabled because it is not " "compatible to hugetlbfs." );
Likewise.
Quoted 25 lines
target/s390x/kvm.c +0
-0}else {kvm_s390_enable_cmma ();tests/test-qdev-global-props.c +3
-3@@ -232,10 +232,10 @@ static void test_dynamic_globalprop(void)g_test_trap_assert_passed ();g_test_trap_assert_stderr_unmatched ("*prop1*" );g_test_trap_assert_stderr_unmatched ("*prop2*" ); -g_test_trap_assert_stderr ("*Warning: global dynamic-prop-type-bad.prop3 has invalid class name\n*" ); +g_test_trap_assert_stderr ("*warning: global dynamic-prop-type-bad.prop3 has invalid class name\n*" );g_test_trap_assert_stderr_unmatched ("*prop4*" ); -g_test_trap_assert_stderr ("*Warning: global nohotplug-type.prop5=105 not used\n*" ); -g_test_trap_assert_stderr ("*Warning: global nondevice-type.prop6 has invalid class name\n*" ); +g_test_trap_assert_stderr ("*warning: global nohotplug-type.prop5=105 not used\n*" ); +g_test_trap_assert_stderr ("*warning: global nondevice-type.prop6 has invalid class name\n*" );g_test_trap_assert_stdout ("" ); }trace/control.c +0
-0
trace/control.c static void do_trace_enable_events(const char *line_buf) · line 175
Quoted 6 lines
trace/control.c +1
-1@@ -171,7 +171,7 @@ static void do_trace_enable_events(const char *line_buf)while ((ev =trace_event_iter_next (&iter)) !=NULL ) {if (!trace_event_get_state_static (ev)) {if (!is_pattern) { -error_report ("WARNING: trace event '%s' is not traceable" , +warn_report ("trace event '%s' is not traceable" , line_ptr);
Likewise.
trace/control.c static void do_trace_enable_events(const char *line_buf) · line 190
Quoted 9 lines
trace/control.c +1
-1return ; }@@ -186,7 +186,7 @@ static void do_trace_enable_events(const char *line_buf) }if (!is_pattern) { -error_report ("WARNING: trace event '%s' does not exist" , +warn_report ("trace event '%s' does not exist" , line_ptr);
Likewise.
Quoted 60 lines
trace/control.c +0
-0} }vl.c +9
-9@@ -952,8 +952,8 @@ static void bt_vhci_add(int vlan_id)struct bt_scatternet_s *vlan =qemu_find_bt_vlan (vlan_id);if (!vlan->slave) -error_report ("warning: adding a VHCI to an empty scatternet %i" , - vlan_id); +warn_report ("adding a VHCI to an empty scatternet %i" , + vlan_id);bt_vhci_init (bt_new_hci (vlan)); }@@ -979,8 +979,8 @@ static struct bt_device_s *bt_device_add(const char *opt) vlan =qemu_find_bt_vlan (vlan_id);if (!vlan->slave) -error_report ("warning: adding a slave device to an empty scatternet %i" , - vlan_id); +warn_report ("adding a slave device to an empty scatternet %i" , + vlan_id);if (!strcmp (devname,"keyboard" ))return bt_keyboard_init (vlan);@@ -2302,8 +2302,8 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)return -1 ; }if (strncmp (name,"opt/" ,4 ) !=0 ) { -error_report ("warning: externally provided fw_cfg item names " -"should be prefixed with \"opt/\"" ); +warn_report ("externally provided fw_cfg item names " +"should be prefixed with \"opt/\"" ); }if (nonempty_str (str)) { size =strlen (str);/* NUL terminator NOT included in fw_cfg blob */ @@ -3760,7 +3760,7 @@ int main(int argc, char **argv, char **envp)qemu_opts_parse_noisily (olist,"accel=tcg" , false);break ;case QEMU_OPTION_no_kvm_pit: { -error_report ("warning: ignoring deprecated option" ); +warn_report ("ignoring deprecated option" );break ; }case QEMU_OPTION_no_kvm_pit_reinjection: {@@ -3770,8 +3770,8 @@ int main(int argc, char **argv, char **envp) .value = "discard", }; -error_report ("warning: deprecated, replaced by " -"-global kvm-pit.lost_tick_policy=discard" ); +warn_report ("deprecated, replaced by " +"-global kvm-pit.lost_tick_policy=discard" );qdev_prop_register_global (&kvm_pit_lost_tick_policy);break ; }
vl.c int main(int argc, char **argv, char **envp) · line 3902
Quoted 8 lines
vl.c +1
-1@@ -3896,7 +3896,7 @@ int main(int argc, char **argv, char **envp) }break ;case QEMU_OPTION_tdf: -error_report ("warning: ignoring deprecated option" ); +warn_report ("ignoring deprecated option" );break ;case QEMU_OPTION_name: opts = qemu_opts_parse_noisily(qemu_find_opts("name"),
Nothing remotely serious here, but too many little touch-ups for me to volunteer doing them on commit, sorry.
Re: [Qemu-devel] [PATCH v3 3/8] Convert error_report() to warn_report()
Quoted 146 lines · Markus Armbruster
Quoted 5 lines · Alistair Francis
Convert all uses of error_report("warning:"... to use
warn_report()instead. This helps standardise on a single method of printing warnings to the user.All of the warnings where changed using these two commands:
s/where/were/
Quoted 111 lines
find ./* -type f -exec sed -i \ 's|error_report(".*warning[,:] |warn_report("|Ig' {} +Then the white space changes where manually fixed afterwards.
The test-qdev-global-props test case was manually updated to ensure that this patch passes make check (as the test cases are case sensitive).
Signed-off-by Alistair Francis <[email protected]>Suggested-by Thomas Huth <[email protected]>Cc Jeff Cody <[email protected]>Cc Kevin Wolf <[email protected]>Cc Max Reitz <[email protected]>Cc Ronnie Sahlberg <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Peter Lieven <[email protected]>Cc Josh Durgin <[email protected]>Cc "Richard W.M. Jones" <[email protected]>Cc Markus Armbruster <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Richard Henderson <[email protected]>Cc "Aneesh Kumar K.V" <[email protected]>Cc Greg Kurz <[email protected]>Cc Rob Herring <[email protected]>Cc Peter Maydell <[email protected]>Cc Peter Chubb <[email protected]>Cc Eduardo Habkost <[email protected]>Cc Marcel Apfelbaum <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Cc David Gibson <[email protected]>Cc Alexander Graf <[email protected]>Cc Gerd Hoffmann <[email protected]>Cc Jason Wang <[email protected]>Cc Marcelo Tosatti <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Cornelia Huck <[email protected]>Cc Stefan Hajnoczi <[email protected]>Acked-by David Gibson <[email protected]>Acked-by Greg Kurz <[email protected]>Acked-by Cornelia Huck <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>Reviewed by: Peter Chubb <[email protected]>
Acked-by Max Reitz <[email protected]>Acked-by Marcel Apfelbaum <[email protected]>---
V3:
- Regenerate patch to ensure no manual edits where made
- Tighten regex matches
V2:
- Fix quotation issues
- Update commit message
- Include full commandJust a note:
We will need to do a similar thing for fprintf. There are patches on the list at the moment that conflict with this series (by addingerror_report()calls that shsould be warning), so I think I'm giong to have to do a follow up series converting more cases. I'll cover the fprintf cases when I do that. There are some manual cases as well that don't say warning or info, but really should. They will have to be converted as well.block/backup.c | 10 +++++----- block/gluster.c | 4 ++-- block/iscsi.c | 6 +++--- block/nfs.c | 12 ++++++------ block/rbd.c | 6 +++--- block/ssh.c | 4 ++-- blockdev.c | 2 +- cpus.c | 2 +- hw/9pfs/9p.c | 2 +- hw/arm/highbank.c | 6 +++--- hw/arm/imx25_pdk.c | 6 +++--- hw/arm/kzm.c | 6 +++--- hw/core/machine.c | 10 +++++----- hw/core/qdev-properties.c | 8 ++++---- hw/i386/acpi-build.c | 10 +++++----- hw/i386/kvm/pci-assign.c | 6 +++--- hw/i386/pc.c | 10 +++++----- hw/i386/pc_piix.c | 8 ++++---- hw/i386/pc_q35.c | 6 +++--- hw/misc/aspeed_sdmc.c | 8 ++++---- hw/nvram/fw_cfg.c | 2 +- hw/pci-host/piix.c | 2 +- hw/ppc/pnv.c | 6 +++--- hw/ppc/spapr.c | 4 ++-- hw/ppc/spapr_iommu.c | 2 +- hw/scsi/scsi-bus.c | 6 +++--- hw/usb/dev-smartcard-reader.c | 4 ++-- hw/usb/redirect.c | 2 +- net/tap-linux.c | 2 +- target/i386/cpu.c | 8 ++++---- target/i386/kvm.c | 4 ++-- target/s390x/cpu_models.c | 2 +- target/s390x/kvm.c | 2 +- tests/test-qdev-global-props.c | 6 +++--- trace/control.c | 4 ++-- vl.c | 20 ++++++++++---------- 36 files changed, 104 insertions(+), 104 deletions(-)block/backup.c +0
-1@@ -639,11 +639,11 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, ret =bdrv_get_info (target, &bdi);if (ret == -ENOTSUP && !target->backing) {/* Cluster size is not defined */ - error_report("WARNING: The target block device doesn't provide "block/backup.c BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, · line 647
Quoted 10 lines
block/backup.c +5
-4-"information about the block size and it doesn't have a " -"backing file. The default block size of %u bytes is " -"used. If the actual block size of the target exceeds " -"this default, the backup may be unusable" , +warn_report ("The target block device doesn't provide " +"information about the block size and it doesn't have a " +"backing file. The default block size of %u bytes is " +"used. If the actual block size of the target exceeds " +"this default, the backup may be unusable" ,BACKUP_CLUSTER_SIZE_DEFAULT );As Max noted, indentation's off here.
Preexisting, not this patch's problem: an error or warning message should be a (short!) phrase, not a novel. If additional explanations are needed, they go on separate lines, like this:
warn_report("The target block device doesn't provide "
"information about the block size and it doesn't have a " "backing file");
error_printf("The default block size of %u bytes is used."
" If the actual block size of the target exceeds " "this default, the backup may be unusable.",BACKUP_CLUSTER_SIZE_DEFAULT);
Quoted 4 lines
Note that the warning message is a *phrase*, not a sentence, let alone three, and its followed by additional hints, which *are* sentences.
More of the same below. Followup patches welcome.
Yeah, there are still some things that need to be fixed. I'll keep this in mind for the next series.
Quoted 390 lines
Quoted 8 lines
block/backup.c +0
-0job->cluster_size =BACKUP_CLUSTER_SIZE_DEFAULT ; }else if (ret <0 && !target->backing) {block/gluster.c +0
-0block/gluster.c static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, · line 349
Quoted 7 lines
block/gluster.c +2
-2@@ -345,8 +345,8 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, is_unix = true; }else if (!strcmp (uri->scheme,"gluster+rdma" )) { gsconf->type =SOCKET_ADDRESS_TYPE_INET ; -error_report ("Warning: rdma feature is not supported, falling " -"back to tcp" ); +warn_report ("rdma feature is not supported, falling " +"back to tcp" );Further cleanup:
warn_report("rdma feature is not supported, falling back to tcp");Could be done as a separate patch to keep this one as mechanical as possible, but I think squashing it in would be okay, too. If we do, then the commit message needs to updated. I think
Indentation fixed up manually afterwards.
instead of
Then the white space changes where manually fixed afterwards.
should do.
Quoted 25 lines
block/gluster.c +0
-0}else { ret = -EINVAL ; goto out;block/iscsi.c +3
-3@@ -1761,9 +1761,9 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,* filename encoded options */ filename =qdict_get_try_str (options,"filename" );if (filename) { -error_report ("Warning: 'filename' option specified. " -"This is an unsupported option, and may be deprecated " -"in the future" ); +warn_report ("'filename' option specified. " +"This is an unsupported option, and may be deprecated " +"in the future" );iscsi_parse_filename (filename, options, &local_err);if (local_err) { ret = -EINVAL ;block/nfs.c +0
-0block/nfs.c static int64_t nfs_client_open(NFSClient *client, QDict *options, · line 562
Quoted 7 lines
block/nfs.c +2
-2@@ -558,8 +558,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options, } client->readahead =qemu_opt_get_number (opts,"readahead-size" ,0 );if (client->readahead >QEMU_NFS_MAX_READAHEAD_SIZE ) { -error_report ("NFS Warning: Truncating NFS readahead " -"size to %d" ,QEMU_NFS_MAX_READAHEAD_SIZE ); +warn_report ("Truncating NFS readahead " +"size to %d" ,QEMU_NFS_MAX_READAHEAD_SIZE );Similarly:
warn_report("Truncating NFS readahead size to %d",
QEMU_NFS_MAX_READAHEAD_SIZE);block/nfs.c static int64_t nfs_client_open(NFSClient *client, QDict *options, · line 583
Quoted 11 lines
block/nfs.c +2
-2client->readahead =QEMU_NFS_MAX_READAHEAD_SIZE ; }nfs_set_readahead (client->context, client->readahead);@@ -579,8 +579,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options, } client->pagecache =qemu_opt_get_number (opts,"page-cache-size" ,0 );if (client->pagecache >QEMU_NFS_MAX_PAGECACHE_SIZE ) { -error_report ("NFS Warning: Truncating NFS pagecache " -"size to %d pages" ,QEMU_NFS_MAX_PAGECACHE_SIZE ); +warn_report ("Truncating NFS pagecache " +"size to %d pages" ,QEMU_NFS_MAX_PAGECACHE_SIZE );Similarly:
warn_report("Truncating NFS pagecache size to %d pages",
QEMU_NFS_MAX_PAGECACHE_SIZE);block/nfs.c static int64_t nfs_client_open(NFSClient *client, QDict *options, · line 599
Quoted 11 lines
block/nfs.c +2
-2client->pagecache =QEMU_NFS_MAX_PAGECACHE_SIZE ; }nfs_set_pagecache (client->context, client->pagecache);@@ -595,8 +595,8 @@ static int64_t nfs_client_open(NFSClient *client, QDict *options,/* limit the maximum debug level to avoid potential flooding * of our log files. */ if (client->debug >QEMU_NFS_MAX_DEBUG_LEVEL ) { -error_report ("NFS Warning: Limiting NFS debug level " -"to %d" ,QEMU_NFS_MAX_DEBUG_LEVEL ); +warn_report ("Limiting NFS debug level " +"to %d" ,QEMU_NFS_MAX_DEBUG_LEVEL );warn_report("Limiting NFS debug level to %d",
QEMU_NFS_MAX_DEBUG_LEVEL);Quoted 133 lines
block/nfs.c +0
-0client->debug =QEMU_NFS_MAX_DEBUG_LEVEL ; }nfs_set_debug (client->context, client->debug);block/rbd.c +3
-3@@ -555,9 +555,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,* filename encoded options */ filename =qdict_get_try_str (options,"filename" );if (filename) { -error_report ("Warning: 'filename' option specified. " -"This is an unsupported option, and may be deprecated " -"in the future" ); +warn_report ("'filename' option specified. " +"This is an unsupported option, and may be deprecated " +"in the future" );qemu_rbd_parse_filename (filename, options, &local_err);if (local_err) { r = -EINVAL ;block/ssh.c +2
-2@@ -1114,8 +1114,8 @@ static coroutine_fn int ssh_co_writev(BlockDriverState *bs,static void unsafe_flush_warning (BDRVSSHState *s,const char *what) {if (!s->unsafe_flush_warning) { -error_report ("warning: ssh server %s does not support fsync" , - s->inet->host); +warn_report ("ssh server %s does not support fsync" , + s->inet->host);if (what) {error_report ("to support fsync, you need %s" , what); }blockdev.c +1
-1@@ -914,7 +914,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) copy_on_read =qemu_opt_get_bool (legacy_opts,"copy-on-read" , false);if (read_only && copy_on_read) { -error_report ("warning: disabling copy-on-read on read-only drive" ); +warn_report ("disabling copy-on-read on read-only drive" ); copy_on_read = false; }cpus.c +1
-1@@ -557,7 +557,7 @@ void qemu_start_warp_timer(void)if (deadline <0 ) {static bool notified;if (!icount_sleep && !notified) { -error_report ("WARNING: icount sleep disabled and no active timers" ); +warn_report ("icount sleep disabled and no active timers" ); notified = true; }return ;hw/9pfs/9p.c +1
-1@@ -2376,7 +2376,7 @@ static void coroutine_fn v9fs_flush(void *opaque)trace_v9fs_flush (pdu->tag, pdu->id, tag);if (pdu->tag == tag) { -error_report ("Warning: the guest sent a self-referencing 9P flush request" ); +warn_report ("the guest sent a self-referencing 9P flush request" ); }else { QLIST_FOREACH(cancel_pdu, &s->active_list, next) {if (cancel_pdu->tag == tag) {hw/arm/highbank.c +3
-3@@ -383,9 +383,9 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) highbank_binfo.write_board_setup = hb_write_board_setup; highbank_binfo.secure_board_setup = true; }else { -error_report ("WARNING: cannot load built-in Monitor support " -"if KVM is enabled. Some guests (such as Linux) " -"may not boot." ); +warn_report ("cannot load built-in Monitor support " +"if KVM is enabled. Some guests (such as Linux) " +"may not boot." ); }arm_load_kernel (ARM_CPU (first_cpu), &highbank_binfo);hw/arm/imx25_pdk.c +3
-3@@ -80,9 +80,9 @@ static void imx25_pdk_init(MachineState *machine)/* We need to initialize our memory */ if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE )) { -error_report ("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " -"reduced to %x" , machine->ram_size, -FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ); +warn_report ("RAM size " RAM_ADDR_FMT " above max supported, " +"reduced to %x" , machine->ram_size, +FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ); machine->ram_size =FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ; }hw/arm/kzm.c +3
-3@@ -79,9 +79,9 @@ static void kzm_init(MachineState *machine)/* Check the amount of memory is compatible with the SOC */ if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE )) { -error_report ("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " -"reduced to %x" , machine->ram_size, -FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ); +warn_report ("RAM size " RAM_ADDR_FMT " above max supported, " +"reduced to %x" , machine->ram_size, +FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ); machine->ram_size =FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ; }hw/core/machine.c +0
-0@@ -741,11 +741,11 @@ static void machine_numa_finish_init(MachineState *machine) } }if (s->len && !qtest_enabled ()) {hw/core/machine.c static void machine_numa_finish_init(MachineState *machine) · line 748
Quoted 10 lines
hw/core/machine.c +5
-5-error_report ("warning: CPU(s) not present in any NUMA nodes: %s" , - s->str); -error_report ("warning: All CPU(s) up to maxcpus should be described " -"in NUMA config, ability to start up with partial NUMA " -"mappings is obsoleted and will be removed in future" ); +warn_report ("CPU(s) not present in any NUMA nodes: %s" , + s->str); +warn_report ("All CPU(s) up to maxcpus should be described " +"in NUMA config, ability to start up with partial NUMA " +"mappings is obsoleted and will be removed in future" );Preexisting, not this patch's problem: the resulting output looks like two independent issues instead of one. Multiple
error_report()/warn_report()in a row are almost always inappropriate.
warn_report("CPU(s) not present in any NUMA nodes: %s", s->str); error_printf("All CPU(s) up to maxcpus should be described "
"in NUMA config, ability to start up with partial NUMA " "mappings is obsoleted and will be removed in future");More of the same below. Followup patches welcome.
Quoted 32 lines
hw/core/machine.c +0
-0}g_string_free (s, true); }hw/core/qdev-properties.c +4
-4@@ -1132,15 +1132,15 @@ int qdev_prop_check_globals(void) oc =object_class_by_name (prop->driver); oc =object_class_dynamic_cast (oc,TYPE_DEVICE );if (!oc) { -error_report ("Warning: global %s.%s has invalid class name" , - prop->driver, prop->property); +warn_report ("global %s.%s has invalid class name" , + prop->driver, prop->property); ret =1 ;continue ; } dc =DEVICE_CLASS (oc);if (!dc->hotpluggable && !prop->used) { -error_report ("Warning: global %s.%s=%s not used" , - prop->driver, prop->property, prop->value); +warn_report ("global %s.%s=%s not used" , + prop->driver, prop->property, prop->value); ret =1 ;continue ; }hw/i386/acpi-build.c +0
-0hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2769
Quoted 5 lines
hw/i386/acpi-build.c +1
-1@@ -2766,17 +2766,17 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) ACPI_BUILD_ALIGN_SIZE);if (tables_blob->len > legacy_table_size) {/* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ -error_report ("Warning: migration may not work." ); +warn_report ("migration may not work." );Could use a tree-wide sweep to drop periods from the end of error messages. I'm not asking you to do this now.
Quoted 50 lines
hw/i386/acpi-build.c +4
-4}g_array_set_size (tables_blob, legacy_table_size); }else {/* Make sure we have a buffer in case we need to resize the tables. */ if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) {/* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ -error_report ("Warning: ACPI tables are larger than 64k." ); -error_report ("Warning: migration may not work." ); -error_report ("Warning: please remove CPUs, NUMA nodes, " -"memory slots or PCI bridges." ); +warn_report ("ACPI tables are larger than 64k." ); +warn_report ("migration may not work." ); +warn_report ("please remove CPUs, NUMA nodes, " +"memory slots or PCI bridges." ); }acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); }hw/i386/kvm/pci-assign.c +3
-3@@ -1353,9 +1353,9 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp) PCI_CAP_ID_EXP);return -EINVAL ; }else if (size !=0x3c ) { -error_report ("WARNING, %s: PCIe cap-id 0x%x has " -"non-standard size 0x%x; std size should be 0x3c" , - __func__,PCI_CAP_ID_EXP , size); +warn_report ("%s: PCIe cap-id 0x%x has " +"non-standard size 0x%x; std size should be 0x3c" , + __func__,PCI_CAP_ID_EXP , size); } }else if (version ==0 ) {uint16_t vid, did;hw/i386/pc.c +2
-2@@ -381,8 +381,8 @@ ISADevice *pc_find_fdc0(void) }if (state.multiple) { -error_report ("warning: multiple floppy disk controllers with " -"iobase=0x3f0 have been found" ); +warn_report ("multiple floppy disk controllers with " +"iobase=0x3f0 have been found" );error_printf ("the one being picked for CMOS setup might not reflect " "your intent\n" ); }hw/i386/pc.c static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, · line 2090
Quoted 7 lines
hw/i386/pc.c +1
-3@@ -2087,9 +2087,9 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, }if (value < (1ULL <<20 )) { -error_report ("Warning: small max_ram_below_4g(%" PRIu64 -") less than 1M. BIOS may not work.." , - value); + warn_report("small max_ram_below_4g(%"PRIu64Let's insert a space between string literal and PRIu64 while there.
Quoted 32 lines
hw/i386/pc.c +2
-0+") less than 1M. BIOS may not work.." , + value); } pcms->max_ram_below_4g = value;hw/i386/pc_piix.c +4
-4@@ -131,10 +131,10 @@ static void pc_init1(MachineState *machine, lowmem =0xc0000000 ; }if (lowmem & ((1ULL <<30 ) -1 )) { -error_report ("Warning: Large machine and max_ram_below_4g " -"(%" PRIu64") not a multiple of 1G; " -"possible bad performance." , - pcms->max_ram_below_4g); +warn_report ("Large machine and max_ram_below_4g " +"(%" PRIu64") not a multiple of 1G; " +"possible bad performance." , + pcms->max_ram_below_4g); } } }hw/i386/pc_q35.c +0
-0@@ -101,9 +101,9 @@ static void pc_q35_init(MachineState *machine) lowmem = pcms->max_ram_below_4g;if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL <<30 ) -1 )) {
Quoted 8 lines
hw/i386/pc_q35.c static void pc_q35_init(MachineState *machine) · line 106
Quoted 6 lines
hw/i386/pc_q35.c +3
-3-error_report ("Warning: Large machine and max_ram_below_4g(%" PRIu64 -") not a multiple of 1G; possible bad performance." , - pcms->max_ram_below_4g); +warn_report ("Large machine and max_ram_below_4g(%" PRIu64 +") not a multiple of 1G; possible bad performance." , + pcms->max_ram_below_4g);Let's insert a space between string literal and PRIu64 while there.
These ones are fixed in next patch, so I'm just going to leave them as is in this patch.
Quoted 408 lines
Quoted 9 lines
hw/i386/pc_q35.c +0
-0} }hw/misc/aspeed_sdmc.c +0
-0hw/misc/aspeed_sdmc.c static int ast2400_rambits(AspeedSDMCState *s) · line 161
Quoted 7 lines
hw/misc/aspeed_sdmc.c +2
-2@@ -157,8 +157,8 @@ static int ast2400_rambits(AspeedSDMCState *s) }/* use a common default */ -error_report ("warning: Invalid RAM size 0x%" PRIx64 -". Using default 256M" , s->ram_size); +warn_report ("Invalid RAM size 0x%" PRIx64 +". Using default 256M" , s->ram_size);warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 256M", s->ram_size);hw/misc/aspeed_sdmc.c static int ast2500_rambits(AspeedSDMCState *s) · line 183
Quoted 11 lines
hw/misc/aspeed_sdmc.c +2
-2s->ram_size =256 <<20 ;return ASPEED_SDMC_DRAM_256MB ; }@@ -179,8 +179,8 @@ static int ast2500_rambits(AspeedSDMCState *s) }/* use a common default */ -error_report ("warning: Invalid RAM size 0x%" PRIx64 -". Using default 512M" , s->ram_size); +warn_report ("Invalid RAM size 0x%" PRIx64 +". Using default 512M" , s->ram_size);warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 512M", s->ram_size);Quoted 113 lines
hw/misc/aspeed_sdmc.c +0
-0s->ram_size =512 <<20 ;return ASPEED_SDMC_AST2500_512MB ; }hw/nvram/fw_cfg.c +1
-1@@ -781,7 +781,7 @@ static int get_fw_cfg_order(FWCfgState *s, const char *name) }/* Stick unknown stuff at the end. */ -error_report ("warning: Unknown firmware file in legacy mode: %s" , name); +warn_report ("Unknown firmware file in legacy mode: %s" , name);return FW_CFG_ORDER_OVERRIDE_LAST ; }hw/pci-host/piix.c +1
-1@@ -307,7 +307,7 @@ static void i440fx_realize(PCIDevice *dev, Error **errp) dev->config[I440FX_SMRAM ] =0x02 ;if (object_property_get_bool (qdev_get_machine (),"iommu" ,NULL )) { -error_report ("warning: i440fx doesn't support emulated iommu" ); +warn_report ("i440fx doesn't support emulated iommu" ); } }hw/ppc/pnv.c +3
-3@@ -160,13 +160,13 @@ static void powernv_create_core_node(PnvChip *chip, PnvCore *pc, void *fdt)_FDT ((fdt_setprop_cell (fdt, offset,"d-cache-size" , pcc->l1_dcache_size))); }else { -error_report ("Warning: Unknown L1 dcache size for cpu" ); +warn_report ("Unknown L1 dcache size for cpu" ); }if (pcc->l1_icache_size) {_FDT ((fdt_setprop_cell (fdt, offset,"i-cache-size" , pcc->l1_icache_size))); }else { -error_report ("Warning: Unknown L1 icache size for cpu" ); +warn_report ("Unknown L1 icache size for cpu" ); }_FDT ((fdt_setprop_cell (fdt, offset,"timebase-frequency" , tbfreq)));@@ -556,7 +556,7 @@ static void ppc_powernv_init(MachineState *machine)/* allocate RAM */ if (machine->ram_size < (1 *G_BYTE )) { -error_report ("Warning: skiboot may not work with < 1GB of RAM" ); +warn_report ("skiboot may not work with < 1GB of RAM" ); } ram =g_new (MemoryRegion,1 );hw/ppc/spapr.c +2
-2@@ -534,13 +534,13 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,_FDT ((fdt_setprop_cell (fdt, offset,"d-cache-size" , pcc->l1_dcache_size))); }else { -error_report ("Warning: Unknown L1 dcache size for cpu" ); +warn_report ("Unknown L1 dcache size for cpu" ); }if (pcc->l1_icache_size) {_FDT ((fdt_setprop_cell (fdt, offset,"i-cache-size" , pcc->l1_icache_size))); }else { -error_report ("Warning: Unknown L1 icache size for cpu" ); +warn_report ("Unknown L1 icache size for cpu" ); }_FDT ((fdt_setprop_cell (fdt, offset,"timebase-frequency" , tbfreq)));hw/ppc/spapr_iommu.c +1
-1@@ -334,7 +334,7 @@ void spapr_tce_table_enable(sPAPRTCETable *tcet, uint32_t nb_table) {if (tcet->nb_table) { -error_report ("Warning: trying to enable already enabled TCE table" ); +warn_report ("trying to enable already enabled TCE table" );return ; }hw/scsi/scsi-bus.c +3
-3@@ -282,9 +282,9 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)continue ;/* claimed */ }if (!dinfo->is_default) { -error_report ("warning: bus=%d,unit=%d is deprecated with this" -" machine type" , - bus->busnr, unit); +warn_report ("bus=%d,unit=%d is deprecated with this" +" machine type" , + bus->busnr, unit); } } scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),hw/usb/dev-smartcard-reader.c +0
-0hw/usb/dev-smartcard-reader.c static int ccid_card_init(DeviceState *qdev) · line 1318
Quoted 6 lines
hw/usb/dev-smartcard-reader.c +1
-1@@ -1314,12 +1314,12 @@ static int ccid_card_init(DeviceState *qdev)int ret =0 ;if (card->slot !=0 ) { -error_report ("Warning: usb-ccid supports one slot, can't add %d" , +warn_report ("usb-ccid supports one slot, can't add %d" , card->slot);Let's fix indentation while there.
Quoted 39 lines
hw/usb/dev-smartcard-reader.c +1
-1return -1 ; }if (s->card !=NULL ) { -error_report ("Warning: usb-ccid card already full, not adding" ); +warn_report ("usb-ccid card already full, not adding" );return -1 ; } ret =ccid_card_initfn (card);hw/usb/redirect.c +1
-1@@ -193,7 +193,7 @@ static void usbredir_handle_status(USBRedirDevice *dev, USBPacket *p,#define WARNING (...) \ do { \ if (dev->debug >= usbredirparser_warning) { \ - error_report("usb-redir warning: " __VA_ARGS__); \ + warn_report("" __VA_ARGS__); \ } \ } while (0)#define INFO (...) \net/tap-linux.c +1
-1@@ -55,7 +55,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, ifr.ifr_flags =IFF_TAP |IFF_NO_PI ;if (ioctl (fd,TUNGETFEATURES , &features) ==-1 ) { -error_report ("warning: TUNGETFEATURES failed: %s" ,strerror (errno)); +warn_report ("TUNGETFEATURES failed: %s" ,strerror (errno)); features =0 ; }target/i386/cpu.c +0
-0target/i386/cpu.c static void x86_cpu_parse_featurestr(const char *typename, char *features, · line 2065
Quoted 7 lines
target/i386/cpu.c +1
-1@@ -2060,13 +2060,13 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, name = featurestr;if (g_list_find_custom (plus_features, name, compare_string)) { -error_report ("warning: Ambiguous CPU model string. " +warn_report ("Ambiguous CPU model string. " "Don't mix both \"+%s\" and \"%s=%s\"" , name, name, val);Indentation's off.
target/i386/cpu.c static void x86_cpu_parse_featurestr(const char *typename, char *features, · line 2071
Quoted 7 lines
target/i386/cpu.c +1
-1ambiguous = true; }if (g_list_find_custom (minus_features, name, compare_string)) { -error_report ("warning: Ambiguous CPU model string. " +warn_report ("Ambiguous CPU model string. " "Don't mix both \"-%s\" and \"%s=%s\"" , name, name, val);Likewise.
target/i386/cpu.c static void x86_cpu_parse_featurestr(const char *typename, char *features, · line 2100
Quoted 8 lines
target/i386/cpu.c +1
-1ambiguous = true;@@ -2096,7 +2096,7 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, }if (ambiguous) { -error_report ("warning: Compatibility of ambiguous CPU model " +warn_report ("Compatibility of ambiguous CPU model " "strings won't be kept on future QEMU versions" );Likewise.
target/i386/cpu.c static void x86_cpu_realizefn(DeviceState *dev, Error **errp) · line 3552
Quoted 10 lines
target/i386/cpu.c +1
-1} }@@ -3547,7 +3547,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)*/ if (cpu->phys_bits != host_phys_bits && cpu->phys_bits !=0 && !warned) { -error_report ("Warning: Host physical bits (%u)" +warn_report ("Host physical bits (%u)" " does not match phys-bits property (%u)" , host_phys_bits, cpu->phys_bits);Let's fix indentation while there.
Quoted 6 lines
target/i386/cpu.c +0
-0warned = true;target/i386/kvm.c +0
-0target/i386/kvm.c static int kvm_arch_set_tsc_khz(CPUState *cs) · line 606
Quoted 8 lines
target/i386/kvm.c +1
-1@@ -600,7 +600,7 @@ static int kvm_arch_set_tsc_khz(CPUState *cs) kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ) : -ENOTSUP ;if (cur_freq <=0 || cur_freq != env->tsc_khz) { -error_report ("warning: TSC frequency mismatch between " +warn_report ("TSC frequency mismatch between " "VM (%" PRId64" kHz) and host (%d kHz), " "and TSC scaling unavailable" , env->tsc_khz, cur_freq);Indentation's off.
target/i386/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 923
Quoted 7 lines
target/i386/kvm.c +1
-1@@ -919,7 +919,7 @@ int kvm_arch_init_vcpu(CPUState *cs)error_report ("kvm: LMCE not supported" );return -ENOTSUP ; } -error_report ("warning: Unsupported MCG_CAP bits: 0x%" PRIx64, +warn_report ("Unsupported MCG_CAP bits: 0x%" PRIx64, unsupported_caps);Likewise.
Quoted 7 lines
target/i386/kvm.c +0
-0}target/s390x/cpu_models.c +0
-0target/s390x/cpu_models.c static void check_consistency(const S390CPUModel *model) · line 682
Quoted 7 lines
target/s390x/cpu_models.c +1
-1@@ -677,7 +677,7 @@ static void check_consistency(const S390CPUModel *model)for (i =0 ; i <ARRAY_SIZE (dep); i++) {if (test_bit (dep[i][0 ], model->features) && !test_bit (dep[i][1 ], model->features)) { -error_report ("Warning: \'%s\' requires \'%s\'." , +warn_report ("\'%s\' requires \'%s\'." ,s390_feat_def (dep[i][0 ])->name,s390_feat_def (dep[i][1 ])->name);Likewise.
target/s390x/kvm.c void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp) · line 2679
Quoted 12 lines
target/s390x/cpu_models.c +0
-0}target/s390x/kvm.c +1
-1@@ -2675,7 +2675,7 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)/* enable CMM via CMMA - disable on hugetlbfs */ if (test_bit (S390_FEAT_CMM , model->features)) {if (mem_path) { -error_report ("Warning: CMM will not be enabled because it is not " +warn_report ("CMM will not be enabled because it is not " "compatible to hugetlbfs." );Likewise.
Quoted 25 lines
target/s390x/kvm.c +0
-0}else {kvm_s390_enable_cmma ();tests/test-qdev-global-props.c +3
-3@@ -232,10 +232,10 @@ static void test_dynamic_globalprop(void)g_test_trap_assert_passed ();g_test_trap_assert_stderr_unmatched ("*prop1*" );g_test_trap_assert_stderr_unmatched ("*prop2*" ); -g_test_trap_assert_stderr ("*Warning: global dynamic-prop-type-bad.prop3 has invalid class name\n*" ); +g_test_trap_assert_stderr ("*warning: global dynamic-prop-type-bad.prop3 has invalid class name\n*" );g_test_trap_assert_stderr_unmatched ("*prop4*" ); -g_test_trap_assert_stderr ("*Warning: global nohotplug-type.prop5=105 not used\n*" ); -g_test_trap_assert_stderr ("*Warning: global nondevice-type.prop6 has invalid class name\n*" ); +g_test_trap_assert_stderr ("*warning: global nohotplug-type.prop5=105 not used\n*" ); +g_test_trap_assert_stderr ("*warning: global nondevice-type.prop6 has invalid class name\n*" );g_test_trap_assert_stdout ("" ); }trace/control.c +0
-0trace/control.c static void do_trace_enable_events(const char *line_buf) · line 175
Quoted 6 lines
trace/control.c +1
-1@@ -171,7 +171,7 @@ static void do_trace_enable_events(const char *line_buf)while ((ev =trace_event_iter_next (&iter)) !=NULL ) {if (!trace_event_get_state_static (ev)) {if (!is_pattern) { -error_report ("WARNING: trace event '%s' is not traceable" , +warn_report ("trace event '%s' is not traceable" , line_ptr);Likewise.
trace/control.c static void do_trace_enable_events(const char *line_buf) · line 190
Quoted 9 lines
trace/control.c +1
-1return ; }@@ -186,7 +186,7 @@ static void do_trace_enable_events(const char *line_buf) }if (!is_pattern) { -error_report ("WARNING: trace event '%s' does not exist" , +warn_report ("trace event '%s' does not exist" , line_ptr);Likewise.
Quoted 63 lines
trace/control.c +0
-0} }vl.c +9
-9@@ -952,8 +952,8 @@ static void bt_vhci_add(int vlan_id)struct bt_scatternet_s *vlan =qemu_find_bt_vlan (vlan_id);if (!vlan->slave) -error_report ("warning: adding a VHCI to an empty scatternet %i" , - vlan_id); +warn_report ("adding a VHCI to an empty scatternet %i" , + vlan_id);bt_vhci_init (bt_new_hci (vlan)); }@@ -979,8 +979,8 @@ static struct bt_device_s *bt_device_add(const char *opt) vlan =qemu_find_bt_vlan (vlan_id);if (!vlan->slave) -error_report ("warning: adding a slave device to an empty scatternet %i" , - vlan_id); +warn_report ("adding a slave device to an empty scatternet %i" , + vlan_id);if (!strcmp (devname,"keyboard" ))return bt_keyboard_init (vlan);@@ -2302,8 +2302,8 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)return -1 ; }if (strncmp (name,"opt/" ,4 ) !=0 ) { -error_report ("warning: externally provided fw_cfg item names " -"should be prefixed with \"opt/\"" ); +warn_report ("externally provided fw_cfg item names " +"should be prefixed with \"opt/\"" ); }if (nonempty_str (str)) { size =strlen (str);/* NUL terminator NOT included in fw_cfg blob */ @@ -3760,7 +3760,7 @@ int main(int argc, char **argv, char **envp)qemu_opts_parse_noisily (olist,"accel=tcg" , false);break ;case QEMU_OPTION_no_kvm_pit: { -error_report ("warning: ignoring deprecated option" ); +warn_report ("ignoring deprecated option" );break ; }case QEMU_OPTION_no_kvm_pit_reinjection: {@@ -3770,8 +3770,8 @@ int main(int argc, char **argv, char **envp) .value = "discard", }; -error_report ("warning: deprecated, replaced by " -"-global kvm-pit.lost_tick_policy=discard" ); +warn_report ("deprecated, replaced by " +"-global kvm-pit.lost_tick_policy=discard" );qdev_prop_register_global (&kvm_pit_lost_tick_policy);break ; }@@ -3896,7 +3896,7 @@ int main(int argc, char **argv, char **envp) }break ;case QEMU_OPTION_tdf:
Quoted 8 lines
vl.c int main(int argc, char **argv, char **envp) · line 3902
Quoted 5 lines
vl.c +1
-1-error_report ("warning: ignoring deprecated option" ); +warn_report ("ignoring deprecated option" );break ;case QEMU_OPTION_name: opts = qemu_opts_parse_noisily(qemu_find_opts("name"),Nothing remotely serious here, but too many little touch-ups for me to volunteer doing them on commit, sorry.
No worries, I'll prepare a new version.
Thanks,
Alistair
PATCH v3 4/8 hw/i386: Improve some of the warning messages
In reply to Alistair Francis---
hw/i386/acpi-build.c | 7 ++++--- hw/i386/pc.c | 9 ++++----- hw/i386/pc_q35.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-)
hw/i386/acpi-build.c +4 -3
@@ -2766,7 +2766,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) ACPI_BUILD_ALIGN_SIZE);if (tables_blob->len > legacy_table_size) {/* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ -warn_report ("migration may not work." ); +warn_report ("ACPI tables are larger than legacy_table_size" ); +warn_report ("migration may not work" ); }g_array_set_size (tables_blob, legacy_table_size); }else {
@@ -2774,9 +2775,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) {/* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ warn_report ("ACPI tables are larger than 64k." ); -warn_report ("migration may not work." ); +warn_report ("migration may not work" );warn_report ("please remove CPUs, NUMA nodes, " -"memory slots or PCI bridges." ); +"memory slots or PCI bridges" ); }acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); }
hw/i386/pc.c +4 -5
@@ -383,8 +383,8 @@ ISADevice *pc_find_fdc0(void)if (state.multiple) {warn_report ("multiple floppy disk controllers with " "iobase=0x3f0 have been found" ); -error_printf ("the one being picked for CMOS setup might not reflect " -"your intent\n" ); +warn_report ("the one being picked for CMOS setup might not reflect " +"your intent" ); }return state.floppy;
@@ -2087,9 +2087,8 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, }if (value < (1ULL <<20 )) { -warn_report ("small max_ram_below_4g(%" PRIu64 -") less than 1M. BIOS may not work.." , - value); +warn_report ("max_ram_below_4g (%" PRIu64") is less than 1M; " +"BIOS may not work." , value); } pcms->max_ram_below_4g = value;
hw/i386/pc_q35.c +2 -2
@@ -101,8 +101,8 @@ static void pc_q35_init(MachineState *machine) lowmem = pcms->max_ram_below_4g;if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL <<30 ) -1 )) { -warn_report ("Large machine and max_ram_below_4g(%" PRIu64 -") not a multiple of 1G; possible bad performance." , +warn_report ("Large machine and max_ram_below_4g (%" PRIu64") not a " +"multiple of 1G; possible bad performance." , pcms->max_ram_below_4g); } }
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v3 4/8] hw/i386: Improve some of the warning messages
Quoted 2 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>Suggested-by Eduardo Habkost <[email protected]>
You forgot to cc: Eduardo. Fixed.
Quoted 12 lines
---
hw/i386/acpi-build.c | 7 ++++--- hw/i386/pc.c | 9 ++++----- hw/i386/pc_q35.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-)hw/i386/acpi-build.c +0
-0
hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2770
Quoted 6 lines
hw/i386/acpi-build.c +2
-1@@ -2766,7 +2766,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) ACPI_BUILD_ALIGN_SIZE);if (tables_blob->len > legacy_table_size) {/* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ -warn_report ("migration may not work." ); +warn_report ("ACPI tables are larger than legacy_table_size" ); +warn_report ("migration may not work" );
The user has no idea what legacy_table_size means, what its value might be, or what he can do to reduce it.
Recommend
warn_report("ACPI tables too large, migration may not work");If the user can do something to reduce the table size, printing suitable hints would be nice. Printing both tables_blob->len and legacy_table_size might also help then.
hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2777
Quoted 7 lines
hw/i386/acpi-build.c +0
-0}g_array_set_size (tables_blob, legacy_table_size); }else {@@ -2774,9 +2775,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) {/* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ warn_report ("ACPI tables are larger than 64k." );
The warning text hardcodes the value of ACPI_BUILD_TABLE_SIZE / 2. Not nice. Clean up while there?
hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2780
Quoted 5 lines
hw/i386/acpi-build.c +2
-2-warn_report ("migration may not work." ); +warn_report ("migration may not work" );warn_report ("please remove CPUs, NUMA nodes, " -"memory slots or PCI bridges." ); +"memory slots or PCI bridges" );
Aha, here's what the user can do.
What about:
warn_report("ACPI tables are large, migration may not work");
error_printf("Try removing CPUs, NUMA nodes, memory slots"
" or PCI bridges.");If we want to show actual size and limit, then this might do instead:
warn_report("ACPI table size %u exceeds %d bytes,"
" migration may not work", tables_blob->len, ACPI_BUILD_TABLE_SIZE / 2);
error_printf("Try removing CPUs, NUMA nodes, memory slots"
" or PCI bridges.");
Quoted 8 lines
hw/i386/acpi-build.c +0
-0}acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); }hw/i386/pc.c +0
-0
hw/i386/pc.c ISADevice *pc_find_fdc0(void) · line 387
Quoted 7 lines
hw/i386/pc.c +2
-2@@ -383,8 +383,8 @@ ISADevice *pc_find_fdc0(void)if (state.multiple) {warn_report ("multiple floppy disk controllers with " "iobase=0x3f0 have been found" ); -error_printf ("the one being picked for CMOS setup might not reflect " -"your intent\n" ); +warn_report ("the one being picked for CMOS setup might not reflect " +"your intent" );
Please keep error_printf() here.
hw/i386/pc.c static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, · line 2091
Quoted 12 lines
hw/i386/pc.c +2
-3}return state.floppy;@@ -2087,9 +2087,8 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, }if (value < (1ULL <<20 )) { -warn_report ("small max_ram_below_4g(%" PRIu64 -") less than 1M. BIOS may not work.." , - value); +warn_report ("max_ram_below_4g (%" PRIu64") is less than 1M; " +"BIOS may not work." , value);
The user has no idea what max_ram_below_4g might be. Suggest:
warn_report("Only %" PRIu64 " bytes of RAM below the 4GiB boundary,"
"BIOS may not work with less than 1MiB");
Quoted 8 lines
hw/i386/pc.c +0
-0} pcms->max_ram_below_4g = value;hw/i386/pc_q35.c +0
-0
hw/i386/pc_q35.c static void pc_q35_init(MachineState *machine) · line 105
Quoted 7 lines
hw/i386/pc_q35.c +2
-2@@ -101,8 +101,8 @@ static void pc_q35_init(MachineState *machine) lowmem = pcms->max_ram_below_4g;if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL <<30 ) -1 )) { - warn_report("Large machine and max_ram_below_4g(%"PRIu64 - ") not a multiple of 1G; possible bad performance.", + warn_report("Large machine and max_ram_below_4g (%"PRIu64") not a " + "multiple of 1G; possible bad performance.",
Space between string literal and PRIu64, please.
The user has no idea what max_ram_below_4g might be, or what makes the machine "large".
Quoted 3 lines
hw/i386/pc_q35.c +0
-0pcms->max_ram_below_4g); } }
Re: [Qemu-devel] [PATCH v3 4/8] hw/i386: Improve some of the warning messages
Quoted 62 lines · Markus Armbruster
Quoted 2 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>Suggested-by Eduardo Habkost <[email protected]>You forgot to cc: Eduardo. Fixed.
Quoted 12 lines
---
hw/i386/acpi-build.c | 7 ++++--- hw/i386/pc.c | 9 ++++----- hw/i386/pc_q35.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-)hw/i386/acpi-build.c +0
-0hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2770
Quoted 6 lines
hw/i386/acpi-build.c +2
-1@@ -2766,7 +2766,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) ACPI_BUILD_ALIGN_SIZE);if (tables_blob->len > legacy_table_size) {/* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ -warn_report ("migration may not work." ); +warn_report ("ACPI tables are larger than legacy_table_size" ); +warn_report ("migration may not work" );The user has no idea what
legacy_table_sizemeans, what its value might be, or what he can do to reduce it.Recommend
warn_report("ACPI tables too large, migration may not work");If the user can do something to reduce the table size, printing suitable hints would be nice. Printing both
tables_blob->lenandlegacy_table_sizemight also help then.hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2777
Quoted 7 lines
hw/i386/acpi-build.c +0
-0}g_array_set_size (tables_blob, legacy_table_size); }else {@@ -2774,9 +2775,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) {/* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ warn_report ("ACPI tables are larger than 64k." );The warning text hardcodes the value of
ACPI_BUILD_TABLE_SIZE/ 2. Not nice. Clean up while there?hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2780
Quoted 5 lines
hw/i386/acpi-build.c +2
-2-warn_report ("migration may not work." ); +warn_report ("migration may not work" );warn_report ("please remove CPUs, NUMA nodes, " -"memory slots or PCI bridges." ); +"memory slots or PCI bridges" );Aha, here's what the user can do.
What about:
warn_report("ACPI tables are large, migration may not work"); error_printf("Try removing CPUs, NUMA nodes, memory slots" " or PCI bridges.");
Quoted 7 lines
If we want to show actual size and limit, then this might do instead:
warn_report("ACPI table size %u exceeds %d bytes,"
" migration may not work",tables_blob->len,ACPI_BUILD_TABLE_SIZE/ 2);
error_printf("Try removing CPUs, NUMA nodes, memory slots"
" or PCI bridges.");
Yep, this suggestion is good for both cases: the check (ACPI_BUILD_TABLE_SIZE / 2), and the check for legacy_table_size.
Quoted 10 lines
Quoted 10 lines
hw/i386/acpi-build.c +0
-0}acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); }hw/i386/pc.c +0
-0@@ -383,8 +383,8 @@ ISADevice *pc_find_fdc0(void)if (state.multiple) {
Quoted 9 lines
hw/i386/pc.c ISADevice *pc_find_fdc0(void) · line 387
Quoted 6 lines
hw/i386/pc.c +2
-2warn_report ("multiple floppy disk controllers with " "iobase=0x3f0 have been found" ); -error_printf ("the one being picked for CMOS setup might not reflect " -"your intent\n" ); +warn_report ("the one being picked for CMOS setup might not reflect " +"your intent" );Please keep
error_printf()here.
I think I suggested warn_report() here for consistency, because I have seen other cases where multiple warn_report() calls were used. We probably want to change those other cases like you suggested above.
Quoted 15 lines
hw/i386/pc.c static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, · line 2091
Quoted 12 lines
hw/i386/pc.c +2
-3}return state.floppy;@@ -2087,9 +2087,8 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, }if (value < (1ULL <<20 )) { -warn_report ("small max_ram_below_4g(%" PRIu64 -") less than 1M. BIOS may not work.." , - value); +warn_report ("max_ram_below_4g (%" PRIu64") is less than 1M; " +"BIOS may not work." , value);The user has no idea what
max_ram_below_4gmight be. Suggest:
Quoted 2 lines
warn_report("Only %" PRIu64 " bytes of RAM below the 4GiB boundary,"
"BIOS may not work with less than 1MiB");
Actually, the user probably knows what it is, because this setter will be invoked only if "-M max-ram-below-4g=..." is used in the command-line. We should fix the spelling to "max-ram-below-4g", though.
Quoted 19 lines
Quoted 9 lines
hw/i386/pc.c +0
-0} pcms->max_ram_below_4g = value;hw/i386/pc_q35.c +0
-0hw/i386/pc_q35.c static void pc_q35_init(MachineState *machine) · line 105
Quoted 7 lines
hw/i386/pc_q35.c +2
-2@@ -101,8 +101,8 @@ static void pc_q35_init(MachineState *machine) lowmem = pcms->max_ram_below_4g;if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL <<30 ) -1 )) { - warn_report("Large machine and max_ram_below_4g(%"PRIu64 - ") not a multiple of 1G; possible bad performance.", + warn_report("Large machine and max_ram_below_4g (%"PRIu64") not a " + "multiple of 1G; possible bad performance.",Space between string literal and PRIu64, please.
Quoted 1 line
The user has no idea what
max_ram_below_4gmight be, [...]
Same as above: the warning should appear only if the user set "max-ram-below-4g" explicitly, so the user probably knows what it is.
Quoted 2 lines
[...] or what makes the
machine "large".
True.
Quoted 4 lines
Quoted 4 lines
hw/i386/pc_q35.c +0
-0pcms->max_ram_below_4g); } }
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v3 4/8] hw/i386: Improve some of the warning messages
Quoted 143 lines · Eduardo Habkost
Quoted 62 lines · Markus Armbruster
Quoted 2 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>Suggested-by Eduardo Habkost <[email protected]>You forgot to cc: Eduardo. Fixed.
Quoted 12 lines
---
hw/i386/acpi-build.c | 7 ++++--- hw/i386/pc.c | 9 ++++----- hw/i386/pc_q35.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-)hw/i386/acpi-build.c +0
-0hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2770
Quoted 6 lines
hw/i386/acpi-build.c +2
-1@@ -2766,7 +2766,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) ACPI_BUILD_ALIGN_SIZE);if (tables_blob->len > legacy_table_size) {/* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ -warn_report ("migration may not work." ); +warn_report ("ACPI tables are larger than legacy_table_size" ); +warn_report ("migration may not work" );The user has no idea what
legacy_table_sizemeans, what its value might be, or what he can do to reduce it.Recommend
warn_report("ACPI tables too large, migration may not work");If the user can do something to reduce the table size, printing suitable hints would be nice. Printing both
tables_blob->lenandlegacy_table_sizemight also help then.hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2777
Quoted 7 lines
hw/i386/acpi-build.c +0
-0}g_array_set_size (tables_blob, legacy_table_size); }else {@@ -2774,9 +2775,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) {/* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ warn_report ("ACPI tables are larger than 64k." );The warning text hardcodes the value of
ACPI_BUILD_TABLE_SIZE/ 2. Not nice. Clean up while there?hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2780
Quoted 5 lines
hw/i386/acpi-build.c +2
-2-warn_report ("migration may not work." ); +warn_report ("migration may not work" );warn_report ("please remove CPUs, NUMA nodes, " -"memory slots or PCI bridges." ); +"memory slots or PCI bridges" );Aha, here's what the user can do.
What about:
warn_report("ACPI tables are large, migration may not work"); error_printf("Try removing CPUs, NUMA nodes, memory slots" " or PCI bridges.");Quoted 7 lines
If we want to show actual size and limit, then this might do instead:
warn_report("ACPI table size %u exceeds %d bytes,"
" migration may not work",tables_blob->len,ACPI_BUILD_TABLE_SIZE/ 2);
error_printf("Try removing CPUs, NUMA nodes, memory slots"
" or PCI bridges.");Yep, this suggestion is good for both cases: the check (
ACPI_BUILD_TABLE_SIZE/ 2), and the check forlegacy_table_size.Quoted 10 lines
Quoted 10 lines
hw/i386/acpi-build.c +0
-0}acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); }hw/i386/pc.c +0
-0@@ -383,8 +383,8 @@ ISADevice *pc_find_fdc0(void)if (state.multiple) {Quoted 9 lines
hw/i386/pc.c ISADevice *pc_find_fdc0(void) · line 387
Quoted 6 lines
hw/i386/pc.c +2
-2warn_report ("multiple floppy disk controllers with " "iobase=0x3f0 have been found" ); -error_printf ("the one being picked for CMOS setup might not reflect " -"your intent\n" ); +warn_report ("the one being picked for CMOS setup might not reflect " +"your intent" );Please keep
error_printf()here.I think I suggested
warn_report()here for consistency, because I have seen other cases where multiplewarn_report()calls were used. We probably want to change those other cases like you suggested above.Quoted 15 lines
hw/i386/pc.c static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, · line 2091
Quoted 12 lines
hw/i386/pc.c +2
-3}return state.floppy;@@ -2087,9 +2087,8 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, }if (value < (1ULL <<20 )) { -warn_report ("small max_ram_below_4g(%" PRIu64 -") less than 1M. BIOS may not work.." , - value); +warn_report ("max_ram_below_4g (%" PRIu64") is less than 1M; " +"BIOS may not work." , value);The user has no idea what
max_ram_below_4gmight be. Suggest:Quoted 2 lines
warn_report("Only %" PRIu64 " bytes of RAM below the 4GiB boundary,"
"BIOS may not work with less than 1MiB");Actually, the user probably knows what it is, because this setter will be invoked only if "-M max-ram-below-4g=..." is used in the command-line. We should fix the spelling to "max-ram-below-4g", though.
Quoted 19 lines
Quoted 9 lines
hw/i386/pc.c +0
-0} pcms->max_ram_below_4g = value;hw/i386/pc_q35.c +0
-0hw/i386/pc_q35.c static void pc_q35_init(MachineState *machine) · line 105
Quoted 7 lines
hw/i386/pc_q35.c +2
-2@@ -101,8 +101,8 @@ static void pc_q35_init(MachineState *machine) lowmem = pcms->max_ram_below_4g;if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL <<30 ) -1 )) { - warn_report("Large machine and max_ram_below_4g(%"PRIu64 - ") not a multiple of 1G; possible bad performance.", + warn_report("Large machine and max_ram_below_4g (%"PRIu64") not a " + "multiple of 1G; possible bad performance.",Space between string literal and PRIu64, please.
Quoted 1 line
The user has no idea what
max_ram_below_4gmight be, [...]
Quoted 13 lines
Same as above: the warning should appear only if the user set "max-ram-below-4g" explicitly, so the user probably knows what it is.
Quoted 2 lines
[...] or what makes the
machine "large".True.
Quoted 4 lines
Quoted 4 lines
hw/i386/pc_q35.c +0
-0pcms->max_ram_below_4g); } }
Alistair, I suggest I apply just the other six patches for now, and you improve this patch without undue time pressure. What do you think?
Re: [Qemu-devel] [PATCH v3 4/8] hw/i386: Improve some of the warning messages
Quoted 155 lines · Markus Armbruster
Quoted 153 lines · Eduardo Habkost
Quoted 62 lines · Markus Armbruster
Quoted 2 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>Suggested-by Eduardo Habkost <[email protected]>You forgot to cc: Eduardo. Fixed.
Quoted 12 lines
---
hw/i386/acpi-build.c | 7 ++++--- hw/i386/pc.c | 9 ++++----- hw/i386/pc_q35.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-)hw/i386/acpi-build.c +0
-0hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2770
Quoted 6 lines
hw/i386/acpi-build.c +2
-1@@ -2766,7 +2766,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) ACPI_BUILD_ALIGN_SIZE);if (tables_blob->len > legacy_table_size) {/* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ -warn_report ("migration may not work." ); +warn_report ("ACPI tables are larger than legacy_table_size" ); +warn_report ("migration may not work" );The user has no idea what
legacy_table_sizemeans, what its value might be, or what he can do to reduce it.Recommend
warn_report("ACPI tables too large, migration may not work");If the user can do something to reduce the table size, printing suitable hints would be nice. Printing both
tables_blob->lenandlegacy_table_sizemight also help then.hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2777
Quoted 7 lines
hw/i386/acpi-build.c +0
-0}g_array_set_size (tables_blob, legacy_table_size); }else {@@ -2774,9 +2775,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) {/* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ warn_report ("ACPI tables are larger than 64k." );The warning text hardcodes the value of
ACPI_BUILD_TABLE_SIZE/ 2. Not nice. Clean up while there?hw/i386/acpi-build.c void acpi_build(AcpiBuildTables *tables, MachineState *machine) · line 2780
Quoted 5 lines
hw/i386/acpi-build.c +2
-2-warn_report ("migration may not work." ); +warn_report ("migration may not work" );warn_report ("please remove CPUs, NUMA nodes, " -"memory slots or PCI bridges." ); +"memory slots or PCI bridges" );Aha, here's what the user can do.
What about:
warn_report("ACPI tables are large, migration may not work"); error_printf("Try removing CPUs, NUMA nodes, memory slots" " or PCI bridges.");Quoted 7 lines
If we want to show actual size and limit, then this might do instead:
warn_report("ACPI table size %u exceeds %d bytes,"
" migration may not work",tables_blob->len,ACPI_BUILD_TABLE_SIZE/ 2);
error_printf("Try removing CPUs, NUMA nodes, memory slots"
" or PCI bridges.");Yep, this suggestion is good for both cases: the check (
ACPI_BUILD_TABLE_SIZE/ 2), and the check forlegacy_table_size.Quoted 10 lines
Quoted 10 lines
hw/i386/acpi-build.c +0
-0}acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); }hw/i386/pc.c +0
-0@@ -383,8 +383,8 @@ ISADevice *pc_find_fdc0(void)if (state.multiple) {Quoted 9 lines
hw/i386/pc.c ISADevice *pc_find_fdc0(void) · line 387
Quoted 6 lines
hw/i386/pc.c +2
-2warn_report ("multiple floppy disk controllers with " "iobase=0x3f0 have been found" ); -error_printf ("the one being picked for CMOS setup might not reflect " -"your intent\n" ); +warn_report ("the one being picked for CMOS setup might not reflect " +"your intent" );Please keep
error_printf()here.I think I suggested
warn_report()here for consistency, because I have seen other cases where multiplewarn_report()calls were used. We probably want to change those other cases like you suggested above.Quoted 15 lines
hw/i386/pc.c static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, · line 2091
Quoted 12 lines
hw/i386/pc.c +2
-3}return state.floppy;@@ -2087,9 +2087,8 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, }if (value < (1ULL <<20 )) { -warn_report ("small max_ram_below_4g(%" PRIu64 -") less than 1M. BIOS may not work.." , - value); +warn_report ("max_ram_below_4g (%" PRIu64") is less than 1M; " +"BIOS may not work." , value);The user has no idea what
max_ram_below_4gmight be. Suggest:Quoted 2 lines
warn_report("Only %" PRIu64 " bytes of RAM below the 4GiB boundary,"
"BIOS may not work with less than 1MiB");Actually, the user probably knows what it is, because this setter will be invoked only if "-M max-ram-below-4g=..." is used in the command-line. We should fix the spelling to "max-ram-below-4g", though.
Quoted 19 lines
Quoted 9 lines
hw/i386/pc.c +0
-0} pcms->max_ram_below_4g = value;hw/i386/pc_q35.c +0
-0hw/i386/pc_q35.c static void pc_q35_init(MachineState *machine) · line 105
Quoted 7 lines
hw/i386/pc_q35.c +2
-2@@ -101,8 +101,8 @@ static void pc_q35_init(MachineState *machine) lowmem = pcms->max_ram_below_4g;if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL <<30 ) -1 )) { - warn_report("Large machine and max_ram_below_4g(%"PRIu64 - ") not a multiple of 1G; possible bad performance.", + warn_report("Large machine and max_ram_below_4g (%"PRIu64") not a " + "multiple of 1G; possible bad performance.",Space between string literal and PRIu64, please.
Quoted 1 line
The user has no idea what
max_ram_below_4gmight be, [...]Same as above: the warning should appear only if the user set "max-ram-below-4g" explicitly, so the user probably knows what it is.
Quoted 2 lines
[...] or what makes the
machine "large".True.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
hw/i386/pc_q35.c static void pc_q35_init(MachineState *machine) · line 108
Quoted 3 lines
hw/i386/pc_q35.c +0
-0pcms->max_ram_below_4g); } }Alistair, I suggest I apply just the other six patches for now, and you improve this patch without undue time pressure. What do you think?
That sounds great! I can move this patch into a future cleanup series (which has a growing amount of work) and work on it when I return. The sooner this series is in the better, then people can start to use warn_error() so we don't have more calls to convert.
Thanks,
Alistair
PATCH v3 5/8 char-socket: Report TCP socket waiting as information
In reply to Alistair FrancisWhen QEMU is waiting for a TCP socket connection it reports that message as an error. This isn't an error it is just information so let's change the report to use info_report() instead.
---
chardev/char-socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
chardev/char-socket.c +2 -2
@@ -765,8 +765,8 @@ static int tcp_chr_wait_connected(Chardev *chr, Error **errp)* in TLS and telnet cases, only wait for an accepted socket */ while (!s->ioc) {if (s->is_listen) { -error_report ("QEMU waiting for connection on: %s" , - chr->filename); +info_report ("QEMU waiting for connection on: %s" , + chr->filename);qio_channel_set_blocking (QIO_CHANNEL (s->listen_ioc), true,NULL );tcp_chr_accept (QIO_CHANNEL (s->listen_ioc),G_IO_IN , chr);qio_channel_set_blocking (QIO_CHANNEL (s->listen_ioc), false,NULL );
Signature · 1 line
2.11.0
PATCH v3 6/8 error: Implement the warn and free Error functions
In reply to Alistair FrancisImplement warn_report_err() and warn_reportf_err() functions which are the same as the error_report_err() and error_reportf_err() functions except report a warning instead of an error.
---
include/qapi/error.h | 11 +++++++++++ scripts/checkpatch.pl | 1 + util/error.c | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+)
include/qapi/error.h +11 -0
@@ -267,11 +267,22 @@ void error_free(Error *err);void error_free_or_abort (Error **errp);/* +* Convenience function to warn_report() and free @err. +*/ +void warn_report_err (Error *err); + +/* * Convenience function to error_report() and free @err. */ void error_report_err (Error *err);/* +* Convenience function to error_prepend(), warn_report() and free @err. +*/ +void warn_reportf_err(Error *err, const char *fmt, ...) + GCC_FMT_ATTR(2, 3); + +/* * Convenience function to error_prepend(), error_report() and free @err. */ void error_reportf_err (Error *err,const char *fmt, ...)
scripts/checkpatch.pl +1 -0
@@ -2533,6 +2533,7 @@ sub process { error_setg_file_open| error_set| error_prepend| + warn_reportf_err| error_reportf_err| error_vreport| report_vreport|
util/error.c +20 -0
@@ -232,6 +232,15 @@ void error_report_err(Error *err)error_free (err); } +void warn_report_err (Error *err) +{ +warn_report ("%s" ,error_get_pretty (err)); +if (err->hint) { +error_printf_unless_qmp ("%s" , err->hint->str); + } +error_free (err); +} +void error_reportf_err (Error *err,const char *fmt, ...) {va_list ap;
@@ -242,6 +251,17 @@ void error_reportf_err(Error *err, const char *fmt, ...)error_report_err (err); } + +void warn_reportf_err (Error *err,const char *fmt, ...) +{ +va_list ap; + +va_start (ap, fmt); +error_vprepend (&err, fmt, ap); +va_end (ap); +warn_report_err (err); +} +void error_free (Error *err) {if (err) {
Signature · 1 line
2.11.0
PATCH v3 7/8 Convert error_report*_err() to warn_report*_err()
In reply to Alistair FrancisConvert all uses of error_report*_err("Warning:"... to use warn_report*_err() instead. This helps standardise on a single method of printing warnings to the user.
---
hw/core/qdev-properties.c | 2 +- hw/i386/pc.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
hw/core/qdev-properties.c +1 -1
@@ -1169,7 +1169,7 @@ static void qdev_prop_set_globals_for_type(DeviceState *dev,error_propagate (prop->errp, err); }else {assert (prop->user_provided); -error_reportf_err (err,"Warning: " ); +warn_report_err (err); } } }
hw/i386/pc.c +1 -2
@@ -1320,8 +1320,7 @@ void pc_acpi_init(const char *default_dsdt)acpi_table_add_builtin (opts, &err);if (err) { -error_reportf_err (err,"WARNING: failed to load %s: " , - filename); +warn_reportf_err (err,"failed to load %s: " , filename); }g_free (filename); }
Signature · 1 line
2.11.0
PATCH v3 8/8 error: Add a 'error: ' prefix to error_report()
In reply to Alistair FrancisAs we don't regard error messages as a stable API the let's add a 'error: ' prefix to the original error_report() messages.
---
util/qemu-error.c | 1 + 1 file changed, 1 insertion(+)
util/qemu-error.c +1 -0
@@ -203,6 +203,7 @@ static void vreport(report_type type, const char *fmt, va_list ap)switch (type) {case REPORT_TYPE_ERROR : +error_printf ("error: " );break ;case REPORT_TYPE_WARNING :error_printf ("warning: " );
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH v3 8/8] error: Add a 'error: ' prefix to error_report()
Quoted 8 lines · Alistair Francis
As we don't regard error messages as a stable API the let's add a 'error: ' prefix to the original
error_report()messages.Signed-off-by Alistair Francis <[email protected]>---
util/qemu-error.c | 1 + 1 file changed, 1 insertion(+)
This breaks quite a few qemu-iotests.
Max
Re: [Qemu-devel] [PATCH v3 8/8] error: Add a 'error: ' prefix to error_report()
Quoted 11 lines · Max Reitz
Quoted 8 lines · Alistair Francis
As we don't regard error messages as a stable API the let's add a 'error: ' prefix to the original
error_report()messages.Signed-off-by Alistair Francis <[email protected]>---
util/qemu-error.c | 1 + 1 file changed, 1 insertion(+)This breaks quite a few qemu-iotests.
Hmmm... Ok, I'll have to dig into that.
I'm traveling at the moment so I won't get a chance to fix this. I'm going to send the next version of this series, but remove this patch and I can look at adding it again when I get back. There is already a few things that have been pointed out that need to be fixed after this patch set.
Do people think we should add this prefix or leave the error messages as is? I haven't heard a definitive answer if people think this is the right path to take.
Thanks,
Alistair
Quoted 3 lines
Max
Re: [Qemu-devel] [PATCH v3 8/8] error: Add a 'error: ' prefix to error_report()
Quoted 21 lines · Alistair Francis
Quoted 11 lines · Max Reitz
Quoted 8 lines · Alistair Francis
As we don't regard error messages as a stable API the let's add a 'error: ' prefix to the original
error_report()messages.Signed-off-by Alistair Francis <[email protected]>---
util/qemu-error.c | 1 + 1 file changed, 1 insertion(+)This breaks quite a few qemu-iotests.
Hmmm... Ok, I'll have to dig into that.
I'm traveling at the moment so I won't get a chance to fix this. I'm going to send the next version of this series, but remove this patch and I can look at adding it again when I get back. There is already a few things that have been pointed out that need to be fixed after this patch set.
Quoted 3 lines
Do people think we should add this prefix or leave the error messages as is? I haven't heard a definitive answer if people think this is the right path to take.
I don't really mind either way. But it probably is a good idea to separate this one patch from this series.
Max
Re: [Qemu-devel] [PATCH v3 8/8] error: Add a 'error: ' prefix to error_report()
In reply to Alistair FrancisQuoted 13 lines · Alistair Francis
Quoted 11 lines · Max Reitz
Quoted 8 lines · Alistair Francis
As we don't regard error messages as a stable API the let's add a 'error: ' prefix to the original
error_report()messages.Signed-off-by Alistair Francis <[email protected]>---
util/qemu-error.c | 1 + 1 file changed, 1 insertion(+)This breaks quite a few qemu-iotests.
Quoted 7 lines
Hmmm... Ok, I'll have to dig into that.
I'm traveling at the moment so I won't get a chance to fix this. I'm going to send the next version of this series, but remove this patch and I can look at adding it again when I get back. There is already a few things that have been pointed out that need to be fixed after this patch set.
Separating this change from the rest of the series makes sense, because it lets use get the bulk of your work in more quickly.
Quoted 3 lines
Do people think we should add this prefix or leave the error messages as is? I haven't heard a definitive answer if people think this is the right path to take.
I'd leave them as is. More inertia than opposition. If you think a prefix solves a problem people have, by all means post a patch. Please explain in the commit message why the patch is useful. The current one explains only why we can change error messages, not why we *want* to change them.
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Subject: [Qemu-devel] [PATCH v3 0/8] Implement a warning_report function
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
60686e6 error: Add a 'error: ' prefix to error_report() 5364f27 Convert error_report*_err() to warn_report*_err() a893104 error: Implement the warn and free Error functions acb3d0e char-socket: Report TCP socket waiting as information 49d68cd hw/i386: Improve some of the warning messages ec1a246 Convert error_report() to warn_report()
23f4974 error: Functions to report warnings and informational messages fdc3c8a util/qemu-error: Rename error_print_loc() to be more generic
=== OUTPUT BEGIN ===
Checking PATCH 1/8: util/qemu-error: Rename error_print_loc() to be more generic... Checking PATCH 2/8: error: Functions to report warnings and informational messages... Checking PATCH 3/8: Convert error_report() to warn_report()...
ERROR: line over 90 characters
#694: FILE: tests/test-qdev-global-props.c:235:
+ g_test_trap_assert_stderr("*warning: global dynamic-prop-type-bad.prop3 has invalid class name\n*");
WARNING: line over 80 characters
#698: FILE: tests/test-qdev-global-props.c:237:
+ g_test_trap_assert_stderr("*warning: global nohotplug-type.prop5=105 not used\n*");
ERROR: line over 90 characters
#699: FILE: tests/test-qdev-global-props.c:238:
+ g_test_trap_assert_stderr("*warning: global nondevice-type.prop6 has invalid class name\n*");
total: 2 errors, 1 warnings, 539 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 4/8: hw/i386: Improve some of the warning messages... Checking PATCH 5/8: char-socket: Report TCP socket waiting as information... Checking PATCH 6/8: error: Implement the warn and free Error functions... Checking PATCH 7/8: Convert error_report*_err() to warn_report*_err()... Checking PATCH 8/8: error: Add a 'error: ' prefix to error_report()... === OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]