From patchwork Wed Sep 27 06:13:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114333 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665377qgf; Tue, 26 Sep 2017 23:17:01 -0700 (PDT) X-Received: by 10.36.44.200 with SMTP id i191mr930080iti.136.1506493020967; Tue, 26 Sep 2017 23:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493020; cv=none; d=google.com; s=arc-20160816; b=gtYu5zNUUyAaE2WdzqQIH3EoTCo6vEVCfCUF5Cd8pESW1QkAPjo5WcTeyLVbdbROKS 00O6C+uYeHrmWoI2cQ63yxYV9e/HGXDmv1BjNmae5LpL2/BifbMbFm8UIdHhCYSQ6+Bz qlhpzyybXG4N4yJ2tgcQckC+amQB9nO4Oxu8YNdLfg1IlKD/e25mu6P5UiIjuXtd08Ui PPnHwD+Gf9pbXwSlBgbwsri7/Nrhk6b9YIBBIwKfrrDaU97RkhRwqI6mQ68/Z8+zSGCv 9kSm+yVaPql4Y90gwTIR6d/x8+q7rXFO8ucrg/+jhI2yEtcmutxdj2UdnieZO4F/MphS D/iQ== 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=EncVTiWfBbtIxylxnUk9+xT21OqnAVDQk2kqPlpQZiU=; b=blCzuFOuGEJerQlRU5g4vwgmZcC0t0aeh5zIOoF45pgOArXMz+Z8sFMo54h/ouqcAP eCuOjSTyrIjFDMHP73g2YGxtCSJ/vjiqqPz6MlJ9lwzuU6RLPth+bMdxRt2DTwTewryv XegtUxOK7qJljV/hAyv01G3bfgQHPlLBDjxTcnfFBnFa+ni6jEQpAG+PCsIadUgqSqNS FpRG7MJQAwoxm6Lp5ZWsrrGhBLWnjtKSAgfBiDEaaqhax37AKo1M4V/3ConAUgOx6GWT QvVRzLsKDEPT0oFZeF4TWP32yjpILz/fdRVvIh8H+IO00CPT9g0DruhThZHhYfbgngt5 nV+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NnszRVRX; 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 k6si8963838ioi.250.2017.09.26.23.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:00 -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=NnszRVRX; 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 1dx5bb-0002ex-No; Wed, 27 Sep 2017 06:13:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5ba-0002cf-CC for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:58 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 4F/36-27708-5A14BC95; Wed, 27 Sep 2017 06:13:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHIsWRWlGSWpSXmKPExsVyMfTAat2ljqc jDXZ08Fp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBndG2cwFmwRqnh44SRbA2M/fxcjF4eQwAxG iS2/HjGDOCwC85glPlxqZgVxJAT6WSV2Tn7N3sXICeTkSZyYtZgZwk6T+L/mHFCcA8iukLh/1 BokLCSgJXH01GxWiKkrmCTeHD3IAlLDJmAiMatDAqRGREBJ4t6qyUwgNcwC8xklmib1soEkhA UyJCY8PMAIYrMIqEoc3rKWFcTmFfCRWL59IyvEXjmJm+c6wW7gBIqf7r/NBrHYW+LSyn7WCYy CCxgZVjFqFKcWlaUW6Roa6CUVZaZnlOQmZuYAeaZ6uanFxYnpqTmJScV6yfm5mxiBIccABDsY 10x1PsQoycGkJMpb8/9UpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3jiH05FCgkWp6akVaZk5w OCHSUtw8CiJ8EaBpHmLCxJzizPTIVKnGO05Lty59IeJ40vvDSB5YM8tINlx8+4fJiGWvPy8VC lx3iqQNgGQtozSPLihsGi9xCgrJczLCHSmEE9BalFuZgmq/CtGcQ5GJWHeZJApPJl5JXC7XwG dxQR0Vu/UEyBnlSQipKQaGFO9VVm6NErWrpM4zDLdnO/nronv/ZzmTJ73OvJSxddTtRK32l6f ZTxRc1T8ruOsZ+k7cjXunJRd5rL3cmP2LqUbT1pWsz5Wz+ZNPpa3hPOhzu8Jv9aIxOV3LVFYf W1VLMsV0cn562VvP13rf2b75DiRzqNdmr0vlt1XULhRXLbtli3zDP3uXb+UWIozEg21mIuKEw GQGAf90QIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-206.messagelabs.com!1506492836!99401081!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.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30173 invoked from network); 27 Sep 2017 06:13:57 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-15.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:57 -0000 Received: by mail-pf0-f171.google.com with SMTP id u12so6757491pfl.4 for ; Tue, 26 Sep 2017 23:13:56 -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=+Jo1JpAkfFAajaOT3dp6fEfCx26fj20ZkRTJgD45A5A=; b=NnszRVRXisgnWkhUcsNnVt4KN+bucWeYkef+A9UtX8M+zJEtxLq9NThyHvw2sVmfca LA0T61WXcK2l/IemfSp4Tt559169Gijg907ncR1MCK93WJ8xKWIo6K/unYFWCgJj/ggx Ze9nzG9AaDDPl1b3pdcJIKN0tFdcSgxjqu+EI= 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=+Jo1JpAkfFAajaOT3dp6fEfCx26fj20ZkRTJgD45A5A=; b=s+raxfFEVaa+QapjP4N9lKDXjZl+CNknDyogUIB2WdbC9SS3xaSwmYlxNUN+sPOz2R SRsxmGqH0dQOJ+dsMOnrVaH/e7KCBgkGADZTNZkiqPjKqyvdVqW9ONPgw/PXhF0TgTFS L7JuvJYxIul7NQdOicv6WQDMmkbQ3DsWzRNjAkBYey95BHrUEQtwaNth1Bp9Dk33W97v Qq0vKBDeMDz0PLFf3v/pqB4tI72uox3oOjCjKHzVhoATKQFXPIzYFQUSpNS4hqO1hT5A AB6j7XuELPNhRBVZbyrCVqbVroLq/ayq4JIyX080MshGKCIsdAcNZ7jKacBPws/Il3by OTtA== X-Gm-Message-State: AHPjjUhi5sFVJ9Lpd/TXknXAQefBIlQDpMSbf2UGyX4b60o5BPJQAbkU asubgEtnYh5R/ieGpV1EGicGopWg31M= X-Google-Smtp-Source: AOwi7QC25B8Nu1vUsYERnbObaYjLSGbFFpGuIkdmRR41qVu+hXS/OpRNdPm1hONGOs7RoClyaD8LHg== X-Received: by 10.98.200.76 with SMTP id z73mr351909pff.154.1506492835588; Tue, 26 Sep 2017 23:13:55 -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.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:55 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:22 +0530 Message-Id: <1506492816-25954-14-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 13/27 v11] xen/arm: vpl011: Add a new maybe_add_console_evtchn_fd 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 maybe_add_console_evtchn_fd function. This function adds the console event channel FD to list of polled FDs. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v6: - Renamed add_console_evtchn_fd to maybe_add_console_evtchn_fd since it adds the FD to the poll list conditionally. Changes since v5: - Split this change in a separate patch. tools/console/daemon/io.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 0009bbe..3483252 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1047,6 +1047,26 @@ static void reset_fds(void) memset(fds, 0, sizeof(struct pollfd) * current_array_size); } +static void maybe_add_console_evtchn_fd(struct console *con, void *data) +{ + long long next_timeout = *((long long *)data); + + if (con->event_count >= RATE_LIMIT_ALLOWANCE) { + /* Determine if we're going to be the next time slice to expire */ + if (!next_timeout || + con->next_period < next_timeout) + next_timeout = con->next_period; + } else if (con->xce_handle != NULL) { + if (buffer_available(con)) { + int evtchn_fd = xenevtchn_fd(con->xce_handle); + con->xce_pollfd_idx = set_fds(evtchn_fd, + POLLIN|POLLPRI); + } + } + + *((long long *)data) = next_timeout; +} + void handle_io(void) { int ret; @@ -1124,18 +1144,7 @@ void handle_io(void) for (d = dom_head; d; d = d->next) { struct console *con = &d->console; - if (con->event_count >= RATE_LIMIT_ALLOWANCE) { - /* Determine if we're going to be the next time slice to expire */ - if (!next_timeout || - con->next_period < next_timeout) - next_timeout = con->next_period; - } else if (con->xce_handle != NULL) { - if (buffer_available(con)) { - int evtchn_fd = xenevtchn_fd(con->xce_handle); - con->xce_pollfd_idx = set_fds(evtchn_fd, - POLLIN|POLLPRI); - } - } + maybe_add_console_evtchn_fd(con, (void *)&next_timeout); if (con->master_fd != -1) { short events = 0;