From patchwork Tue Jun 6 16:55:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Halil Pasic X-Patchwork-Id: 9769275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A399D60364 for ; Tue, 6 Jun 2017 16:56:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A351825223 for ; Tue, 6 Jun 2017 16:56:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97C8527C05; Tue, 6 Jun 2017 16:56:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1DC3625223 for ; Tue, 6 Jun 2017 16:56:43 +0000 (UTC) Received: from localhost ([::1]:39341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIHmd-0001XV-2b for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Jun 2017 12:56:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIHlV-0001WD-Bf for qemu-devel@nongnu.org; Tue, 06 Jun 2017 12:55:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIHlR-0006NL-Di for qemu-devel@nongnu.org; Tue, 06 Jun 2017 12:55:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48765 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 1dIHlR-0006NB-7G for qemu-devel@nongnu.org; Tue, 06 Jun 2017 12:55:29 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v56Gs8jo076784 for ; Tue, 6 Jun 2017 12:55:28 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2awx18yp9q-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 06 Jun 2017 12:55:28 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 Jun 2017 17:55:26 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 6 Jun 2017 17:55:24 +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 v56GtOfU1180138; Tue, 6 Jun 2017 16:55:24 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BA8624C044; Tue, 6 Jun 2017 17:53:44 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 878304C046; Tue, 6 Jun 2017 17:53:44 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 6 Jun 2017 17:53:44 +0100 (BST) From: Halil Pasic To: "Dr. David Alan Gilbert" Date: Tue, 6 Jun 2017 18:55:09 +0200 X-Mailer: git-send-email 2.11.2 In-Reply-To: <20170606165510.33057-1-pasic@linux.vnet.ibm.com> References: <20170606165510.33057-1-pasic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17060616-0040-0000-0000-000003C30F10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060616-0041-0000-0000-0000205AE153 Message-Id: <20170606165510.33057-3-pasic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-06_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706060291 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [RFC PATCH 2/3] vmstate: error hint for failed equal checks part 2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Borntraeger , Halil Pasic , qemu-devel@nongnu.org, "Jason J . Herne" , Juan Quintela Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Verbose error reporting for the _EQUAL family. Modify the standard _EQUAL so the hint states the assertion probably failed due to a bug. Introduce _EQUAL_HINT for specifying a context specific hint. Signed-off-by: Halil Pasic --- Keeping this separate for now because we may want something different here. E.g. no new macros and adding an extra NULL parameter for all pre-existing _EQUAL usages. --- include/migration/vmstate.h | 54 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index d90d9b12ca..ed1e1fd047 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -302,6 +302,18 @@ extern const VMStateInfo vmstate_info_qtailq; .offset = vmstate_offset_value(_state, _field, _type), \ } +#define VMSTATE_SINGLE_FULL(_field, _state, _test, _version, _info, \ + _type, _err_hint) { \ + .name = (stringify(_field)), \ + .err_hint = (_err_hint), \ + .version_id = (_version), \ + .field_exists = (_test), \ + .size = sizeof(_type), \ + .info = &(_info), \ + .flags = VMS_SINGLE, \ + .offset = vmstate_offset_value(_state, _field, _type), \ +} + /* Validate state using a boolean predicate. */ #define VMSTATE_VALIDATE(_name, _test) { \ .name = (_name), \ @@ -808,30 +820,60 @@ extern const VMStateInfo vmstate_info_qtailq; #define VMSTATE_UINT64(_f, _s) \ VMSTATE_UINT64_V(_f, _s, 0) +#define VMSTATE_UINT8_EQUAL_HINT(_f, _s, _err_hint) \ + VMSTATE_SINGLE_FULL(_f, _s, NULL, 0, vmstate_info_uint8_equal, \ + uint8_t, _err_hint) + #define VMSTATE_UINT8_EQUAL(_f, _s) \ - VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t) + VMSTATE_UINT8_EQUAL_HINT(_f, _s, "Bug!?") + +#define VMSTATE_UINT16_EQUAL_HINT(_f, _s, _err_hint) \ + VMSTATE_SINGLE_FULL(_f, _s, NULL, 0, vmstate_info_uint16_equal, \ + uint16_t, _err_hint) #define VMSTATE_UINT16_EQUAL(_f, _s) \ - VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint16_equal, uint16_t) + VMSTATE_UINT16_EQUAL_HINT(_f, _s, "Bug!?") + +#define VMSTATE_UINT16_EQUAL_V_HINT(_f, _s, _v, _err_hint) \ + VMSTATE_SINGLE_FULL(_f, _s, NULL, _v, vmstate_info_uint16_equal, \ + uint16_t, _err_hint) #define VMSTATE_UINT16_EQUAL_V(_f, _s, _v) \ - VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16_equal, uint16_t) + VMSTATE_UINT16_EQUAL_V_HINT(_f, _s, _v, "Bug!?") + +#define VMSTATE_INT32_EQUAL_HINT(_f, _s, _err_hint) \ + VMSTATE_SINGLE_FULL(_f, _s, NULL, 0, vmstate_info_int32_equal, \ + int32_t, _err_hint) #define VMSTATE_INT32_EQUAL(_f, _s) \ - VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t) + VMSTATE_INT32_EQUAL_HINT(_f, _s, "Bug!?") + +#define VMSTATE_UINT32_EQUAL_V_HINT(_f, _s, _v, _err_hint) \ + VMSTATE_SINGLE_FULL(_f, _s, NULL, _v, vmstate_info_uint32_equal, \ + uint32_t, _err_hint) #define VMSTATE_UINT32_EQUAL_V(_f, _s, _v) \ - VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32_equal, uint32_t) + VMSTATE_UINT32_EQUAL_V_HINT(_f, _s, _v, "Bug!?") #define VMSTATE_UINT32_EQUAL(_f, _s) \ VMSTATE_UINT32_EQUAL_V(_f, _s, 0) +#define VMSTATE_UINT32_EQUAL_HINT(_f, _s, _err_hint) \ + VMSTATE_UINT32_EQUAL_V_HINT(_f, _s, 0, _err_hint) + +#define VMSTATE_UINT64_EQUAL_V_HINT(_f, _s, _v, _err_hint) \ + VMSTATE_SINGLE_FULL(_f, _s, NULL, _v, vmstate_info_int64_equal, \ + uint64_t, _err_hint) + #define VMSTATE_UINT64_EQUAL_V(_f, _s, _v) \ - VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64_equal, uint64_t) + VMSTATE_UINT64_EQUAL_V_HINT(_f, _s, _v, "Bug!?") #define VMSTATE_UINT64_EQUAL(_f, _s) \ VMSTATE_UINT64_EQUAL_V(_f, _s, 0) +#define VMSTATE_UINT64_EQUAL_HINT(_f, _s, _err_hint) \ + VMSTATE_UINT64_EQUAL_V_HINT(_f, _s, 0, _err_hint) + #define VMSTATE_INT32_POSITIVE_LE(_f, _s) \ VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)