From patchwork Wed Sep 27 06:13:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114321 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665064qgf; Tue, 26 Sep 2017 23:16:34 -0700 (PDT) X-Received: by 10.107.50.196 with SMTP id y187mr428894ioy.67.1506492994212; Tue, 26 Sep 2017 23:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506492994; cv=none; d=google.com; s=arc-20160816; b=Es3QMws6GdExw6oqqINfYvcajrvc3aRA7ArQ73Y9dq565C4fUJAzJkLpYdt6pu3IjC gPtWt2zF1mafJ5UBbcKLFlRQG8Cec/UkDctOu6AJby6Lgxf66gNuNCFrJSCLXGrUO6GK YCA235cR59xIaMmctbC1s6FeMgtfHnaOaK889CH6A6x8zOL4uUAp4GQTHqRD0ZzCXnYl yoST24nJOJEFAuumbHXtqV247h314i5BQcsZ0dSYLb1EZRGI3FmBU8ZKXtRcseojpMyP MEbQGblAKMFBYuMmiCqH2vXnOQ9nAKbeu22VPNF/cuCdcBis2zye1HDLrbsKhn16B+lC ELbg== 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=r+AxssZEyjjlyRPvY0gQjjXT/+kUhjMy+6e9HY+/BVYL+PetJ9+74aZcyU1SGpnZtq vDgNXcM1cumSXCmtBaxnAWMtAW7dG7jXFLH/VRnDJQvqLH/5LgEYnYklVdEL8yiTmcb6 3143jXgU8xzdyAkT0O1Uyw7HI+VZqwfkpwEmiHrq59mEpipG4tLG9YAR0EW5zFfvBhvs YZIcHJotzslHs9bUHjyd/J2LiMbjdJaViQJ3Npf3Ip4oJ6HvN5BRBOM/PxnJT0E288D3 BroyLhZIsV1Nn3voUqP03Irs/2thi7xebOr5BfMN9rUQXzwwQFKQp4BFkDanPow6WuOL iamQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fKWZlo5O; 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 s103si8592805ioi.273.2017.09.26.23.16.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:34 -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=fKWZlo5O; 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 1dx5bg-0002nc-QX; Wed, 27 Sep 2017 06:14:04 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bf-0002l1-OY for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:03 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id F5/C3-03422-BA14BC95; Wed, 27 Sep 2017 06:14:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTAVt2Vjqc jDZ58ErP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMubNItmCxesf9DL2MD40+hLkYuDiGBmYwS XzYfYwZxWATmMUvcWLadEcSREOhnlTj04D9QhhPIyZNonLeYFcJOk3i/awo7hF0ucXfhezYQW 0hAS+LoqdmsEGNXMEnsvtfL0sXIwcEmYCIxq0MCpEZEQEni3qrJTCA1zALzGSWaJvWCNQsLJE h8710EtoxFQFViRfMTdpBeXgEfiav90RC75CRunusEK+EECp/uvw2111vi0sp+1gmMggsYGVY xahSnFpWlFukaGeslFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgQGHAMQ7GD8Mz/w EKMkB5OSKG/N/1ORQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR45zmcjhQSLEpNT61Iy8wBhj5MW oKDR0mENwokzVtckJhbnJkOkTrFaM9x4c6lP0wcX3pvAMkDe24ByY6bd/8wCbHk5eelSonzVo G0CYC0ZZTmwQ2FxeolRlkpYV5GoDOFeApSi3IzS1DlXzGKczAqCfPeBZnCk5lXArf7FdBZTEB n9U49AXJWSSJCSqqBccI1d1WhpW9mb5r39sTnYoUFL87HL3Z5uKTtm25r24+Nmssu7H681urg 2a07FU76nxatZ/FaN7Xy3+XlkZ5f92sXJ0+ap/NDd0kun/veC6+vrb+c1fa3233PnOcOZ09d+ hwZ9khp6VuVuJS9U4pn6GUEGn5orw59qrDvof/h8/xG59edey8ZZeyvxFKckWioxVxUnAgAIp 8pvtACAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-21.messagelabs.com!1506492840!76795250!1 X-Originating-IP: [209.85.192.181] 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 46235 invoked from network); 27 Sep 2017 06:14:01 -0000 Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by server-5.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:01 -0000 Received: by mail-pf0-f181.google.com with SMTP id g65so6739386pfe.13 for ; Tue, 26 Sep 2017 23:14:01 -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=fKWZlo5OpKKYz6J8jfnwvR+UbvXpcHjIDfrUON7vnMF7GBE77nf6/81yK5ThAIfXiu iDtsv1T6cs562cMJDEND9GIT3IDZ8IsXwdCpjgGS48d68YQpo9I/CU4vqrBbH0uwKjTr GR8Xm5k7hFdBNgQhIpu9s2kU9Fc/JWv286+4w= 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=M1huDjJl2KkIIkiTebzIfXMHB8fTpqRB3CZh/ptvqYiqRiROcqZ6cfDfbJ4uExUwaW G35Kj0LsuPLvwkxyTw2+m7ONhMP2ZEsmPn5eodtChnFYjAb3n0Up1eY3eNlbmyhLjvJj Gh2Tp/tVvZoZSMXznrpEI8UMuImDCGDTfbm8D46L8cCLRMNerSyvYfAsIK1Iz07rC33Z f/aMJJxZ/wwweIQMycb+b55ajrxlf9lG4egSLQoSasLENNv29woHvFCLfc+6Qjp5OdfO NK5ZnF1UuxJOwe9eQv3OpApUEitknzSRKuJ1DI0NfcyhlYm6tXZ8WED5ZAK2LCA9Ze+W dt6A== X-Gm-Message-State: AHPjjUgoIOsQa55fSsGjn9cmgHP72ndASQHEMYHPw051F5Y5BW4pC53c zjfh6ITfIokVAgar9cWzNa2I5mep41w= X-Google-Smtp-Source: AOwi7QCWnVtwGc1sWhkAvVBp/k8CitDRT5SuQZXMK1iy0bFgnnpubm/obm1SATdUouVJXU97CBzZkw== X-Received: by 10.84.235.67 with SMTP id g3mr340041plt.326.1506492839746; Tue, 26 Sep 2017 23:13:59 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (h3.248.139.40.ip.windstream.net. [40.139.248.3]) by smtp.gmail.com with ESMTPSA id s187sm18013485pgb.82.2017.09.26.23.13.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:59 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:25 +0530 Message-Id: <1506492816-25954-17-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 16/27 v11] 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);