From patchwork Fri Sep 22 08:23:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113968 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3010904qgf; Fri, 22 Sep 2017 01:25:50 -0700 (PDT) X-Received: by 10.36.90.205 with SMTP id v196mr4917395ita.70.1506068750167; Fri, 22 Sep 2017 01:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068750; cv=none; d=google.com; s=arc-20160816; b=CUpPzmjqA+tzuLddz9LnEkZ3tminue2Pr2goVf4zoAgGjdZVMF6+K/otRXDfNcPCSB MXd75HbOtxKbWK7p2cM1+hJs8kZQo1B+jvg6LS7/cf0hO4Ffp860rgqVyxS7SueAMvTV EnLOBVMoVarvZUJo220w5EUkiKjdD2xC+0131MNukhMfAlwULKASUGcL87Xb3ZlOTgxE Kee7IjYOMrMQ9LWdiT6ceJkIK6Z8BSqIeHOaH/HOQAT/y6xjh8nxAaVmdgKjyAEC6/Rz 2uRnGRCH+C8ijKgZntJ2PBRV6QhmP5LdsSgkSXQhhOk81PgG3C3VlEPhWWvnDCmhnQGQ X/fg== 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=W3d7byvFRRmKN1TDLpqNcFnBEPDSt+QXdfNgR+FfJz5z+eRiQUKzw4ilI8npveSCNx gOJsnrWbViDCoTizAqv2hFQ8DpuePgAFScGoiT4F8npNszVOEstC0qXVCgdc2aqmZ+Am HhjsnJm8yTDiBL1q23pZZO0KrDCE/urkQOYaw2xcBcOqXDJb+RFf2eL1FHSpxCn42l54 2bqmmW+CERyh/eQ3zUQVgX+fbRo05hqVIDfgXo4gfGEZldm2/NNX4DPiIEsXpKgSgWs9 G7XQ2Iv+D3JHPEzWEj+Qc180v1+2Hf4W4dlej5PDvgKd1vL4S9SAMxY0GhvzhfIs4PU4 slsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RE8ixN0W; 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 q6si3421408iti.19.2017.09.22.01.25.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:25:50 -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=RE8ixN0W; 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 1dvJG6-0004Ds-34; Fri, 22 Sep 2017 08:24:26 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJG5-0004Bs-0b for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:25 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 76/A8-01911-8B8C4C95; Fri, 22 Sep 2017 08:24:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVyMfTAKt3tJ45 EGjTNlbP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMubNItmCxesf9DL2MD40+hLkYuDiGB6YwS f/ovsoI4LALzmCW6521iAXEkBPpZJW7fXMzYxcgJ5ORJbPl3kwXCTpP4/fwAexcjB5BdLnH+Z BVIWEhAS+LoqdmsEFN3MEk8XNrGCFLDJmAiMatDAqRGREBJ4t6qyUwgNcwC8xklmib1soHUCA skSPR3FYLUsAioSnz6dhFsLa+Aj0Tv/ImsEGvlJG6e62QGsTmB4mv/b2CB2OstsfXGVZYJjII LGBlWMWoUpxaVpRbpGhvoJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEhls9AwPj DsbOE36HGCU5mJREeR8fORIpxJeUn1KZkVicEV9UmpNafIhRhoNDSYJ353GgnGBRanpqRVpmD jDwYdISHDxKIrzhIGne4oLE3OLMdIjUKUZLjgt3Lv1h4jiw5xaQ7Lh59w+TEEtefl6qlDjvfJ AGAZCGjNI8uHGw6LzEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZg3BmQKT2ZeCdzWV0AHMQE dVL4a7KCSRISUVAOj6DHW6fGJMx68PG/McOTGwu0fspRFjuZ9ev2S46jJ5fQVfEH888WtV5Sc vjFxZfx7SePs51J2f87r3Ay7k80z4fuSj5f2q99bv/jV9UjPvY73BF9otRn5XFsmlBR/6YZ0C wtHpvTtydVvHsVnPG37VJl2e8rTV1tVu+alRxhzdc5iZjgYFSwppcRSnJFoqMVcVJwIACU1Fr PJAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-10.tower-31.messagelabs.com!1506068662!115313759!1 X-Originating-IP: [209.85.192.170] 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 38639 invoked from network); 22 Sep 2017 08:24:23 -0000 Received: from mail-pf0-f170.google.com (HELO mail-pf0-f170.google.com) (209.85.192.170) by server-10.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:23 -0000 Received: by mail-pf0-f170.google.com with SMTP id b70so233451pfl.8 for ; Fri, 22 Sep 2017 01:24:23 -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=RE8ixN0WuKIcuQ54fVmBBuVqwBEVl9pSfcI4uUXuFklj2rdxEdNM63rjpoXxdCuAgk GDDU3A18QkepfI0d66TCHIGTPDhAZblvUqaWea85HFo/oBVX2cBZt7ZB/MDiv02ru2kz FWy5UHyai7ADjurRm4jx+ttG57ppbn1Rgc1bk= 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=pSwnoqno762PIgZrC12GASeSTRuDeixm61td7VV9Yxp+SJ1lpdCtSVbsVJ/9/35JZx jaY2e79XNlGCdausfFIcL1rJWUBickpbv16xr6/1a+jexIRlL062hwLSO1CqlQ/zVlvm f/k9dqkPdBC1p5mG6Y0cQ3zQuIhGHXy9TDeXomvvFH2zi5A07PBt+LCX/CyEM/3H2oLY 4U67dhRn1VkQgSIySPa51b5CbISR2lzGvbsTQoF9LERC8g+wA4gdhuagcwBwq+qoOPoQ tezmFBA+O4Cy2sZ4m0UHo2eMCzByAsRZ7AccKjpXOdq4eqVloBTtEgjhu70YVmKCG+BH WUZQ== X-Gm-Message-State: AHPjjUj+E/mqMCe0Wa079KvjbCyvkvf2C7+bmymayO1AqTjeHlkV79+S s7VXyt6BhqKfQNc34X9V6Kdb0//pPu0= X-Google-Smtp-Source: AOwi7QCDRpNCJ1VgrpwxnTNqUV5LRfwgvLnkG/rgaZWyX73UuvAzHtbK2MJ4Llk8rsef23WNmghf9A== X-Received: by 10.84.160.6 with SMTP id n6mr8358631pla.393.1506068661796; Fri, 22 Sep 2017 01:24:21 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id f74sm5569284pfa.36.2017.09.22.01.24.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:21 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:15 +0530 Message-Id: <1506068606-17066-17-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 16/27 v10] 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);