From patchwork Mon Jul 17 13:06:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 107958 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4495495qge; Mon, 17 Jul 2017 06:09:41 -0700 (PDT) X-Received: by 10.36.150.68 with SMTP id z65mr5362402itd.106.1500296981692; Mon, 17 Jul 2017 06:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500296981; cv=none; d=google.com; s=arc-20160816; b=CcV9taluVzOHHLDuVv4Cvda6y83r01mk2uXPzdWbBDwJu+ux4L4klCxYHG1IM95UGR XVkG7657CDTMvC+ogola5z3o3eiioCAEA2ZoFyJNrOtm2B9hH5BJq4q3itfv3jlHXKe2 4/yKOTgwY65hA3ewaVxBKQa9V1GG3z9W8bJ++E/zaFKvoZ5bxV6J0l4+bCHzk679luU6 R/4ilgUOQP3FICv8W3UCZGf6cqG5WIfFeBYyZPRFUPVn/J5VK1Kkk9QV7NWSz55r2cmk xQPaztaSFykhhPs4vtSmgNtGmGHIL5PzWqRuXYNquOCFpwkiDDc1+MNpsVm0xxuRUTXZ vJIQ== 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=Gh1DpGkWdpSjHKMchcG0rDLjIQAyo/IwSuWfUITwHp4=; b=Bq5bsddHdlzgNPnnrbQj398K3V/IYjT8ReY/xp2Vjwn0C+9XrzvmiIPadE8VvwXFz6 1+tyejjLLvYzHBclV7DQkzy3hPJ8Aekm2CQBjeCkTC1dlQI1dp//JqB5SxLrPFBW4ysQ UL+ePD9dAqeOsPCx299f+KKc0d//pyI8jxL0nppBvCL926GTGnA71VyRAKTU0ThesXTR zwMFKw/iHhb6xSM+1nlD8otnoYCu5DMBcO4OAfw1FkHwLw1YZ2mTRTQRFD7Fy5s50FDY dYr8kr6txLoT6Fq9OgKL6UzTRpbSkgSpAv25tFZNzQaMAxuMIEKILcw1e9X12yyWwU5J jfmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=jG1xkMuT; 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 q98si15809980ioi.217.2017.07.17.06.09.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 06:09:41 -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.b=jG1xkMuT; 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 1dX5kg-0004iZ-Lt; Mon, 17 Jul 2017 13:07:54 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX5kf-0004ff-6n for xen-devel@lists.xenproject.org; Mon, 17 Jul 2017 13:07:53 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 7F/2B-03044-8A6BC695; Mon, 17 Jul 2017 13:07:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRWlGSWpSXmKPExsVyMfTAat0V23I iDd42sFt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnLLh1iLvgoUvH1/gbWBsb/Al2MXBxCAjMY JW7s7GcEcVgE5jFLTLi9nBXEkRDoZ5X4/6GLuYuRE8hJk3j96hsThF0hcbh9CiOILSSgJXH01 GxWiFGtTBLfD3SwdDFycLAJmEjM6pAAqRERUJK4t2oyE0gNs8B8RommSb1sIAlhgXiJo8tngQ 1iEVCV2LN2ByuIzSvgI3H92iV2iGVyEjfPdYIdwQkUP7NhNRPEYm+Jm0cmMk1gFFjAyLCKUaM 4tagstUjXyFAvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMwuBiAYAfjn2UBhxgl OZiURHkvsmVHCvEl5adUZiQWZ8QXleakFh9ilOHgUJLgdd+aEykkWJSanlqRlpkDDHOYtAQHj 5IIbzVImre4IDG3ODMdInWK0ZLjypV1X5g4phzYDiRfTfj/jUmIJS8/L1VKnFcPpEEApCGjNA 9uHCwWLzHKSgnzMgIdKMRTkFqUm1mCKv+KUZyDUUmYdznIFJ7MvBK4ra+ADmICOkjYF+ygkkS ElFQDo+Ieha9TlSS3HpvawpgiPX3f3dPNk+uL//87HXunZX/2le6dQaev3J5ayes6I5wlYoca g+CMd6anJNLNp85cIdCvv3hrWHZJvhJX+PvZZ9Yk6a+eHmlSfn/Ohnnv95g57Qj74eJz1HkWe /HxvWvdOXXYzRXNpc49K3qtEMos4HBsT8ot+7DFckosxRmJhlrMRcWJAOR7crLAAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1500296871!73515966!1 X-Originating-IP: [209.85.192.171] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21542 invoked from network); 17 Jul 2017 13:07:51 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jul 2017 13:07:51 -0000 Received: by mail-pf0-f171.google.com with SMTP id e26so8424035pfd.0 for ; Mon, 17 Jul 2017 06:07:51 -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=hzmcOSYjiiJgJAccV8p6wWGv0Dmdfz68OU0DsA0Zna0=; b=jG1xkMuTh23L+/3JRk3IZ3oAr40Lb5Ma8l8InnxErSB4drur0Aocm1DGuhYle085EK 5k6fAQXFW9q+gwqECPq3AiDScOOjcPl7plarajGWlPdv/Hri7yiMxNDQRt7MvV0fh6rr K6ci/sCeOndiVB0KlR7s9pwtHFAbFBjaB/6iA= 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=hzmcOSYjiiJgJAccV8p6wWGv0Dmdfz68OU0DsA0Zna0=; b=N32i/6eg6AuBa5TQy8hEYkpmlQuu6YuAy0fDeSA00Lvh1tqNDp5Gji7W69ubFQTCVm 03Kk8799W/HHq60sNKRCO52CMArtRmmBZ42veSwWKFhrw5fJfy6tbWhB5D2xx3HF48Qa Xgkeha/dDX0ZrAiprudpnMOUOOz3HNzdZU67ty+s741Ut/Ze2/SEBW/UZp/Zw/imPT3D eho/DaZ2kjg/myrYUZUKxu0u5yajJhjrvYK0xBaAWZKgfcIXySMuKib1bdIO1LOqaTrs PyBtfn5swuBiCRGU+yJzrmhiuMMsFCn+GZAV173vdJepYJpsrjCjxRtP6GyvkPm9E42X QLQw== X-Gm-Message-State: AIVw110ZB9VRR7fRs7qYJqdvSAG4vFWdhytHsaee4J2BNWKNFRg7Q5BQ z3RqrAuFN+DcWdkCwonSog== X-Received: by 10.99.177.6 with SMTP id r6mr18881711pgf.106.1500296870511; Mon, 17 Jul 2017 06:07:50 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id z69sm15705665pgz.42.2017.07.17.06.07.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 06:07:50 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 17 Jul 2017 18:36:46 +0530 Message-Id: <1500296815-10243-17-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> References: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 16/25 v6] 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. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini --- 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 | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index c272fe6..775fb04 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -935,17 +935,24 @@ 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); @@ -954,6 +961,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; @@ -1238,15 +1260,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 & @@ -1263,7 +1278,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);