From patchwork Mon Sep 18 10:31:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112894 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501273qgf; Mon, 18 Sep 2017 03:35:00 -0700 (PDT) X-Received: by 10.36.254.135 with SMTP id w129mr17225351ith.93.1505730900377; Mon, 18 Sep 2017 03:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730900; cv=none; d=google.com; s=arc-20160816; b=WsB0sj854pTlUcU2UDbhewGQAQuQhoCGolY7QjXCvrRvfYk5odBgG/Tsn33k59OUva 3p/4fE8c3o0xyW/UzQRO1+atJ7VxoRP8563SGOiY6gXvHiWguK6xUh8aF60U+zMcYiTS FawmKTI84sOoImbam9KOHaFM+g9g2GCQjabMlY2Lr0KpFzhO0Fuc7dJJZyD4Z/IGt2K6 YEY0YZlhWuWOrjB4aQQkwBFfnZhGwUa5qBSRy35V8LX4I6iBE/jJGLqEZ3qTFvMNFAsT aYhuEGDfoB5UtY6LymmxTFmR0D7osXlw3pUcy43aZj9ThdqBISX1gBkmUxzKQQFMUO2W 7K+A== 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=CIh0nWro8fh5EH/h5e/lK5FHuC/Y9EscScdtvisQIoUQHL72+d21ZS4EHu11JnzE0m 0HJifxNW8dLc3prW6slsL6+do6h5CB8lShLDusnkuTb4s90HSK47/CweO/hIer3RF1ZH eJl20h6ZDCOfHy2DPaqGXY8Lo9fg7KKIadYuKPqOtWYxqjtF0xQyFVy9Dk/rekO+DeRR RhGqQ2WcC52pUVrfOr+Rs1uvRD0Es+o8WAtnfgIKpGl8t4bI6qljiupekU73ZQ/w2f+E QroDsCfxOxAPQeGxUYFXTfoIMVx6jH7y8LPPqpI567Ykpb7/MZ3Xc7sDRnCIUYWV5457 mw6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Lnd7fp1J; 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 99si5273636iom.222.2017.09.18.03.35.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35: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=Lnd7fp1J; 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 1dttMO-00029R-JC; Mon, 18 Sep 2017 10:33:04 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMN-00028K-MQ for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:03 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 5E/6F-17770-FD0AFB95; Mon, 18 Sep 2017 10:33:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVyMfTAZt3bC/Z HGhz8p2jxfctkJgdGj8MfrrAEMEaxZuYl5VcksGZ0b5zBWLBFqOLhhZNsDYz9/F2MXBxCAtMY JRZP/8wM4rAIzGOWmHT+G5gjIdDPKnH1bT9rFyMnkJMm0XfqKwuMfWDOamYIu1xi96SzYHEhA S2Jo6dms0KM3cEkMWPhMsYuRg4ONgETiVkdEiA1IgJKEvdWTWYCqWEWmM8o0TSplw0kISyQLt Hb8A5sGYuAqsTZY9PBbF4BH4lbLRMYIZbJSdw81wm2mBMofn79A1aIxd4S835dYZzAKLiAkWE Vo3pxalFZapGuhV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmDIMQDBDsbZl/0P MUpyMCmJ8opG7o8U4kvKT6nMSCzOiC8qzUktPsQow8GhJMFbNh8oJ1iUmp5akZaZAwx+mLQEB 4+SCO86kDRvcUFibnFmOkTqFKMlx4U7l/4wcRzYcwtIdty8+4dJiCUvPy9VSpy3DqRBAKQhoz QPbhwsQi8xykoJ8zICHSjEU5BalJtZgir/ilGcg1FJmHcZyBSezLwSuK2vgA5iAjqoZccekIN KEhFSUg2MEfFPuf4wctqftD4x94Ky97l1D105yzp5Vr+5/fxHauXSRd779r44yuYdozGL/R/P 6TTtCeEWRWxbr+/0lJ0mdX7z4nkLt7gVf986X0T/1RHlnF+zX++YXK3IcKRNYdLEHFfbLSLyG wUNVy3kz7i88kffQnG73r0ZzGWv2AWyApaIiN4zZvRQV2Ipzkg01GIuKk4EAF8lf+XLAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-2.tower-21.messagelabs.com!1505730778!69432302!1 X-Originating-IP: [209.85.192.179] 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 614 invoked from network); 18 Sep 2017 10:32:59 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-2.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:59 -0000 Received: by mail-pf0-f179.google.com with SMTP id y29so37355pff.0 for ; Mon, 18 Sep 2017 03:32:59 -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=Lnd7fp1JKtxKJuLBNH3IA8oPeJ4p0dSQ2DjEN8NKUbtdEWBps+fMeMrBrX5KK6POyw wJblssio13+L1wQg+PS2h7oJcuhQE4Fm0H6HoMjZXM1YFQVk4lkZgmPk0lkprsWKJngm Zr/+xWgqQytS+kmuhFsl7h99ijb5xtpZCfkLs= 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=EaATRwk4YEtkokvDta+EjmJstz2N37mlWrrDfew8sp4wKxwZkXZFJk6LWp+ruoB3e5 1eLMMGANX/7NHFbRxJtYaPAMxeexZ4lGXEgTUM+IDOoXz3Ehto+3dqD8afGyiyHWnFE6 vXjD53Dl7ZoRCE4S5ddBNjHIIeaQv/gHWxmzL6brzgefAg8wV7pzETdSxviQzf3EpWsz 2JX8OzUmadbkg3+EKJhqlOCsa2456K7UWp6WdQULxF7v/YArOuLPgAcGFA0Mz3xkDG4p H87DCJPnqm+zrhEWamqmgSYj0hONl3/MV49fdHcA3H0hV0ldZjYufDcbEoRcUUDXB6f7 3LOw== X-Gm-Message-State: AHPjjUgKLTjGnm9pvw4EEqfKM1X/8+LUtD2ensGy9Cm4vL2jjdIsvAG0 EJfwG7RUk5+nPpLkpBLyxg== X-Google-Smtp-Source: AOwi7QBezFypTGaXuXni7b++vYBoD+e5KC8j3zxTMqculd8jqsNYH7cw3lcbDozeez637Z1nPcOtRQ== X-Received: by 10.101.72.5 with SMTP id h5mr4898059pgs.305.1505730777985; Mon, 18 Sep 2017 03:32:57 -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 b7sm12937845pge.79.2017.09.18.03.32.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:57 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:57 +0530 Message-Id: <1505730731-10947-14-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 13/27 v9] 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;