From patchwork Wed Oct 25 09:27:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 10026197 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 7A70F60596 for ; Wed, 25 Oct 2017 09:29:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EF65251F9 for ; Wed, 25 Oct 2017 09:29:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 536E7269B2; Wed, 25 Oct 2017 09:29: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=-0.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=no 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 E1F6A26E1A for ; Wed, 25 Oct 2017 09:29:43 +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 1e7HyF-0003ft-81; Wed, 25 Oct 2017 09:27:31 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7HyD-0003fd-Qn for xen-devel@lists.xenproject.org; Wed, 25 Oct 2017 09:27:29 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id 2C/D6-16147-10950F95; Wed, 25 Oct 2017 09:27:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTAQd3/ER8 iDZZdErP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDM+nmpgKdgpVLHx1F62Bsaz/F2MnBxCAjMZ JS5Ncexi5OJgEZjHLNG0+g4LiCMh0M8qMXH7RyaQKgmBPIk592awdjFyANlpEh+6uCDCZRIf/ l9lhxikJXH01GxWkF4hgRYmiaV3rrGA1LMJmEjM6pAAqRERUJK4t2oyE0gNs8B8RommSb1sIA lhgQiJ63dXgw1iEVCVOH3vDiOIzSvgLXH2wgVmiGVyEjfPdYLZnAI+Ep9uTmaCWOwtceXbAsY JjIILGBlWMWoUpxaVpRbpGlnoJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEBlw9 AwPjDsb2E36HGCU5mJREecM9PkQK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuB9Gg6UEyxKTU+tS MvMAYY+TFqCg0dJhPcVSJq3uCAxtzgzHSJ1itGe48KdS3+YOA7suQUkO27eBZLPZr5uYBZiyc vPS5US590P0iYA0pZRmgc3FBarlxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ8x4EmcKTmVc Ct/sV0FlMQGc1qYKdVZKIkJJqYJwp4JjO2J0rqT2B7+zvz3M2+HQZtyw6nCYg22Ny/cxBHo+W 7YVhiUV7HNJ1pn93nN34JXnhB8HoD9VzjtoI3q0KMVsvVZZe+1TQNTDuqvIZl9qEwFzuO1nMx 6s+ccSbrlwimVTJaHblP5vmjucs81+73lkZw9JkmX3m8ZzzLvVhu25VWNRsUGIpzkg01GIuKk 4EAB1WTtHQAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1508923646!56393991!1 X-Originating-IP: [209.85.192.193] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13269 invoked from network); 25 Oct 2017 09:27:27 -0000 Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Oct 2017 09:27:27 -0000 Received: by mail-pf0-f193.google.com with SMTP id 17so21798043pfn.12 for ; Wed, 25 Oct 2017 02:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SyQksW2D8oFECzaokhim+H3sKygwwsidoIodYalb1+4=; b=CRwwJKLHKulswwzswgh5PUSWVSBWlPUvOnjkPJUfGd50/HVPgmVL03XSle0YgmtyyB vPg95mTW5bBbyc073IX+UysesHhzcC+ezfXMasPhRne6dJf0lNamB7wkWz8pmpQh1syv C6XzeiHyzVP+OW1cKjQIC1aAPyx8evJBXQSQk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SyQksW2D8oFECzaokhim+H3sKygwwsidoIodYalb1+4=; b=h8VRBQYUQNny+5NNte83GVFWjKopM7ZuVUSaExTupddup/eyFJiAxpEkBJmFYpsSdt CBUla08Rgl0OVMyuDqoh58OQ+PkBNhRZA1wF7cPx4mOMy2A8eohlg8RF5SbuMcUC8RV7 Hv/mRlLZh/zjIs8NQgJpvw0zKb0vaJoZ3yVkzXIi4z9lftZwojXLT6LscFSmGOJkmlZw jFKrmQ1Bux6rWreRxjgt0VnWjGhwbxHu0lpbIqGdOKEyAW2B1O7G/YnhRlx+4bl1BENa x/YsTu3nW36/cv6wsls6He0zEoIUIuclkhw+uVXF8MPTGEMNvkejllTAtukBHpKvtnT7 Mc/g== X-Gm-Message-State: AMCzsaWPgv28zoM4VHl5YVRZwVlMFMno9pGoe128eNz3QDygmSSQBLT1 ctOckvsnLbtYzwELbFiSh4H801JTAKI= X-Google-Smtp-Source: ABhQp+RBanNvx3fMU+CzUAqyAELjRWTRrBSc3rQKHKc4nGm+KDJx+moTfMfwKy89mTIUjc3xCNducQ== X-Received: by 10.84.224.1 with SMTP id r1mr1225525plj.65.1508923645644; Wed, 25 Oct 2017 02:27:25 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id m17sm4022861pfh.28.2017.10.25.02.27.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:27:25 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 25 Oct 2017 14:57:08 +0530 Message-Id: <1508923628-26446-5-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> References: <1508923628-26446-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 5/5 v2] xenconsole: Define and use a macro XEN_INVALID_PFN instead of -1 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP xenconsole will use a new macro XEN_INVALID_PFN instead of -1 for initializing ring-ref. Signed-off-by: Bhupinder Thakur --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall This patch is as per the review of commit fa1f157 libxl: Fix the bug introduced in commit "libxl: use correct type tools/console/daemon/io.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 1839973..aa291db 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -62,6 +62,8 @@ /* Duration of each time period in ms */ #define RATE_LIMIT_PERIOD 200 +#define XEN_INVALID_PFN (~(xen_pfn_t)0) + extern int log_reload; extern int log_guest; extern int log_hv; @@ -658,12 +660,12 @@ static void console_unmap_interface(struct console *con) { if (con->interface == NULL) return; - if (xgt_handle && con->ring_ref == -1) + if (xgt_handle && con->ring_ref == XEN_INVALID_PFN) xengnttab_unmap(xgt_handle, con->interface, 1); else munmap(con->interface, XC_PAGE_SIZE); con->interface = NULL; - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; } static int console_create_ring(struct console *con) @@ -698,7 +700,7 @@ static int console_create_ring(struct console *con) free(type); /* If using ring_ref and it has changed, remap */ - if (ring_ref != con->ring_ref && con->ring_ref != -1) + if (ring_ref != con->ring_ref && con->ring_ref != XEN_INVALID_PFN) console_unmap_interface(con); if (!con->interface && xgt_handle && con->use_gnttab) { @@ -706,7 +708,7 @@ static int console_create_ring(struct console *con) con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, PROT_READ|PROT_WRITE); - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; } if (!con->interface) { /* Fall back to xc_map_foreign_range */ @@ -812,7 +814,7 @@ static int console_init(struct console *con, struct domain *dom, void **data) con->master_pollfd_idx = -1; con->slave_fd = -1; con->log_fd = -1; - con->ring_ref = -1; + con->ring_ref = XEN_INVALID_PFN; con->local_port = -1; con->remote_port = -1; con->xce_pollfd_idx = -1;