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: 117042 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp628290qgn; Wed, 25 Oct 2017 02:29:27 -0700 (PDT) X-Google-Smtp-Source: ABhQp+R1iZADKPHjn6WXerJjXBRpTiD0A1axYNz/33i6aUmF+o8Sdqux03eqz00xv1scyV0+f6cl X-Received: by 10.36.82.1 with SMTP id d1mr1138666itb.115.1508923767015; Wed, 25 Oct 2017 02:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508923767; cv=none; d=google.com; s=arc-20160816; b=DD1S5UJsbWJFX0680N2Mrnb02ng63z18nQzqKP+jJLxeqTAiNrSqpszoTLygY1l621 YkM+b+J8zpimiDXCNFP05T61pqD+0NS+xtgv4eK+9+iMT58q40hxJCKnOD8hK9dTk93y z53YvS+f4aeKV3v+0ll2WpY3Uha3tV0a5ypkR5ammEJ2Seozw6j1QIN6PCROMT3KbFGU EoloXHbvPgoZRl04HUIvMv2/848B7E5ZiGUcKSiabmjsU4J3LqPNFDOuelxaptIAYd8Q 45+QNikgXi9mxUq2PE846iRkKuXHDwHietHJsu51RUCL5ls7HVR26X+4P7QakbtwxUM7 4KWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=ugYpCKrgjb9Hr6jN7on7unEhDhx4Ld+g+H4ygPhydw8=; b=vO13NXATCUD5jYOF+CRDV7yrzf2zen2OGu3SDK5M15D3MzgkiuBkQ8Td2G3TjnULF2 yacnEQCEhSdcbd5b9n1Xz0jdPtnbMBOAZXJ12Zk6kFI751fW5E/yTSKf9MYUa3jVWthh zbqsu+qpKN5hKAs0xx43tssFt1XsbqcAHBrL0VZRxfizHb9w6gzLTsLmXjA6SAFVM6mM FTmBbHUx1jYejhX0z75e60Sg1cl3E4aSsCJrSBcHqpAi+rdKJEChan8mlxNWpCsHnVX8 MoyUZKhnvBHjWCS0GSiaacf4ZjGC/adwRpXRhPXR/EtMaCQjcxzO0s3GNiZlpqYhv2sR xc+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CRwwJKLH; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id g206si1609056iof.114.2017.10.25.02.29.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 02:29:27 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CRwwJKLH; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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-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" 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;