From patchwork Tue Sep 17 10:20:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfQ11pfxz9s00 for ; Tue, 17 Sep 2019 20:25:29 +1000 (AEST) Received: from localhost ([::1]:43710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAfm-0001Gt-0n for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:25:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43601) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAbM-0006Lr-DI for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:20:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAbL-0003ZE-4e for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:20:52 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:25626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAbK-0003Yc-So for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:20:51 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHFcg108804 for ; Tue, 17 Sep 2019 06:20:50 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2tf7qr0n-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:20:49 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:20:46 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:20:40 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HAKcHP48300210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:20:38 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 480EA52054; Tue, 17 Sep 2019 10:20:38 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 54F195204E; Tue, 17 Sep 2019 10:20:37 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:20:37 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-4275-0000-0000-000003678A37 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-4276-0000-0000-00003879EF68 Message-Id: <156871563702.196432.5964411202152101367.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=747 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 01/17] error: Update error_append_hint()'s documentation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av21.portsmouth.uk.ibm.com, David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr?= =?utf-8?b?w6k=?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" error_setg() and error_propagate(), as well as their variants, cause QEMU to terminate when called with &error_fatal or &error_abort. This prevents to add hints since error_append_hint() isn't even called in this case. It means that error_append_hint() should only be used with a local error object, and then propagate this local error to the caller. Document this in . Signed-off-by: Greg Kurz Reviewed-by: Cornelia Huck Reviewed-by: Eric Blake --- include/qapi/error.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/qapi/error.h b/include/qapi/error.h index 3f95141a01a8..28174329ba71 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -27,6 +27,13 @@ * error_setg(&err, "invalid quark\n" * "Valid quarks are up, down, strange, charm, top, bottom."); * + * Dot *not* pass the errp parameter from the caller + * error_setg(errp, "invalid quark"); + * error_append_hint(errp, "Valid quarks are up, down, strange, " + * "charm, top, bottom.\n"); + * because error_setg() terminates QEMU if @errp is &error_fatal or + * &error_abort, and the hints are not even added. + * * Report an error to the current monitor if we have one, else stderr: * error_report_err(err); * This frees the error object. @@ -252,7 +259,9 @@ void error_prepend(Error **errp, const char *fmt, ...) * error message. * @errp may be NULL, but not &error_fatal or &error_abort. * Trivially the case if you call it only after error_setg() or - * error_propagate(). + * error_propagate(). CAUTION: error_setg() and error_propagate() do + * not return when passed &error_fatal. Always use a local error object + * and propagate it to the caller. * May be called multiple times. The resulting hint should end with a * newline. */ From patchwork Tue Sep 17 10:20:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163275 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfKy17FMz9s00 for ; Tue, 17 Sep 2019 20:21:58 +1000 (AEST) Received: from localhost ([::1]:43690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcN-0006V9-4k for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:21:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43628) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAbS-0006RZ-KF for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAbQ-0003bm-Oc for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:20:58 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:5540 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAbQ-0003bX-JL for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:20:56 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHIgK083442 for ; Tue, 17 Sep 2019 06:20:55 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2tkpqnen-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:20:55 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:20:52 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:20:46 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HAKini49807392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:20:44 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A60F04C062; Tue, 17 Sep 2019 10:20:44 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A2B2F4C046; Tue, 17 Sep 2019 10:20:43 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:20:43 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:20:43 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0020-0000-0000-0000036E12AC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0021-0000-0000-000021C3B657 Message-Id: <156871564329.196432.5930574495661947805.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 02/17] block: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av22.portsmouth.uk.ibm.com, John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- block/backup.c | 7 +++++-- block/dirty-bitmap.c | 7 +++++-- block/file-posix.c | 20 +++++++++++++------- block/gluster.c | 23 +++++++++++++++-------- block/qcow.c | 10 ++++++---- block/qcow2.c | 7 +++++-- block/vhdx-log.c | 7 +++++-- block/vpc.c | 7 +++++-- 8 files changed, 59 insertions(+), 29 deletions(-) diff --git a/block/backup.c b/block/backup.c index 763f0d7ff6db..d8c422a0e3bc 100644 --- a/block/backup.c +++ b/block/backup.c @@ -602,11 +602,14 @@ static int64_t backup_calculate_cluster_size(BlockDriverState *target, BACKUP_CLUSTER_SIZE_DEFAULT); return BACKUP_CLUSTER_SIZE_DEFAULT; } else if (ret < 0 && !target->backing) { - error_setg_errno(errp, -ret, + Error *local_err = NULL; + + error_setg_errno(&local_err, -ret, "Couldn't determine the cluster size of the target image, " "which has no backing file"); - error_append_hint(errp, + error_append_hint(&local_err, "Aborting, since this may create an unusable destination image\n"); + error_propagate(errp, local_err); return ret; } else if (ret < 0 && target->backing) { /* Not fatal; just trudge on ahead. */ diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 134e0c9a0c8f..b31017a77d51 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -251,10 +251,13 @@ int bdrv_dirty_bitmap_check(const BdrvDirtyBitmap *bitmap, uint32_t flags, if ((flags & BDRV_BITMAP_INCONSISTENT) && bdrv_dirty_bitmap_inconsistent(bitmap)) { - error_setg(errp, "Bitmap '%s' is inconsistent and cannot be used", + Error *local_err = NULL; + + error_setg(&local_err, "Bitmap '%s' is inconsistent and cannot be used", bitmap->name); - error_append_hint(errp, "Try block-dirty-bitmap-remove to delete" + error_append_hint(&local_err, "Try block-dirty-bitmap-remove to delete" " this bitmap from disk"); + error_propagate(errp, local_err); return -1; } diff --git a/block/file-posix.c b/block/file-posix.c index f12c06de2df5..9a95f7e94123 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -389,8 +389,11 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp) } if (!s->buf_align || !bs->bl.request_alignment) { - error_setg(errp, "Could not find working O_DIRECT alignment"); - error_append_hint(errp, "Try cache.direct=off\n"); + Error *local_err = NULL; + + error_setg(&local_err, "Could not find working O_DIRECT alignment"); + error_append_hint(&local_err, "Try cache.direct=off\n"); + error_propagate(errp, local_err); } } @@ -845,16 +848,18 @@ static int raw_handle_perm_lock(BlockDriverState *bs, } ret = raw_apply_lock_bytes(s, s->fd, s->perm | new_perm, ~s->shared_perm | ~new_shared, - false, errp); + false, &local_err); if (!ret) { - ret = raw_check_lock_bytes(s->fd, new_perm, new_shared, errp); + ret = raw_check_lock_bytes(s->fd, new_perm, new_shared, &local_err); if (!ret) { return 0; } - error_append_hint(errp, + error_append_hint(&local_err, "Is another process using the image [%s]?\n", bs->filename); } + error_propagate(errp, local_err); + local_err = NULL; /* for fall through */ op = RAW_PL_ABORT; /* fall through to unlock bytes. */ case RAW_PL_ABORT: @@ -2277,11 +2282,12 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp) } /* Step two: Check that nobody else has taken conflicting locks */ - result = raw_check_lock_bytes(fd, perm, shared, errp); + result = raw_check_lock_bytes(fd, perm, shared, &local_err); if (result < 0) { - error_append_hint(errp, + error_append_hint(&local_err, "Is another process using the image [%s]?\n", file_opts->filename); + error_propagate(errp, local_err); goto out_unlock; } diff --git a/block/gluster.c b/block/gluster.c index 64028b2cba30..dce42884f97c 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -473,26 +473,29 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, ret = glfs_init(glfs); if (ret) { - error_setg(errp, "Gluster connection for volume %s, path %s failed" + Error *local_err = NULL; + + error_setg(&local_err, "Gluster connection for volume %s, path %s failed" " to connect", gconf->volume, gconf->path); for (server = gconf->server; server; server = server->next) { if (server->value->type == SOCKET_ADDRESS_TYPE_UNIX) { - error_append_hint(errp, "hint: failed on socket %s ", + error_append_hint(&local_err, "hint: failed on socket %s ", server->value->u.q_unix.path); } else { - error_append_hint(errp, "hint: failed on host %s and port %s ", + error_append_hint(&local_err, "hint: failed on host %s and port %s ", server->value->u.inet.host, server->value->u.inet.port); } } - error_append_hint(errp, "Please refer to gluster logs for more info\n"); + error_append_hint(&local_err, "Please refer to gluster logs for more info\n"); /* glfs_init sometimes doesn't set errno although docs suggest that */ if (errno == 0) { errno = EINVAL; } + error_propagate(errp, local_err); goto out; } return glfs; @@ -695,20 +698,23 @@ static int qemu_gluster_parse(BlockdevOptionsGluster *gconf, QDict *options, Error **errp) { int ret; + Error *local_err = NULL; + if (filename) { ret = qemu_gluster_parse_uri(gconf, filename); if (ret < 0) { - error_setg(errp, "invalid URI %s", filename); - error_append_hint(errp, "Usage: file=gluster[+transport]://" + error_setg(&local_err, "invalid URI %s", filename); + error_append_hint(&local_err, "Usage: file=gluster[+transport]://" "[host[:port]]volume/path[?socket=...]" "[,file.debug=N]" "[,file.logfile=/path/filename.log]\n"); + error_propagate(errp, local_err); return ret; } } else { - ret = qemu_gluster_parse_json(gconf, options, errp); + ret = qemu_gluster_parse_json(gconf, options, &local_err); if (ret < 0) { - error_append_hint(errp, "Usage: " + error_append_hint(&local_err, "Usage: " "-drive driver=qcow2,file.driver=gluster," "file.volume=testvol,file.path=/path/a.qcow2" "[,file.debug=9]" @@ -719,6 +725,7 @@ static int qemu_gluster_parse(BlockdevOptionsGluster *gconf, "file.server.1.transport=unix," "file.server.1.path=/var/run/glusterd.socket ..." "\n"); + error_propagate(errp, local_err); return ret; } } diff --git a/block/qcow.c b/block/qcow.c index 5bdf72ba33ce..9049573b52b2 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -156,11 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } if (header.version != QCOW_VERSION) { - error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32, + error_setg(&local_err, "qcow (v%d) does not support qcow version %" PRIu32, QCOW_VERSION, header.version); if (header.version == 2 || header.version == 3) { - error_append_hint(errp, "Try the 'qcow2' driver instead.\n"); + error_append_hint(&local_err, "Try the 'qcow2' driver instead.\n"); } + error_propagate(errp, local_err); ret = -ENOTSUP; goto fail; @@ -189,14 +190,15 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, if (s->crypt_method_header) { if (bdrv_uses_whitelist() && s->crypt_method_header == QCOW_CRYPT_AES) { - error_setg(errp, + error_setg(&local_err, "Use of AES-CBC encrypted qcow images is no longer " "supported in system emulators"); - error_append_hint(errp, + error_append_hint(&local_err, "You can use 'qemu-img convert' to convert your " "image to an alternative supported format, such " "as unencrypted qcow, or raw with the LUKS " "format instead.\n"); + error_propagate(errp, local_err); ret = -ENOSYS; goto fail; } diff --git a/block/qcow2.c b/block/qcow2.c index 57734f20cf8d..2c52139b7385 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1357,14 +1357,17 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, if (s->crypt_method_header) { if (bdrv_uses_whitelist() && s->crypt_method_header == QCOW_CRYPT_AES) { - error_setg(errp, + Error *local_err = NULL; + + error_setg(&local_err, "Use of AES-CBC encrypted qcow2 images is no longer " "supported in system emulators"); - error_append_hint(errp, + error_append_hint(&local_err, "You can use 'qemu-img convert' to convert your " "image to an alternative supported format, such " "as unencrypted qcow2, or raw with the LUKS " "format instead.\n"); + error_propagate(errp, local_err); ret = -ENOSYS; goto fail; } diff --git a/block/vhdx-log.c b/block/vhdx-log.c index fdd3a7adc378..9f4de9cbcdb6 100644 --- a/block/vhdx-log.c +++ b/block/vhdx-log.c @@ -802,15 +802,18 @@ int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s, bool *flushed, if (logs.valid) { if (bs->read_only) { + Error *local_err = NULL; + bdrv_refresh_filename(bs); ret = -EPERM; - error_setg(errp, + error_setg(&local_err, "VHDX image file '%s' opened read-only, but " "contains a log that needs to be replayed", bs->filename); - error_append_hint(errp, "To replay the log, run:\n" + error_append_hint(&local_err, "To replay the log, run:\n" "qemu-img check -r all '%s'\n", bs->filename); + error_propagate(errp, local_err); goto exit; } /* now flush the log */ diff --git a/block/vpc.c b/block/vpc.c index 5cd38907808b..facd7cdb2c98 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -1028,12 +1028,15 @@ static int coroutine_fn vpc_co_create(BlockdevCreateOptions *opts, } if (total_size != total_sectors * BDRV_SECTOR_SIZE) { - error_setg(errp, "The requested image size cannot be represented in " + Error *local_err = NULL; + + error_setg(&local_err, "The requested image size cannot be represented in " "CHS geometry"); - error_append_hint(errp, "Try size=%llu or force-size=on (the " + error_append_hint(&local_err, "Try size=%llu or force-size=on (the " "latter makes the image incompatible with " "Virtual PC)", total_sectors * BDRV_SECTOR_SIZE); + error_propagate(errp, local_err); ret = -EINVAL; goto out; } From patchwork Tue Sep 17 10:20:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163276 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfLM5MDwz9s00 for ; Tue, 17 Sep 2019 20:22:19 +1000 (AEST) Received: from localhost ([::1]:43692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcj-0006dP-Id for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:22:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43642) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAbY-0006Yw-Uq for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAbX-0003ec-Vi for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:04 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:19006) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAbX-0003eG-Lv for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:03 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHFom110670 for ; Tue, 17 Sep 2019 06:21:02 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2w62hbt2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:02 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:20:59 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:20:52 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HAKp7e45088908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:20:51 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00108A405D; Tue, 17 Sep 2019 10:20:50 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09149A4055; Tue, 17 Sep 2019 10:20:50 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:20:49 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:20:49 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0020-0000-0000-0000036E12AD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0021-0000-0000-000021C3B65B Message-Id: <156871564968.196432.14445821515431540599.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=661 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 03/17] char/spice: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av23.portsmouth.uk.ibm.com, Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- chardev/spice.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chardev/spice.c b/chardev/spice.c index 241e2b7770eb..ed5996467c32 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -279,10 +279,12 @@ static void qemu_chr_open_spice_vmc(Chardev *chr, if (*psubtype == NULL) { char *subtypes = g_strjoinv(", ", (gchar **)spice_server_char_device_recognized_subtypes()); + Error *local_err = NULL; - error_setg(errp, "unsupported type name: %s", type); - error_append_hint(errp, "allowed spice char type names: %s\n", + error_setg(&local_err, "unsupported type name: %s", type); + error_append_hint(&local_err, "allowed spice char type names: %s\n", subtypes); + error_propagate(errp, local_err); g_free(subtypes); return; From patchwork Tue Sep 17 10:20:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfLc24kYz9s00 for ; Tue, 17 Sep 2019 20:22:32 +1000 (AEST) Received: from localhost ([::1]:43694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcv-0006p2-D9 for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:22:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43682) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAbg-0006iV-Cw for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAbf-0003hh-1n for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:62158) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAbe-0003hP-Pp for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:11 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAI3ds034933 for ; Tue, 17 Sep 2019 06:21:10 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2v5vv5n5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:09 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:06 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:20:59 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HAKv0O56229996 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:20:57 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 510BB42045; Tue, 17 Sep 2019 10:20:57 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 59A8542041; Tue, 17 Sep 2019 10:20:56 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:20:56 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:20:56 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-4275-0000-0000-000003678A3C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-4276-0000-0000-00003879EF6F Message-Id: <156871565600.196432.9246692833113774428.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 04/17] ppc: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av24.portsmouth.uk.ibm.com, Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz Acked-by: David Gibson --- hw/ppc/mac_newworld.c | 7 +++++-- hw/ppc/spapr.c | 7 +++++-- hw/ppc/spapr_pci.c | 9 +++++---- target/ppc/kvm.c | 13 +++++++++---- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index c5bbcc743352..aca8c40bf395 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -618,8 +618,11 @@ static void core99_set_via_config(Object *obj, const char *value, Error **errp) } else if (!strcmp(value, "pmu-adb")) { cms->via_config = CORE99_VIA_CONFIG_PMU_ADB; } else { - error_setg(errp, "Invalid via value"); - error_append_hint(errp, "Valid values are cuda, pmu, pmu-adb.\n"); + Error *local_err = NULL; + + error_setg(&local_err, "Invalid via value"); + error_append_hint(&local_err, "Valid values are cuda, pmu, pmu-adb.\n"); + error_propagate(errp, local_err); } } diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 08a2a5a77092..39d6f57d014e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4337,10 +4337,13 @@ void spapr_set_vcpu_id(PowerPCCPU *cpu, int cpu_index, Error **errp) vcpu_id = spapr_vcpu_id(spapr, cpu_index); if (kvm_enabled() && !kvm_vcpu_id_is_valid(vcpu_id)) { - error_setg(errp, "Can't create CPU with id %d in KVM", vcpu_id); - error_append_hint(errp, "Adjust the number of cpus to %d " + Error *local_err = NULL; + + error_setg(&local_err, "Can't create CPU with id %d in KVM", vcpu_id); + error_append_hint(&local_err, "Adjust the number of cpus to %d " "or try to raise the number of threads per core\n", vcpu_id * ms->smp.threads / spapr->vsmt); + error_propagate(errp, local_err); return; } diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 7b71ad7c74f1..4b7e9a1c8666 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1870,12 +1870,13 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) if (spapr_pci_find_phb(spapr, sphb->buid)) { SpaprPhbState *s; - error_setg(errp, "PCI host bridges must have unique indexes"); - error_append_hint(errp, "The following indexes are already in use:"); + error_setg(&local_err, "PCI host bridges must have unique indexes"); + error_append_hint(&local_err, "The following indexes are already in use:"); QLIST_FOREACH(s, &spapr->phbs, list) { - error_append_hint(errp, " %d", s->index); + error_append_hint(&local_err, " %d", s->index); } - error_append_hint(errp, "\nTry another value for the index property\n"); + error_append_hint(&local_err, "\nTry another value for the index property\n"); + error_propagate(errp, local_err); return; } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 8c5b1f25cc95..c6876b08c726 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -242,8 +242,11 @@ static void kvm_get_smmu_info(struct kvm_ppc_smmu_info *info, Error **errp) assert(kvm_state != NULL); if (!kvm_check_extension(kvm_state, KVM_CAP_PPC_GET_SMMU_INFO)) { - error_setg(errp, "KVM doesn't expose the MMU features it supports"); - error_append_hint(errp, "Consider switching to a newer KVM\n"); + Error *local_err = NULL; + + error_setg(&local_err, "KVM doesn't expose the MMU features it supports"); + error_append_hint(&local_err, "Consider switching to a newer KVM\n"); + error_propagate(errp, local_err); return; } @@ -2076,6 +2079,7 @@ void kvmppc_hint_smt_possible(Error **errp) int i; GString *g; char *s; + Error *local_err = NULL; assert(kvm_enabled()); if (cap_ppc_smt_possible) { @@ -2086,12 +2090,13 @@ void kvmppc_hint_smt_possible(Error **errp) } } s = g_string_free(g, false); - error_append_hint(errp, "%s.\n", s); + error_append_hint(&local_err, "%s.\n", s); g_free(s); } else { - error_append_hint(errp, + error_append_hint(&local_err, "This KVM seems to be too old to support VSMT.\n"); } + error_propagate(errp, local_err); } From patchwork Tue Sep 17 10:21:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163282 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfVt2DNyz9sCJ for ; Tue, 17 Sep 2019 20:29:42 +1000 (AEST) Received: from localhost ([::1]:43744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAjr-000598-Bl for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:29:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43703) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAbl-0006pq-Ms for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAbk-0003jz-Bb for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:17 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:30334) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAbk-0003jh-3Q for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:16 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHFN0110686 for ; Tue, 17 Sep 2019 06:21:15 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2w62hc0k-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:15 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:11 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:05 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HAL3Jh44696046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:03 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A554311C04C; Tue, 17 Sep 2019 10:21:03 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB1EA11C04A; Tue, 17 Sep 2019 10:21:02 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:02 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:02 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0012-0000-0000-0000034D13F6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0013-0000-0000-000021878DA5 Message-Id: <156871566233.196432.93294155722199104.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=962 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 05/17] arm: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av25.portsmouth.uk.ibm.com, =?utf-8?q?Marc-?= =?utf-8?b?QW5kcsOp?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- hw/arm/msf2-soc.c | 5 +++-- hw/arm/virt.c | 14 ++++++++++---- hw/intc/arm_gicv3_kvm.c | 5 +++-- hw/misc/msf2-sysreg.c | 6 ++++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c index 008fd9327aa4..f606cfe7d139 100644 --- a/hw/arm/msf2-soc.c +++ b/hw/arm/msf2-soc.c @@ -127,8 +127,9 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp) } if (!s->m3clk) { - error_setg(errp, "Invalid m3clk value"); - error_append_hint(errp, "m3clk can not be zero\n"); + error_setg(&err, "Invalid m3clk value"); + error_append_hint(&err, "m3clk can not be zero\n"); + error_propagate(errp, err); return; } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index d74538b0212e..7ac00dab581e 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1804,8 +1804,11 @@ static void virt_set_gic_version(Object *obj, const char *value, Error **errp) } else if (!strcmp(value, "max")) { vms->gic_version = -1; /* Will probe later */ } else { - error_setg(errp, "Invalid gic-version value"); - error_append_hint(errp, "Valid values are 3, 2, host, max.\n"); + Error *err = NULL; + + error_setg(&err, "Invalid gic-version value"); + error_append_hint(&err, "Valid values are 3, 2, host, max.\n"); + error_propagate(errp, err); } } @@ -1832,8 +1835,11 @@ static void virt_set_iommu(Object *obj, const char *value, Error **errp) } else if (!strcmp(value, "none")) { vms->iommu = VIRT_IOMMU_NONE; } else { - error_setg(errp, "Invalid iommu value"); - error_append_hint(errp, "Valid values are none, smmuv3.\n"); + Error *err = NULL; + + error_setg(&err, "Invalid iommu value"); + error_append_hint(&err, "Valid values are none, smmuv3.\n"); + error_propagate(errp, err); } } diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 9c7f4ab8711c..09784f06f9ad 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -810,10 +810,11 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION); if (!multiple_redist_region_allowed && s->nb_redist_regions > 1) { - error_setg(errp, "Multiple VGICv3 redistributor regions are not " + error_setg(&local_err, "Multiple VGICv3 redistributor regions are not " "supported by this host kernel"); - error_append_hint(errp, "A maximum of %d VCPUs can be used", + error_append_hint(&local_err, "A maximum of %d VCPUs can be used", s->redist_region_count[0]); + error_propagate(errp, local_err); return; } diff --git a/hw/misc/msf2-sysreg.c b/hw/misc/msf2-sysreg.c index ddc5a30c80f7..23c7890ac022 100644 --- a/hw/misc/msf2-sysreg.c +++ b/hw/misc/msf2-sysreg.c @@ -128,12 +128,14 @@ static Property msf2_sysreg_properties[] = { static void msf2_sysreg_realize(DeviceState *dev, Error **errp) { MSF2SysregState *s = MSF2_SYSREG(dev); + Error *local_err = NULL; if ((s->apb0div > 32 || !is_power_of_2(s->apb0div)) || (s->apb1div > 32 || !is_power_of_2(s->apb1div))) { - error_setg(errp, "Invalid apb divisor value"); - error_append_hint(errp, "apb divisor must be a power of 2" + error_setg(&local_err, "Invalid apb divisor value"); + error_append_hint(&local_err, "apb divisor must be a power of 2" " and maximum value is 32\n"); + error_propagate(errp, local_err); } } From patchwork Tue Sep 17 10:21:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163289 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Xfcc5B8qz9s00 for ; Tue, 17 Sep 2019 20:34:40 +1000 (AEST) Received: from localhost ([::1]:43778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAog-0000dF-DS for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:34:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43719) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAbr-0006xW-I8 for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAbq-0003mY-9E for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:23 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34564) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAbq-0003mK-0z for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:22 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHFVW110704 for ; Tue, 17 Sep 2019 06:21:21 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2w62hc3e-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:20 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:17 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:11 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALADO49217772 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:10 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02A3BAE055; Tue, 17 Sep 2019 10:21:10 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C731AE045; Tue, 17 Sep 2019 10:21:09 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:08 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:08 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-4275-0000-0000-000003678A42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-4276-0000-0000-00003879EF77 Message-Id: <156871566867.196432.11276188812327366259.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=509 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 06/17] vfio: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av26.portsmouth.uk.ibm.com, John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz Reviewed-by: Cornelia Huck --- hw/vfio/common.c | 14 ++++++++++---- hw/vfio/pci.c | 12 ++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 3e03c495d868..05b1c39a426f 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1469,10 +1469,13 @@ VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp) } if (!(status.flags & VFIO_GROUP_FLAGS_VIABLE)) { - error_setg(errp, "group %d is not viable", groupid); - error_append_hint(errp, + Error *err = NULL; + + error_setg(&err, "group %d is not viable", groupid); + error_append_hint(&err, "Please ensure all devices within the iommu_group " "are bound to their vfio bus driver.\n"); + error_propagate(errp, err); goto close_fd_exit; } @@ -1531,11 +1534,14 @@ int vfio_get_device(VFIOGroup *group, const char *name, fd = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, name); if (fd < 0) { - error_setg_errno(errp, errno, "error getting device from group %d", + Error *err = NULL; + + error_setg_errno(&err, errno, "error getting device from group %d", group->groupid); - error_append_hint(errp, + error_append_hint(&err, "Verify all devices in group %d are bound to vfio- " "or pci-stub and not already in use\n", group->groupid); + error_propagate(errp, err); return fd; } diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index dc3479c374e3..b037dec2215b 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2527,10 +2527,13 @@ static void vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) g_free(reg_info); if (vdev->features & VFIO_FEATURE_ENABLE_VGA) { - ret = vfio_populate_vga(vdev, errp); + Error *err = NULL; + + ret = vfio_populate_vga(vdev, &err); if (ret) { - error_append_hint(errp, "device does not support " + error_append_hint(&err, "device does not support " "requested feature x-vga\n"); + error_propagate(errp, err); return; } } @@ -2714,9 +2717,10 @@ static void vfio_realize(PCIDevice *pdev, Error **errp) if (!vdev->vbasedev.sysfsdev) { if (!(~vdev->host.domain || ~vdev->host.bus || ~vdev->host.slot || ~vdev->host.function)) { - error_setg(errp, "No provided host device"); - error_append_hint(errp, "Use -device vfio-pci,host=DDDD:BB:DD.F " + error_setg(&err, "No provided host device"); + error_append_hint(&err, "Use -device vfio-pci,host=DDDD:BB:DD.F " "or -device vfio-pci,sysfsdev=PATH_TO_DEVICE\n"); + error_propagate(errp, err); return; } vdev->vbasedev.sysfsdev = From patchwork Tue Sep 17 10:21:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfRR58w9z9s00 for ; Tue, 17 Sep 2019 20:26:43 +1000 (AEST) Received: from localhost ([::1]:43724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAgz-0002HW-HB for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:26:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43788) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAby-00077j-Dx for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAbw-0003pa-Mg for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:8860) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAbw-0003p6-DJ for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:28 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHFVe070841 for ; Tue, 17 Sep 2019 06:21:27 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2w2ysmnf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:27 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:24 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:18 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALGXt28770498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:16 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 572B3A405F; Tue, 17 Sep 2019 10:21:16 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D1AAA4054; Tue, 17 Sep 2019 10:21:15 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:15 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:15 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0028-0000-0000-0000039E0EF0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0029-0000-0000-000024608799 Message-Id: <156871567501.196432.1562118977835800045.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=629 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 07/17] virtio-pci: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@b06wcsmtp001.portsmouth.uk.ibm.com, David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- hw/virtio/virtio-pci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c6b47a9c7385..1e58822ba186 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1543,9 +1543,12 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) virtio_pci_disable_modern(proxy); if (!legacy) { - error_setg(errp, "Device doesn't support modern mode, and legacy" + Error *local_err = NULL; + + error_setg(&local_err, "Device doesn't support modern mode, and legacy" " mode is disabled"); - error_append_hint(errp, "Set disable-legacy to off\n"); + error_append_hint(&local_err, "Set disable-legacy to off\n"); + error_propagate(errp, local_err); return; } @@ -1737,10 +1740,13 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) } if (!virtio_pci_modern(proxy) && !virtio_pci_legacy(proxy)) { - error_setg(errp, "device cannot work as neither modern nor legacy mode" + Error *local_err = NULL; + + error_setg(&local_err, "device cannot work as neither modern nor legacy mode" " is enabled"); - error_append_hint(errp, "Set either disable-modern or disable-legacy" + error_append_hint(&local_err, "Set either disable-modern or disable-legacy" " to off\n"); + error_propagate(errp, local_err); return; } From patchwork Tue Sep 17 10:21:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfjN2F1Qz9s00 for ; Tue, 17 Sep 2019 20:38:48 +1000 (AEST) Received: from localhost ([::1]:43846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAsf-0004XG-Ff for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:38:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43832) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAc7-0007Dg-UF for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAc6-0003uE-PU for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:39 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:9136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAc4-0003su-MF for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:38 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHFZC069302 for ; Tue, 17 Sep 2019 06:21:34 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2vv9t8fp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:34 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:31 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:24 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALM5n28770518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:22 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94A4052051; Tue, 17 Sep 2019 10:21:22 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id A42B152054; Tue, 17 Sep 2019 10:21:21 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:21 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0012-0000-0000-0000034D13FA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0013-0000-0000-000021878DA8 Message-Id: <156871568135.196432.6958597878926788347.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=991 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 08/17] pcie_root_port: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av21.portsmouth.uk.ibm.com, David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr?= =?utf-8?b?w6k=?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- hw/pci-bridge/pcie_root_port.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c index 012c2cb12c10..086f9c17723d 100644 --- a/hw/pci-bridge/pcie_root_port.c +++ b/hw/pci-bridge/pcie_root_port.c @@ -65,15 +65,17 @@ static void rp_realize(PCIDevice *d, Error **errp) PCIDeviceClass *dc = PCI_DEVICE_GET_CLASS(d); PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d); int rc; + Error *local_err = NULL; pci_config_set_interrupt_pin(d->config, 1); pci_bridge_initfn(d, TYPE_PCIE_BUS); pcie_port_init_reg(d); rc = pci_bridge_ssvid_init(d, rpc->ssvid_offset, dc->vendor_id, - rpc->ssid, errp); + rpc->ssid, &local_err); if (rc < 0) { - error_append_hint(errp, "Can't init SSV ID, error %d\n", rc); + error_append_hint(&local_err, "Can't init SSV ID, error %d\n", rc); + error_propagate(errp, local_err); goto err_bridge; } @@ -85,10 +87,11 @@ static void rp_realize(PCIDevice *d, Error **errp) } rc = pcie_cap_init(d, rpc->exp_offset, PCI_EXP_TYPE_ROOT_PORT, - p->port, errp); + p->port, &local_err); if (rc < 0) { - error_append_hint(errp, "Can't add Root Port capability, " + error_append_hint(&local_err, "Can't add Root Port capability, " "error %d\n", rc); + error_propagate(errp, local_err); goto err_int; } From patchwork Tue Sep 17 10:21:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfRl1d4kz9s00 for ; Tue, 17 Sep 2019 20:26:59 +1000 (AEST) Received: from localhost ([::1]:43726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAhE-0002gG-LX for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:26:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43857) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcA-0007I0-DA for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAc9-0003vh-87 for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52478) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAc8-0003vN-WA for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:41 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHgYT048596 for ; Tue, 17 Sep 2019 06:21:40 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2wd3rqdq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:39 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:36 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:30 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALTLu44695820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:29 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA5654C040; Tue, 17 Sep 2019 10:21:28 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EEF444C044; Tue, 17 Sep 2019 10:21:27 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:27 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:27 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0020-0000-0000-0000036E12B7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0021-0000-0000-000021C3B664 Message-Id: <156871568761.196432.13197720535866413065.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=633 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 09/17] hw/rdma: Fix missing conversion to rdma_error_report() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av22.portsmouth.uk.ibm.com, John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Commit 4d71b38ae8fa converted many error_setg() call sites to rdma_error_report(), but it forgot to convert a companion error_append_hint(). Since no guy doesn't set errp anymore in pvrdma_realize(), errp remains NULL and error_append_hint() does nothing. Also error_append_hint() was a poor choice since its "intended use is adding helpful hints on the human user interface" and "not for clarifying a confusing error message". Call rdma_error_report() instead. Fixes: 4d71b38ae8fa "hw/rdma: Switch to generic error reporting way" Signed-off-by: Greg Kurz Reviewed-by: Yuval Shaia --- hw/rdma/vmw/pvrdma_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index 3e36e130139c..d370ae07ca6a 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -667,7 +667,7 @@ static void pvrdma_realize(PCIDevice *pdev, Error **errp) out: if (rc) { pvrdma_fini(pdev); - error_append_hint(errp, "Device failed to load\n"); + rdma_error_report("Device failed to load"); } } From patchwork Tue Sep 17 10:21:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Xfp53Gj0z9sNk for ; Tue, 17 Sep 2019 20:42:53 +1000 (AEST) Received: from localhost ([::1]:43874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAwc-0008LW-Rf for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:42:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43892) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcJ-0007Ui-Ip for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAcI-0003yx-F3 for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:51 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:8836) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAcI-0003yF-6j for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:50 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHG8M069376 for ; Tue, 17 Sep 2019 06:21:49 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2vv9t8np-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:48 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:45 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:37 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALZSW59244632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:35 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E2B0A404D; Tue, 17 Sep 2019 10:21:35 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F4EFA4053; Tue, 17 Sep 2019 10:21:34 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:34 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:34 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0016-0000-0000-000002AD13CF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0017-0000-0000-0000330DB755 Message-Id: <156871569396.196432.12307975838741351907.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=741 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 10/17] s390x/css: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av23.portsmouth.uk.ibm.com, Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand --- hw/s390x/s390-ccw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c index 0c5a5b60bd6b..9566be800a3b 100644 --- a/hw/s390x/s390-ccw.c +++ b/hw/s390x/s390-ccw.c @@ -57,11 +57,13 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev, { unsigned int cssid, ssid, devid; char dev_path[PATH_MAX] = {0}, *tmp; + Error *err = NULL; if (!sysfsdev) { - error_setg(errp, "No host device provided"); - error_append_hint(errp, + error_setg(&err, "No host device provided"); + error_append_hint(&err, "Use -device vfio-ccw,sysfsdev=PATH_TO_DEVICE\n"); + error_propagate(errp, err); return; } From patchwork Tue Sep 17 10:21:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfQn3YpSz9sCJ for ; Tue, 17 Sep 2019 20:26:09 +1000 (AEST) Received: from localhost ([::1]:43718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAgQ-0001qj-8z for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:26:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43916) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcO-0007b8-Lj for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAcN-00040t-Ed for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:56 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41276) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAcN-00040S-6c for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:21:55 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHEck118301 for ; Tue, 17 Sep 2019 06:21:54 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2wfs8gc2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:21:54 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:51 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:43 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALftR47054914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:41 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9BE1B42047; Tue, 17 Sep 2019 10:21:41 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A2B324203F; Tue, 17 Sep 2019 10:21:40 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:40 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:40 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-4275-0000-0000-000003678A50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-4276-0000-0000-00003879EF83 Message-Id: <156871570029.196432.9320869242034561567.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=656 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 11/17] scsi: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av24.portsmouth.uk.ibm.com, Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- hw/scsi/scsi-disk.c | 7 +++++-- hw/scsi/scsi-generic.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 915641a0f1b4..3d5e257bb66b 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2619,9 +2619,12 @@ static void scsi_block_realize(SCSIDevice *dev, Error **errp) /* check we are using a driver managing SG_IO (version 3 and after) */ rc = blk_ioctl(s->qdev.conf.blk, SG_GET_VERSION_NUM, &sg_version); if (rc < 0) { - error_setg_errno(errp, -rc, "cannot get SG_IO version number"); + Error *local_err = NULL; + + error_setg_errno(&local_err, -rc, "cannot get SG_IO version number"); if (rc != -EPERM) { - error_append_hint(errp, "Is this a SCSI device?\n"); + error_append_hint(&local_err, "Is this a SCSI device?\n"); + error_propagate(errp, local_err); } goto out; } diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index e7798ebcd0d4..f6a5b538cbcc 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -674,9 +674,12 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp) /* check we are using a driver managing SG_IO (version 3 and after */ rc = blk_ioctl(s->conf.blk, SG_GET_VERSION_NUM, &sg_version); if (rc < 0) { - error_setg_errno(errp, -rc, "cannot get SG_IO version number"); + Error *local_err = NULL; + + error_setg_errno(&local_err, -rc, "cannot get SG_IO version number"); if (rc != -EPERM) { - error_append_hint(errp, "Is this a SCSI device?\n"); + error_append_hint(&local_err, "Is this a SCSI device?\n"); + error_propagate(errp, local_err); } return; } From patchwork Tue Sep 17 10:21:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfXc3vm0z9s00 for ; Tue, 17 Sep 2019 20:31:12 +1000 (AEST) Received: from localhost ([::1]:43754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAlJ-0006HE-Ca for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:31:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43937) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcU-0007jF-UE for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAcT-00043W-Tk for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:02 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49434 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAcT-00043K-OP for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:01 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHGR8078108 for ; Tue, 17 Sep 2019 06:22:01 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v2vd5btga-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:22:01 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:21:55 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:49 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALmUF30736488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:48 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EEEBE11C050; Tue, 17 Sep 2019 10:21:47 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0260211C04A; Tue, 17 Sep 2019 10:21:47 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:46 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:46 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-4275-0000-0000-000003678A53 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-4276-0000-0000-00003879EF87 Message-Id: <156871570663.196432.7147178510220437381.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=641 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 12/17] migration: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av25.portsmouth.uk.ibm.com, =?utf-8?q?Marc-?= =?utf-8?b?QW5kcsOp?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz Acked-by: Dr. David Alan Gilbert --- migration/migration.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 01863a95f5fe..6724173ce34e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -983,18 +983,24 @@ static bool migrate_caps_check(bool *cap_list, #ifndef CONFIG_LIVE_BLOCK_MIGRATION if (cap_list[MIGRATION_CAPABILITY_BLOCK]) { - error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i) " + Error *local_err = NULL; + + error_setg(&local_err, "QEMU compiled without old-style (blk/-b, inc/-i) " "block migration"); - error_append_hint(errp, "Use drive_mirror+NBD instead.\n"); + error_append_hint(&local_err, "Use drive_mirror+NBD instead.\n"); + error_propagate(errp, local_err); return false; } #endif #ifndef CONFIG_REPLICATION if (cap_list[MIGRATION_CAPABILITY_X_COLO]) { - error_setg(errp, "QEMU compiled without replication module" + Error *local_err = NULL; + + error_setg(&local_err, "QEMU compiled without replication module" " can't enable COLO"); - error_append_hint(errp, "Please enable replication before COLO.\n"); + error_append_hint(&local_err, "Please enable replication before COLO.\n"); + error_propagate(errp, local_err); return false; } #endif From patchwork Tue Sep 17 10:21:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfXl46hvz9sCJ for ; Tue, 17 Sep 2019 20:31:19 +1000 (AEST) Received: from localhost ([::1]:43756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAlQ-0006Py-Di for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:31:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43967) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcf-0007lD-4K for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAca-00046H-Hb for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:11 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:31458) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAca-00045Q-9J for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:08 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHDas178933 for ; Tue, 17 Sep 2019 06:22:06 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v0uutuqf6-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:22:05 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:22:02 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:21:55 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALSI233489272 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:28 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C55FAE053; Tue, 17 Sep 2019 10:21:54 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54584AE04D; Tue, 17 Sep 2019 10:21:53 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:53 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:53 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0020-0000-0000-0000036E12C2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0021-0000-0000-000021C3B66F Message-Id: <156871571297.196432.545961868971946073.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=781 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 13/17] nbd: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av26.portsmouth.uk.ibm.com, John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz Reviewed-by: Eric Blake --- nbd/client.c | 24 +++++++++++++----------- nbd/server.c | 7 +++++-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/nbd/client.c b/nbd/client.c index b9dc829175f9..c6e6e4046fd5 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -154,6 +154,7 @@ static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply, bool strict, Error **errp) { g_autofree char *msg = NULL; + Error *local_err = NULL; if (!(reply->type & (1 << 31))) { return 1; @@ -161,14 +162,14 @@ static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply, if (reply->length) { if (reply->length > NBD_MAX_BUFFER_SIZE) { - error_setg(errp, "server error %" PRIu32 + error_setg(&local_err, "server error %" PRIu32 " (%s) message is too long", reply->type, nbd_rep_lookup(reply->type)); goto err; } msg = g_malloc(reply->length + 1); if (nbd_read(ioc, msg, reply->length, NULL, errp) < 0) { - error_prepend(errp, "Failed to read option error %" PRIu32 + error_prepend(&local_err, "Failed to read option error %" PRIu32 " (%s) message: ", reply->type, nbd_rep_lookup(reply->type)); goto err; @@ -187,50 +188,51 @@ static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply, switch (reply->type) { case NBD_REP_ERR_POLICY: - error_setg(errp, "Denied by server for option %" PRIu32 " (%s)", + error_setg(&local_err, "Denied by server for option %" PRIu32 " (%s)", reply->option, nbd_opt_lookup(reply->option)); break; case NBD_REP_ERR_INVALID: - error_setg(errp, "Invalid parameters for option %" PRIu32 " (%s)", + error_setg(&local_err, "Invalid parameters for option %" PRIu32 " (%s)", reply->option, nbd_opt_lookup(reply->option)); break; case NBD_REP_ERR_PLATFORM: - error_setg(errp, "Server lacks support for option %" PRIu32 " (%s)", + error_setg(&local_err, "Server lacks support for option %" PRIu32 " (%s)", reply->option, nbd_opt_lookup(reply->option)); break; case NBD_REP_ERR_TLS_REQD: - error_setg(errp, "TLS negotiation required before option %" PRIu32 + error_setg(&local_err, "TLS negotiation required before option %" PRIu32 " (%s)", reply->option, nbd_opt_lookup(reply->option)); break; case NBD_REP_ERR_UNKNOWN: - error_setg(errp, "Requested export not available"); + error_setg(&local_err, "Requested export not available"); break; case NBD_REP_ERR_SHUTDOWN: - error_setg(errp, "Server shutting down before option %" PRIu32 " (%s)", + error_setg(&local_err, "Server shutting down before option %" PRIu32 " (%s)", reply->option, nbd_opt_lookup(reply->option)); break; case NBD_REP_ERR_BLOCK_SIZE_REQD: - error_setg(errp, "Server requires INFO_BLOCK_SIZE for option %" PRIu32 + error_setg(&local_err, "Server requires INFO_BLOCK_SIZE for option %" PRIu32 " (%s)", reply->option, nbd_opt_lookup(reply->option)); break; default: - error_setg(errp, "Unknown error code when asking for option %" PRIu32 + error_setg(&local_err, "Unknown error code when asking for option %" PRIu32 " (%s)", reply->option, nbd_opt_lookup(reply->option)); break; } if (msg) { - error_append_hint(errp, "server reported: %s\n", msg); + error_append_hint(&local_err, "server reported: %s\n", msg); } err: + error_propagate(errp, local_err); nbd_send_opt_abort(ioc); return -1; } diff --git a/nbd/server.c b/nbd/server.c index 28c3c8be854c..6d9ca2563cce 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1616,6 +1616,8 @@ void nbd_export_close(NBDExport *exp) void nbd_export_remove(NBDExport *exp, NbdServerRemoveMode mode, Error **errp) { + Error *local_err = NULL; + if (mode == NBD_SERVER_REMOVE_MODE_HARD || QTAILQ_EMPTY(&exp->clients)) { nbd_export_close(exp); return; @@ -1623,8 +1625,9 @@ void nbd_export_remove(NBDExport *exp, NbdServerRemoveMode mode, Error **errp) assert(mode == NBD_SERVER_REMOVE_MODE_SAFE); - error_setg(errp, "export '%s' still in use", exp->name); - error_append_hint(errp, "Use mode='hard' to force client disconnect\n"); + error_setg(&local_err, "export '%s' still in use", exp->name); + error_append_hint(&local_err, "Use mode='hard' to force client disconnect\n"); + error_propagate(errp, local_err); } void nbd_export_get(NBDExport *exp) From patchwork Tue Sep 17 10:21:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XfWR5n8hz9s00 for ; Tue, 17 Sep 2019 20:30:11 +1000 (AEST) Received: from localhost ([::1]:43748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAkL-0005kX-22 for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:30:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43986) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcl-0007nF-Jh for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAcj-00049t-87 for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:19 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43706 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAci-00047Z-MU for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:17 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHGQj078288 for ; Tue, 17 Sep 2019 06:22:11 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v2vd5btuv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:22:11 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:22:08 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:22:02 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALYCI31785400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:34 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0CF3A405C; Tue, 17 Sep 2019 10:22:00 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8258A4054; Tue, 17 Sep 2019 10:21:59 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:21:59 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:21:59 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0016-0000-0000-000002AD13D9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0017-0000-0000-0000330DB75D Message-Id: <156871571931.196432.3224017086971417625.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=578 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 14/17] ccid-card-emul: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@b06wcsmtp001.portsmouth.uk.ibm.com, David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- hw/usb/ccid-card-emulated.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 291e41db8a1e..3bc397341090 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -511,10 +511,13 @@ static void emulated_realize(CCIDCardState *base, Error **errp) } if (card->backend == 0) { - error_setg(errp, "backend must be one of:"); + Error *local_err = NULL; + + error_setg(&local_err, "backend must be one of:"); for (ptable = backend_enum_table; ptable->name != NULL; ++ptable) { - error_append_hint(errp, "%s\n", ptable->name); + error_append_hint(&local_err, "%s\n", ptable->name); } + error_propagate(errp, local_err); goto out2; } From patchwork Tue Sep 17 10:22:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Xfdj2kGmz9s00 for ; Tue, 17 Sep 2019 20:35:37 +1000 (AEST) Received: from localhost ([::1]:43788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAApa-0001Ed-9c for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:35:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44003) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcn-0007pS-0g for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAcl-0004Az-Se for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:20 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:26926) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAcl-0004AI-Hd for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:19 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAI58j035038 for ; Tue, 17 Sep 2019 06:22:17 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2v5vv6u0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:22:17 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:22:14 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:22:08 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HALf4Q33489282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:21:41 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E09CD52057; Tue, 17 Sep 2019 10:22:06 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id EFEA15204F; Tue, 17 Sep 2019 10:22:05 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:22:05 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0028-0000-0000-0000039E0EFB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0029-0000-0000-0000246087A4 Message-Id: <156871572566.196432.1432692745517580071.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=957 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 15/17] option: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av21.portsmouth.uk.ibm.com, David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr?= =?utf-8?b?w6k=?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- util/qemu-option.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index 97172b5eaa7f..2a45dfa585d4 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -155,11 +155,14 @@ void parse_option_size(const char *name, const char *value, return; } if (err) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, + Error *local_err = NULL; + + error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, name, "a non-negative number below 2^64"); - error_append_hint(errp, "Optional suffix k, M, G, T, P or E means" + error_append_hint(&local_err, "Optional suffix k, M, G, T, P or E means" " kilo-, mega-, giga-, tera-, peta-\n" "and exabytes, respectively.\n"); + error_propagate(errp, local_err); return; } *ret = size; @@ -664,10 +667,13 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, if (id) { if (!id_wellformed(id)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "id", + Error *local_err = NULL; + + error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "id", "an identifier"); - error_append_hint(errp, "Identifiers consist of letters, digits, " + error_append_hint(&local_err, "Identifiers consist of letters, digits, " "'-', '.', '_', starting with a letter.\n"); + error_propagate(errp, local_err); return NULL; } opts = qemu_opts_find(list, id); From patchwork Tue Sep 17 10:22:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Xftf2k5rz9s00 for ; Tue, 17 Sep 2019 20:46:50 +1000 (AEST) Received: from localhost ([::1]:43926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAB0S-0003dO-5h for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:46:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44037) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcs-0007wX-PF for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAcr-0004Gl-I0 for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53370 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAcr-0004GE-Aq for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:25 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHFVn027341 for ; Tue, 17 Sep 2019 06:22:24 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v2u286vdb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:22:24 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:22:22 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:22:15 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HAMDEn60686354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:22:13 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 505114C046; Tue, 17 Sep 2019 10:22:13 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4DDA64C04A; Tue, 17 Sep 2019 10:22:12 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:22:12 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:22:12 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0028-0000-0000-0000039E0EFE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0029-0000-0000-0000246087A7 Message-Id: <156871573191.196432.7298669690679178817.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=588 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 16/17] socket: Pass local error object pointer to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av22.portsmouth.uk.ibm.com, John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Ensure that hints are added even if errp is &error_fatal or &error_abort. Signed-off-by: Greg Kurz --- util/qemu-sockets.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 98ff3a1cce64..5da7b5f2fa0d 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -882,9 +882,12 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, pathlen = strlen(path); if (pathlen > sizeof(un.sun_path)) { - error_setg(errp, "UNIX socket path '%s' is too long", path); - error_append_hint(errp, "Path must be less than %zu bytes\n", + Error *local_err = NULL; + + error_setg(&local_err, "UNIX socket path '%s' is too long", path); + error_append_hint(&local_err, "Path must be less than %zu bytes\n", sizeof(un.sun_path)); + error_propagate(errp, local_err); goto err; } @@ -952,9 +955,12 @@ static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp) pathlen = strlen(saddr->path); if (pathlen > sizeof(un.sun_path)) { - error_setg(errp, "UNIX socket path '%s' is too long", saddr->path); - error_append_hint(errp, "Path must be less than %zu bytes\n", + Error *local_err = NULL; + + error_setg(&local_err, "UNIX socket path '%s' is too long", saddr->path); + error_append_hint(&local_err, "Path must be less than %zu bytes\n", sizeof(un.sun_path)); + error_propagate(errp, local_err); goto err; } From patchwork Tue Sep 17 10:22:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1163294 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Xfk0291Cz9s00 for ; Tue, 17 Sep 2019 20:39:20 +1000 (AEST) Received: from localhost ([::1]:43852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAtB-00057P-Uj for incoming@patchwork.ozlabs.org; Tue, 17 Sep 2019 06:39:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44059) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAAcy-00085H-3f for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAAcx-0004Ny-00 for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:17940 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAAcw-0004NM-QR for qemu-devel@nongnu.org; Tue, 17 Sep 2019 06:22:30 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8HAHlL0103506 for ; Tue, 17 Sep 2019 06:22:30 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v2tk275js-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 17 Sep 2019 06:22:30 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 11:22:27 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 11:22:21 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8HAMJ9e46662000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 10:22:19 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ACB81A4040; Tue, 17 Sep 2019 10:22:19 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ABAAEA4053; Tue, 17 Sep 2019 10:22:18 +0000 (GMT) Received: from bahia.lan (unknown [9.145.22.84]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 10:22:18 +0000 (GMT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 17 Sep 2019 12:22:18 +0200 In-Reply-To: <156871562997.196432.17776290406203122029.stgit@bahia.lan> References: <156871562997.196432.17776290406203122029.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19091710-0028-0000-0000-0000039E0F00 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091710-0029-0000-0000-0000246087A9 Message-Id: <156871573833.196432.7906362695920387537.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-17_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=445 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170106 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 17/17] checkpatch: Warn when errp is passed to error_append_hint() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jeff Cody , "Daniel P. =?utf-8?q?Berrang=C3=A9=22?= , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org"@d06av23.portsmouth.uk.ibm.com, Mark Cave-Ayland , Michael Roth , Gerd Hoffmann , Subbaraya Sundeep , Juan Quintela , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , David Gibson , Eric Farman , "Dr. David Alan Gilbert" , Yuval Shaia , Alex Williamson , John Snow , Richard Henderson , Kevin Wolf , Cornelia Huck , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Passing errp from the argument list to error_append_hint() isn't recommended because it may cause unwanted behaviours when errp is equal to &error_fatal or &error_abort. First, error_append_hint() aborts QEMU when passed either of those. Second, consider the following: void foo(Error **errp) { error_setg(errp, "foo"); error_append_hint(errp, "Try bar\n"); } error_setg() causes QEMU to exit or abort, and hints aren't added. Signed-off-by: Greg Kurz Reviewed-by: Philippe Mathieu-Daudé --- scripts/checkpatch.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index aa9a354a0e7e..17ce026282a6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2902,6 +2902,10 @@ sub process { } } + if ($line =~ /error_append_hint\(errp/) { + WARN("suspicious errp passed to error_append_hint()\n" . + $herecurr); + } # check for non-portable libc calls that have portable alternatives in QEMU if ($line =~ /\bffs\(/) { ERROR("use ctz32() instead of ffs()\n" . $herecurr);