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: 9956391 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 A171260569 for ; Mon, 18 Sep 2017 10:35:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D02728C09 for ; Mon, 18 Sep 2017 10:35:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81A8A28C17; Mon, 18 Sep 2017 10:35:36 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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 1253528C24 for ; Mon, 18 Sep 2017 10:35:36 +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 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" 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;