From patchwork Mon Aug 28 08:55:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 111103 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4547869qge; Mon, 28 Aug 2017 01:58:36 -0700 (PDT) X-Received: by 10.107.158.6 with SMTP id h6mr4986005ioe.232.1503910716801; Mon, 28 Aug 2017 01:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503910716; cv=none; d=google.com; s=arc-20160816; b=XTDzx2Di7UkTQBxqO/Nlb9UgIi4HrGupk3F8oPt4z8SeLQ3uJrzSXoL66QyCkvvihO K7VcgLmhZkof09ZxfuDA8APzW8mutKlaz5RfIuHu4Bcb8bcxRcqupgdV7GOqqCP9H1U8 pvA8zopb42Yqq8nkJ89TuCh4pbIJQ8eogWQ4n+zTFYwc+6t0kDCyC4PuffYRqlsPCsjr 3JCoSJOKflLeiYUt8g+qWCRijFYjm3leRHzhMtCOVa7ecBsleiJxeD4+gLmxWlyIB/c3 UB/UsPKCpbGiIVOWHKDnOYdhnpaT5fBCEWntTy8/dVJ0QWQ3aM3M8SQIMmcpMMyu6mHR 27cw== 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=GCwa/gkQ+E7SKoiInGs++cf6PNAtsj+M23Bj3i/wbxA=; b=ThW9PkY6iCxiKmIY7KzdaqBqhlS8F15Pm26wkX8sXMKI1JZgU6vqr4PEDIfct2p2GP 8UBJxCyh8fY3NaOl2IreU8YU1q6PuQ9E9oChqJMe/QOl5W9cO1cSClWOl+aI04XWfk85 KBkGNSoLm9VLp6Z6EbHz08KLgnN7MDtEgxkxFXrjrNYOeMkq5aW2AkNa1WPXfTxzG5Ec VjBVneLVyKq9XT2tb+KmRqp4axtvZSgFF5ToewnYJi0jpU4dUm/8XVjqbUJIGvXKsUJd ixdJuMKH24f9E8fg77SRP5ywuZihLmIghfcNVV9Xdo1dfJvzF1hhmBbiWNpfADIlsGvH KhjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Tq5bRn1p; 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 i184si3663238itc.49.2017.08.28.01.58.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 01:58:36 -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=Tq5bRn1p; 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 1dmFr8-0005I0-1A; Mon, 28 Aug 2017 08:57:14 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFr7-0005Gc-Ex for xen-devel@lists.xenproject.org; Mon, 28 Aug 2017 08:57:13 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id D8/CD-01736-8EAD3A95; Mon, 28 Aug 2017 08:57:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHIsWRWlGSWpSXmKPExsXiVRusr/vi1uJ IgxNzBSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owLm3QLJotX7P/Qy9jA+FOoi5GLQ0hgJqPE yquP2EAcFoF5zBJbXzeydDFyckgI9LNKfJ7iAmGnSWxq38TexcgBZFdIfFrkCBIWEtCSOHpqN ivEoP1MEg3ntzKC1LAJmEjM6pAAqRERUJK4t2oyE0gNs8B8RommSb1sIAlhgXiJjp+9rCA2i4 CqxPU5S8DivAI+EptbVjNC7JWTuHmukxnE5gSK71h7lx1isbdE1+sPrBMYBRYwMqxi1ChOLSp LLdI1stRLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAgMq3oGBsYdjJe3+B1ilORg UhLl3VmxOFKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBK8TMEyFBItS01Mr0jJzgAEOk5bg4FES4 f1wEyjNW1yQmFucmQ6ROsWoyzHpwPYvTEIsefl5qVLivA9BigRAijJK8+BGwKLtEqOslDAvIw MDgxBPQWpRbmYJqvwrRnEORiVh3nKQS3gy80rgNr0COoIJ6AhFwYUgR5QkIqSkGhg3LDq8+lL HvFA51zsadtLCces/XvlZ0/V4+n2eWZN2NOhN5nlsvOnuS+fQwNqPvYm3Axo3Tn8a8PyNmmze tld6GWd+bNtwqKJ+cv954xodv68xxfw5/0wT139alqi6f99xJo7tafPTK8zvsWy4vnJTfOLl1 zEsp66xxfK2ZE6aulgtQspd73GAEktxRqKhFnNRcSIAKQfq/rECAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-206.messagelabs.com!1503910631!109005071!1 X-Originating-IP: [74.125.83.47] 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 43616 invoked from network); 28 Aug 2017 08:57:12 -0000 Received: from mail-pg0-f47.google.com (HELO mail-pg0-f47.google.com) (74.125.83.47) by server-8.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Aug 2017 08:57:12 -0000 Received: by mail-pg0-f47.google.com with SMTP id t193so11126018pgc.1 for ; Mon, 28 Aug 2017 01:57:12 -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=YOnVbf2KQHJUvnXkY+8NWwhSqgBo0gewN4GYDNIiV08=; b=Tq5bRn1pZhRIr3c523HFEqgqNb5js61yo6xhKuiobPLDkL24BOliCH8GeDiFQrmGZH bKT6Vzrj4N18f1E8v1A3j49dmghvy3lcDpkr+lrKdN9y0NIpz47e7rxNLKtMSpd7u1XL OXXhUe4CGFloBXYq3+sLE1qEgXPXjUllHASIw= 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=YOnVbf2KQHJUvnXkY+8NWwhSqgBo0gewN4GYDNIiV08=; b=gR5S8zk5KBxrOGt85q86TYFq4MhCqxiN1B1lajIADMomUugn742caSEJsGjB7xdB+/ l8N8ZW6n/fC13zldAsNbnmEzF+YHgl3nfNJw+rFSlIRq11ZalfX5tTlw7ihGl7LuOJvx 2STmx6zDDZUmYqZbQcyZ+YpwJ7nN9jTdTRtbIKyi40by9JUmRr7li+8a8eRiJ1lnL9Y8 hzc2oPudv6MvNnfa+P3RZsYbJRPvRPMd24+vMRmVkMT9p9XC/qotBI7z9oDUzCWe1D06 w8FJPIq7JGE31+ocw4ub8yQrdBggJ8xOvx6dkPNBV6yENCGzWWXh57+9beAj49PtdE7x 02wA== X-Gm-Message-State: AHYfb5in/hvp3oGTgMnK57YJjWLVhdbcGLjJUWBkgqGQz9BScnhFGVll +s2XfCPuY10eNCfmm6pjmQ== X-Received: by 10.98.44.18 with SMTP id s18mr6590565pfs.268.1503910630616; Mon, 28 Aug 2017 01:57:10 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id d88sm21713569pfl.158.2017.08.28.01.57.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Aug 2017 01:57:10 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 28 Aug 2017 14:25:59 +0530 Message-Id: <1503910570-24427-17-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> References: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 16/27 v8] xen/arm: vpl011: Add a new handle_console_ring function in xenconsole 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" This patch introduces a new handle_console_ring function. This function reads the data from the ring buffer on receiving an event. The initialization of event channel poll fd to -1 is moved inside the handle_console_ring function as they are related. There should be no change in the behavior as there is no functional change. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v5: - Split this change in a separate patch. tools/console/daemon/io.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 2dcaee6..c361b42 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -934,17 +934,23 @@ static void console_evtchn_unmask(struct console *con, void *data) } } -static void handle_ring_read(struct domain *dom) +static void handle_ring_read(struct console *con) { xenevtchn_port_or_error_t port; - struct console *con = &dom->console; - if (dom->is_dead) + if (con->d->is_dead) return; if ((port = xenevtchn_pending(con->xce_handle)) == -1) return; + if (port != con->local_port) { + dolog(LOG_ERR, + "Event received for invalid port %d, Expected port is %d\n", + port, con->local_port); + return; + } + con->event_count++; buffer_append(con); @@ -953,6 +959,21 @@ static void handle_ring_read(struct domain *dom) (void)xenevtchn_unmask(con->xce_handle, port); } +static void handle_console_ring(struct console *con) +{ + if (con->event_count < RATE_LIMIT_ALLOWANCE) { + if (con->xce_handle != NULL && + con->xce_pollfd_idx != -1 && + !(fds[con->xce_pollfd_idx].revents & + ~(POLLIN|POLLOUT|POLLPRI)) && + (fds[con->xce_pollfd_idx].revents & + POLLIN)) + handle_ring_read(con); + } + + con->xce_pollfd_idx = -1; +} + static void handle_xs(void) { char **vec; @@ -1236,15 +1257,8 @@ void handle_io(void) struct console *con = &d->console; n = d->next; - if (con->event_count < RATE_LIMIT_ALLOWANCE) { - if (con->xce_handle != NULL && - con->xce_pollfd_idx != -1 && - !(fds[con->xce_pollfd_idx].revents & - ~(POLLIN|POLLOUT|POLLPRI)) && - (fds[con->xce_pollfd_idx].revents & - POLLIN)) - handle_ring_read(d); - } + + handle_console_ring(con); if (con->master_fd != -1 && con->master_pollfd_idx != -1) { if (fds[con->master_pollfd_idx].revents & @@ -1261,7 +1275,7 @@ void handle_io(void) } } - con->xce_pollfd_idx = con->master_pollfd_idx = -1; + con->master_pollfd_idx = -1; if (d->last_seen != enum_pass) shutdown_domain(d);