From patchwork Wed Oct 11 11:01:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9999313 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 1F988602BF for ; Wed, 11 Oct 2017 11:03:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06A5A289F2 for ; Wed, 11 Oct 2017 11:03:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBDE4289F4; Wed, 11 Oct 2017 11:03:52 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1E0BE289F2 for ; Wed, 11 Oct 2017 11:03:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2ElW-0003Pt-6E; Wed, 11 Oct 2017 11:01:30 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2ElV-0003PL-1z for xen-devel@lists.xen.org; Wed, 11 Oct 2017 11:01:29 +0000 Received: from [85.158.143.35] by server-7.bemta-6.messagelabs.com id 43/9E-25852-80AFDD95; Wed, 11 Oct 2017 11:01:28 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRWlGSWpSXmKPExsXitHRDpC7rr7u RBg8XWVgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmXzs1iLDgoXDHj1nrWBsbzfF2MnBwSAv4S q9ZdZQWxWQRUJZ5ufwJmswkoS/zs7GUDsUUEdCWeLXgGZHNxMAtMY5S43L6ZCSQhLGAtsfH5O 7AiXgELiVvPToHFhQQ8JDau/sgEEReUODnzCQuIzSygI7Fg9yegeg4gW1pi+T8OkDCngKfE8f V9YHtFBVQkOpfOYYEYoyDRMf0Y0wRGvllIJs1CMmkWwqQFjMyrGNWLU4vKUot0zfWSijLTM0p yEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQIDjQEIdjDOvOx/iFGSg0lJlPf687uRQnxJ+SmV GYnFGfFFpTmpxYcYZTg4lCR4rX8C5QSLUtNTK9Iyc4AhD5OW4OBREuF1BUnzFhck5hZnpkOkT jEqSonz7vwBlBAASWSU5sG1weLsEqOslDAvI9AhQjwFqUW5mSWo8q8YxTkYlYR5o0DG82Tmlc BNfwW0mAlosWjaHZDFJYkIKakGxkU7lvhcY1rUnmSu17n4lupWGz4XCemtpyefe+7I+HaV29e VHou6V8TuEXl+jDPHtPNk8p2/n3YdU5dbr7v+zvJuzUmPYx1NZhZmOKneNu1ktH6ybdXxtglz A60f9b/W3dl4RXxq7ZMpE2YqO7ZPjzwu8EDT1NBU4Pj0+Ak9y/LfzZbhuMQtdEeJpTgj0VCLu ag4EQDuOUZjrgIAAA== X-Env-Sender: prvs=450355d75=wei.liu2@citrix.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1507719684!64688066!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20688 invoked from network); 11 Oct 2017 11:01:25 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 11 Oct 2017 11:01:25 -0000 X-IronPort-AV: E=Sophos;i="5.43,361,1503360000"; d="scan'208";a="445403845" Date: Wed, 11 Oct 2017 12:01:22 +0100 From: Wei Liu To: Andrew Cooper Message-ID: <20171011110122.h3aofwffvzmzo2ul@citrix.com> References: <1507316400-5169-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1507316400-5169-1-git-send-email-andrew.cooper3@citrix.com> User-Agent: NeoMutt/20170113 (1.7.2) Cc: Wei Liu , Julien Grall , Ian Jackson , Xen-devel Subject: Re: [Xen-devel] [PATCH] tools/libxc: Fix domid parameter types X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Oct 06, 2017 at 08:00:00PM +0100, Andrew Cooper wrote: > Mixed throughout libxc are uint32_t, int, and domid_t for domid parameters. > With a signed type, and an explicitly 16-bit type, it is exceedingly difficult > to construct an INVALID_DOMID constant which works with all of them. (The > main problem being that domid_t gets unconditionally zero extended when > promoted to int for arithmatic.) > > Libxl uses uint32_t consistently everywhere, so alter libxc to match. > The following diff is required: diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c index 194bbdbc5d..6487672277 100644 --- a/tools/libxl/libxl_dom_save.c +++ b/tools/libxl/libxl_dom_save.c @@ -149,7 +149,7 @@ static void domain_suspend_switch_qemu_logdirty_done } void libxl__domain_suspend_common_switch_qemu_logdirty - (int domid, unsigned enable, void *user) + (uint32_t domid, unsigned enable, void *user) { libxl__save_helper_state *shs = user; libxl__egc *egc = shs->egc; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index bcb6b0ae95..70a1e6e915 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3793,7 +3793,7 @@ void libxl__xc_domain_saverestore_async_callback_done(libxl__egc *egc, _hidden void libxl__domain_suspend_common_switch_qemu_logdirty - (int domid, unsigned int enable, void *data); + (uint32_t domid, unsigned int enable, void *data); _hidden void libxl__domain_common_switch_qemu_logdirty(libxl__egc *egc, int domid, unsigned enable, libxl__logdirty_switch *lds); diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl index 3ae7373afc..cba7a30e4c 100755 --- a/tools/libxl/libxl_save_msgs_gen.pl +++ b/tools/libxl/libxl_save_msgs_gen.pl @@ -27,7 +27,7 @@ our @msgs = ( [ 4, 'srcxA', "postcopy", [] ], [ 5, 'srcxA', "checkpoint", [] ], [ 6, 'srcxA', "wait_checkpoint", [] ], - [ 7, 'scxA', "switch_qemu_logdirty", [qw(int domid + [ 7, 'scxA', "switch_qemu_logdirty", [qw(uint32_t domid unsigned enable)] ], [ 8, 'rcx', "restore_results", ['xen_pfn_t', 'store_gfn', 'xen_pfn_t', 'console_gfn'] ],