From patchwork Mon Aug 7 08:53:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 109532 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2482032obb; Mon, 7 Aug 2017 01:55:56 -0700 (PDT) X-Received: by 10.36.94.15 with SMTP id h15mr146344itb.71.1502096156570; Mon, 07 Aug 2017 01:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502096156; cv=none; d=google.com; s=arc-20160816; b=sDBtskMGMKzNgCHR0e2T2C4aLLquIUIbofberVeFlk427Z78AJvXJChvLfTF+QPgOR eadDpf4WMfVHlHFz5REzemBjEQvXMq0zJEtYbUI8pg8/F5O1OMEC5gbZl1jYaMpi9mXF b8IUrqo60m6CKp6zsCKhzLTPmgQNjNq3rWMTcYojHiC9ahumbroNDXYe2FnnIlfTcYVT mkAOOQaOuLeFsViXw8RZioaxYXoUQtp4xg11TyQyTEHqe6EqHLYHeO3gGYtSheIHpYOZ suByXWBXiAgJ+gJGlYJdclOqzb38LvRsH5bKWDbwc7yYclkxWnAkLJWkS8Y7NKpPAOyZ 6WGg== 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=5z9Ztp0OKuAOgvcCHhoZoPcLJXRoZ+2uvx1F0USE4xw=; b=C81AhURWyzNfSwaM8pFF5MCzt7qgbygqAYcGfm/S5U1x5ndxUlX7FmHD9KL0fnPRjJ noOCPvgQx+6YPxWPr7vz4C/fxJuxLGes6a6gfemAhBl5rXZA0q//R6upTrhUmmVnTIfm aJmbKiv+aPe2a+a8KynbJdf0HvcBdIYPQMsJyRxj15c6XKPu1D9cKtY0PFFgjx4D96Gw bZMG02wszJI882L/RfmdWo3+bNFWOtEJkgY75jwNXCwabY+Uxz398kPojga2wGach6lx qXliHF9L5IQCzRrakRjPQc1HYbptFLjboIcE0MEc/sTQE4oNuuHDvRBTqQzA591+NkTd Gocw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=aLwSAhmk; 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 m193si7580116iom.33.2017.08.07.01.55.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Aug 2017 01:55:56 -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=aLwSAhmk; 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 1dedne-0004h6-8l; Mon, 07 Aug 2017 08:54:10 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dednd-0004cg-9C for xen-devel@lists.xenproject.org; Mon, 07 Aug 2017 08:54:09 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id F8/2E-27137-1BA28895; Mon, 07 Aug 2017 08:54:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRWlGSWpSXmKPExsXiVRusq7tBqyP S4MxCCYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWP72lWsBT1CFa+/3GJpYHzN18XIxSEkMINR 4s3nZ+wgDovAPGaJ++eWgzkSAv2sEqsnd7F0MXICOWkSx6+1s0LY5RLTlpxmBLGFBLQkjp6az Qoxqo1J4tiDPUAOBwebgInErA4JkBoRASWJe6smM4HUMAvMZ5RomtTLBpIQFkiXuLtkJxOIzS KgKjHhWTcziM0r4CNxumUrI8QyOYmb5zrB4pxA8fOX3rBALPaWuH2sj3ECo8ACRoZVjBrFqUV lqUW6xkZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBwcUABDsYT68LPMQoycGk JMobv6ItUogvKT+lMiOxOCO+qDQntfgQowwHh5IEb4JmR6SQYFFqempFWmYOMMxh0hIcPEoiv C/UgdK8xQWJucWZ6RCpU4zGHJMObP/CxPFqwv9vTEIsefl5qVLivDkgkwRASjNK8+AGweLvEq OslDAvI9BpQjwFqUW5mSWo8q8YxTkYlYR5pUGm8GTmlcDtewV0ChPQKW8SW0FOKUlESEk1MJY ZlldyX98bKV5VmJ++sHf2B7H2FazdmXfDr795e7mjm+lB0/Qrki8PFzVHRoS7VAR4mEhuFft8 5sC++09UO068XXp9WVdQ0qTFtYyfqk3/Lq9raZ0qcM//y8ajDPX6k960+FxR2etlz7GyNkrg6 t21qVbcj9g+ysvsOu0ZsLVgf2FOU6J4ixJLcUaioRZzUXEiACPAXO+6AgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-27.messagelabs.com!1502096047!57774562!1 X-Originating-IP: [74.125.83.45] 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 24183 invoked from network); 7 Aug 2017 08:54:08 -0000 Received: from mail-pg0-f45.google.com (HELO mail-pg0-f45.google.com) (74.125.83.45) by server-15.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Aug 2017 08:54:08 -0000 Received: by mail-pg0-f45.google.com with SMTP id v77so31638035pgb.3 for ; Mon, 07 Aug 2017 01:54:08 -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=kIvT37WxW74x5LZwxVmzvwX5NhdHwJ/aVM8On5pSpLI=; b=aLwSAhmk62nQdOFQ950UN2j6ZV/HRWOtgNlpasrYJefrfchsE1TAnigcahfXWMf7WG 7XT9U7+AkRGmhoYexjWZYAM7KUBZuZm3IFCfglJvlz+QVnTekV5ivp1SyuFCYfxr9VIq ab/JBdniSxDzRYiSG4/6dxqRtXVFVbCj6beGA= 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=kIvT37WxW74x5LZwxVmzvwX5NhdHwJ/aVM8On5pSpLI=; b=ueN+wz8JOyEu0rEZ0iJzOEmyFe7UnmRxM29Ce7ErOFAyNOdww7x6Tz6zzPgXhxw71l CyTTnLiFHH7BSxbY7HIqW228ggw9j1WnaJ1X0FRYYXZs1cXg5Vw3Wx6yJ33veD+oJs4M HB/A8RaZpdExg88GOHd2LFqy+E61IuajUBH7RdBBjBpOYmdiGZngc/xNwVNXQv12oG36 L+hPxbfFwSnJY3cwaxxJ4CftzqBVVIr6e4X6qghEGqbOvkKwJuJLoSOWJLkZ2j4nQfAp 0yfQIitxi3Goqzdu2xUQ79MCNVSkuBb6YZNs2oM2cN/c3mCKmAq4fr/NWa7pTphC8JxE C+jQ== X-Gm-Message-State: AIVw113X7sLn+yimlflz/sIjLTZ2CHtGHTfhYmOah52DkRo71PiG5Y/K wFlZ/KHo7nrVJmu+OmzasQ== X-Received: by 10.84.138.3 with SMTP id 3mr13498090plo.272.1502096046803; Mon, 07 Aug 2017 01:54:06 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id p77sm12604047pfi.153.2017.08.07.01.54.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 01:54:06 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 7 Aug 2017 14:23:05 +0530 Message-Id: <1502095997-31219-14-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> References: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 13/25 v7] 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;