From patchwork Tue Nov 15 10:18:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9429359 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 1CD0460469 for ; Tue, 15 Nov 2016 10:22:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04F22286B9 for ; Tue, 15 Nov 2016 10:22:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDF0E286CD; Tue, 15 Nov 2016 10:22:20 +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 78673286B9 for ; Tue, 15 Nov 2016 10:22:20 +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 1c6aqc-0005j7-4l; Tue, 15 Nov 2016 10:20:14 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6aqa-0005bK-6D for xen-devel@lists.xen.org; Tue, 15 Nov 2016 10:20:12 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 07/7D-18083-B51EA285; Tue, 15 Nov 2016 10:20:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsVyuP0uq27UQ60 Ig3VXjS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1owdK9YwFuyzqnjxbwN7A+MD7S5GLg4hgSWM EkfWbWXuYuTkYBOwl+j6c5QJxBYRkJa49vkyI0gRs8AJRomejZvZQBLCAm4SMy9fYwexWQRUJ Z4c/gsW5xWwlHi+cw/YIAkBeYkLV0+xgNicQPGfR5+C1QsJWEgsudzNDFEvKHFy5hOgGg6gBe oS6+cJgYSZgVqbt85mnsDIOwtJ1SyEqllIqhYwMq9i1ChOLSpLLdI1NNRLKspMzyjJTczM0TU 0MNPLTS0uTkxPzUlMKtZLzs/dxAgMKgYg2MH4aVnAIUZJDiYlUV6h1VoRQnxJ+SmVGYnFGfFF pTmpxYcYZTg4lCR4FR4A5QSLUtNTK9Iyc4DhDZOW4OBREuFdcR8ozVtckJhbnJkOkTrFqCglz vsUJCEAksgozYNrg8XUJUZZKWFeRqBDhHgKUotyM0tQ5V8xinMwKgnzaoBs58nMK4Gb/gpoMR PQ4l3mGiCLSxIRUlINjDXT87b1JVz6/9q7+uefoNmhopoOJc+TYtxfJsfksV/fOktlu0B+rtC xj9xZ/N9W/7790OL739mC+07OLv+0c+fSTZySzz0mv5Q6MLdwmXz6Sr4+k9s8fVuj2UvvT7NV 5ys7t8HGNT705Q/Nj5ddPi2edrRrenrnsf4fWrpOsWWtrFNZ1fY3f1RiKc5INNRiLipOBABQJ jP5pAIAAA== X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1479205210!43384283!1 X-Originating-IP: [195.135.221.5] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43844 invoked from network); 15 Nov 2016 10:20:10 -0000 Received: from smtp.nue.novell.com (HELO smtp.nue.novell.com) (195.135.221.5) by server-7.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Nov 2016 10:20:10 -0000 Received: from laptop.vms (mhy71-2-88-167-63-197.fbx.proxad.net [88.167.63.197]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 15 Nov 2016 11:20:06 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Tue, 15 Nov 2016 11:18:55 +0100 Message-Id: <20161115101913.10396-18-cbosdonnat@suse.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161115101913.10396-1-cbosdonnat@suse.com> References: <20161115101913.10396-1-cbosdonnat@suse.com> MIME-Version: 1.0 Cc: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= , Wei Liu , Ian Jackson , =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Subject: [Xen-devel] [PATCH 17/35] libxl/libxl_dom_suspend.c: used LOG*D functions 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 From: Cédric Bosdonnat Use LOG*D logging functions where possible instead of the LOG* ones. Signed-off-by: Cédric Bosdonnat --- tools/libxl/libxl_dom_suspend.c | 45 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/tools/libxl/libxl_dom_suspend.c b/tools/libxl/libxl_dom_suspend.c index 0648919..d258a1c 100644 --- a/tools/libxl/libxl_dom_suspend.c +++ b/tools/libxl/libxl_dom_suspend.c @@ -54,7 +54,7 @@ int libxl__domain_suspend_init(libxl__egc *egc, domid, port, &dsps->guest_evtchn_lockfd); if (dsps->guest_evtchn.port < 0) { - LOG(WARN, "Suspend event channel initialization failed"); + LOGD(WARN, domid, "Suspend event channel initialization failed"); rc = ERROR_FAIL; goto out; } @@ -77,7 +77,7 @@ int libxl__domain_suspend_device_model(libxl__gc *gc, switch (libxl__device_model_version_running(gc, domid)) { case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: { - LOG(DEBUG, "Saving device model state to %s", filename); + LOGD(DEBUG, domid, "Saving device model state to %s", filename); libxl__qemu_traditional_cmd(gc, domid, "save"); libxl__wait_for_device_model_deprecated(gc, domid, "paused", NULL, NULL, NULL); break; @@ -154,11 +154,11 @@ static void domain_suspend_callback_common(libxl__egc *egc, } if ((hvm_s_state == 0) && (dsps->guest_evtchn.port >= 0)) { - LOG(DEBUG, "issuing %s suspend request via event channel", + LOGD(DEBUG, domid, "issuing %s suspend request via event channel", dsps->type == LIBXL_DOMAIN_TYPE_HVM ? "PVHVM" : "PV"); ret = xenevtchn_notify(CTX->xce, dsps->guest_evtchn.port); if (ret < 0) { - LOG(ERROR, "xenevtchn_notify failed ret=%d", ret); + LOGD(ERROR, domid, "xenevtchn_notify failed ret=%d", ret); rc = ERROR_FAIL; goto err; } @@ -176,10 +176,10 @@ static void domain_suspend_callback_common(libxl__egc *egc, } if (dsps->type == LIBXL_DOMAIN_TYPE_HVM && (!hvm_pvdrv || hvm_s_state)) { - LOG(DEBUG, "Calling xc_domain_shutdown on HVM domain"); + LOGD(DEBUG, domid, "Calling xc_domain_shutdown on HVM domain"); ret = xc_domain_shutdown(CTX->xch, domid, SHUTDOWN_suspend); if (ret < 0) { - LOGE(ERROR, "xc_domain_shutdown failed"); + LOGED(ERROR, domid, "xc_domain_shutdown failed"); rc = ERROR_FAIL; goto err; } @@ -189,7 +189,7 @@ static void domain_suspend_callback_common(libxl__egc *egc, return; } - LOG(DEBUG, "issuing %s suspend request via XenBus control node", + LOGD(DEBUG, domid, "issuing %s suspend request via XenBus control node", dsps->type == LIBXL_DOMAIN_TYPE_HVM ? "PVHVM" : "PV"); libxl__domain_pvcontrol_write(gc, XBT_NULL, domid, "suspend"); @@ -260,8 +260,8 @@ static void domain_suspend_common_pvcontrol_suspending(libxl__egc *egc, rc = libxl__xs_transaction_commit(gc, &t); if (!rc) { - LOG(ERROR, - "guest didn't acknowledge suspend, cancelling request"); + LOGD(ERROR, dsps->domid, + "guest didn't acknowledge suspend, cancelling request"); goto err; } if (rc<0) goto err; @@ -272,7 +272,7 @@ static void domain_suspend_common_pvcontrol_suspending(libxl__egc *egc, } assert(domain_suspend_pvcontrol_acked(state)); - LOG(DEBUG, "guest acknowledged suspend request"); + LOGD(DEBUG, dsps->domid, "guest acknowledged suspend request"); libxl__xs_transaction_abort(gc, &t); dsps->guest_responded = 1; @@ -291,7 +291,7 @@ static void domain_suspend_common_wait_guest(libxl__egc *egc, STATE_AO_GC(dsps->ao); int rc; - LOG(DEBUG, "wait for the guest to suspend"); + LOGD(DEBUG, dsps->domid, "wait for the guest to suspend"); rc = libxl__ev_xswatch_register(gc, &dsps->guest_watch, suspend_common_wait_guest_watch, @@ -328,13 +328,12 @@ static void suspend_common_wait_guest_check(libxl__egc *egc, ret = xc_domain_getinfolist(CTX->xch, domid, 1, &info); if (ret < 0) { - LOGE(ERROR, "unable to check for status of guest %"PRId32"", domid); + LOGED(ERROR, domid, "unable to check for status of guest"); goto err; } if (!(ret == 1 && info.domain == domid)) { - LOGE(ERROR, "guest %"PRId32" we were suspending has been destroyed", - domid); + LOGED(ERROR, domid, "guest we were suspending has been destroyed"); goto err; } @@ -345,12 +344,12 @@ static void suspend_common_wait_guest_check(libxl__egc *egc, shutdown_reason = (info.flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask; if (shutdown_reason != SHUTDOWN_suspend) { - LOG(DEBUG, "guest %"PRId32" we were suspending has shut down" - " with unexpected reason code %d", domid, shutdown_reason); + LOGD(DEBUG, domid, "guest we were suspending has shut down" + " with unexpected reason code %d", shutdown_reason); goto err; } - LOG(DEBUG, "guest has suspended"); + LOGD(DEBUG, domid, "guest has suspended"); domain_suspend_common_guest_suspended(egc, dsps); return; @@ -364,7 +363,7 @@ static void suspend_common_wait_guest_timeout(libxl__egc *egc, libxl__domain_suspend_state *dsps = CONTAINER_OF(ev, *dsps, guest_timeout); STATE_AO_GC(dsps->ao); if (rc == ERROR_TIMEDOUT) { - LOG(ERROR, "guest did not suspend, timed out"); + LOGD(ERROR, dsps->domid, "guest did not suspend, timed out"); rc = ERROR_GUEST_TIMEDOUT; } domain_suspend_common_done(egc, dsps, rc); @@ -383,7 +382,8 @@ static void domain_suspend_common_guest_suspended(libxl__egc *egc, if (dsps->type == LIBXL_DOMAIN_TYPE_HVM) { rc = libxl__domain_suspend_device_model(gc, dsps); if (rc) { - LOG(ERROR, "libxl__domain_suspend_device_model failed ret=%d", rc); + LOGD(ERROR, dsps->domid, + "libxl__domain_suspend_device_model failed ret=%d", rc); domain_suspend_common_done(egc, dsps, rc); return; } @@ -457,7 +457,7 @@ int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int suspend_cancel) int rc = 0; if (xc_domain_resume(CTX->xch, domid, suspend_cancel)) { - LOGE(ERROR, "xc_domain_resume failed for domain %u", domid); + LOGED(ERROR, domid, "xc_domain_resume failed"); rc = ERROR_FAIL; goto out; } @@ -471,14 +471,13 @@ int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int suspend_cancel) if (type == LIBXL_DOMAIN_TYPE_HVM) { rc = libxl__domain_resume_device_model(gc, domid); if (rc) { - LOG(ERROR, "failed to resume device model for domain %u:%d", - domid, rc); + LOGD(ERROR, domid, "failed to resume device model:%d", rc); goto out; } } if (!xs_resume_domain(CTX->xsh, domid)) { - LOGE(ERROR, "xs_resume_domain failed for domain %u", domid); + LOGED(ERROR, domid, "xs_resume_domain failed"); rc = ERROR_FAIL; } out: