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: 9884763 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E42F6603F2 for ; Mon, 7 Aug 2017 08:56:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D826F285D1 for ; Mon, 7 Aug 2017 08:56:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCDA5285E8; Mon, 7 Aug 2017 08:56:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74D0E285D1 for ; Mon, 7 Aug 2017 08:56:14 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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;