mirror of https://github.com/proxmox/mirror_qemu
spapr: Use error_append_hint() in spapr_reallocate_hpt()
Hints should be added with the dedicated error_append_hint() API because we don't want to print them when using QMP. This requires to insert ERRP_GUARD as explained in "qapi/error.h". Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <160371604030.305923.17464161378167312662.stgit@bahia.lan> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>master
parent
6e837f98ba
commit
c3e051ed6d
|
@ -1486,6 +1486,7 @@ void spapr_free_hpt(SpaprMachineState *spapr)
|
||||||
void spapr_reallocate_hpt(SpaprMachineState *spapr, int shift,
|
void spapr_reallocate_hpt(SpaprMachineState *spapr, int shift,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
|
ERRP_GUARD();
|
||||||
long rc;
|
long rc;
|
||||||
|
|
||||||
/* Clean up any HPT info from a previous boot */
|
/* Clean up any HPT info from a previous boot */
|
||||||
|
@ -1500,17 +1501,18 @@ void spapr_reallocate_hpt(SpaprMachineState *spapr, int shift,
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
/* kernel-side HPT needed, but couldn't allocate one */
|
/* kernel-side HPT needed, but couldn't allocate one */
|
||||||
error_setg_errno(errp, errno,
|
error_setg_errno(errp, errno, "Failed to allocate KVM HPT of order %d",
|
||||||
"Failed to allocate KVM HPT of order %d (try smaller maxmem?)",
|
|
||||||
shift);
|
shift);
|
||||||
|
error_append_hint(errp, "Try smaller maxmem?\n");
|
||||||
/* This is almost certainly fatal, but if the caller really
|
/* This is almost certainly fatal, but if the caller really
|
||||||
* wants to carry on with shift == 0, it's welcome to try */
|
* wants to carry on with shift == 0, it's welcome to try */
|
||||||
} else if (rc > 0) {
|
} else if (rc > 0) {
|
||||||
/* kernel-side HPT allocated */
|
/* kernel-side HPT allocated */
|
||||||
if (rc != shift) {
|
if (rc != shift) {
|
||||||
error_setg(errp,
|
error_setg(errp,
|
||||||
"Requested order %d HPT, but kernel allocated order %ld (try smaller maxmem?)",
|
"Requested order %d HPT, but kernel allocated order %ld",
|
||||||
shift, rc);
|
shift, rc);
|
||||||
|
error_append_hint(errp, "Try smaller maxmem?\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
spapr->htab_shift = shift;
|
spapr->htab_shift = shift;
|
||||||
|
|
Loading…
Reference in New Issue