From patchwork Mon Aug 28 08:55:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 111116 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4548109qge; Mon, 28 Aug 2017 01:58:53 -0700 (PDT) X-Received: by 10.107.145.2 with SMTP id t2mr4937546iod.160.1503910733542; Mon, 28 Aug 2017 01:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503910733; cv=none; d=google.com; s=arc-20160816; b=sGj1XOnSKl9iYaI24oldyvJQp8jyaj7D96EwDPtLlBdfNbKbRjHPEnSSL7oEV803tQ lPWCqWfHpN13Ek9FSfpM9XOvLJ+P+2PlNJJOF5ZMKmvDnEQAq3gNWTS6OnRpJAX5W+wY ur9sv8Mhdu9wyU6T8yAb3aqdQRmMuaZ6IA86PCZFnLtnvf6Vn7MhlK9vevB2PbW4VsxE I69pag1Tt9nw/Wbfm5oHAP9iy1gDVIZj22Ua3iqPo2RLp+X+Mpmbr4L1EXbH6T3Rw0Hc NNaFihdAOBJsYD5rYXsey282+U/vDLxG1bFowVPFnf2Azz1OiKVQrCdUCJgREzZNBKAq D2Iw== 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=OWdnK/c9pg1KSm15nNbPYfKz3lmzpK/ywN6p98gEzULAyuLpNqMuHAM+1ajosr2P5r WqlEGQjFixvlapYMpDVxW/UDvYz0dogPptS5F1nRThMFyxIr0dg4IJaO3I+V01/LMNsG H0QnIonA/z3pyZO8YO8sAsBRvjNcc6MJv/6AS0JYmOjjbjXPRaDqDmv6IqTRu9s5TlHm h3eMknKBWT6BoSnqDx9xnCgg9zz31elkfkhRu/EDbEv0gYgffy9H9vbQDJ9s/e8GD/Ai bgk8b3zShIJ3nrPduNKgXJFJ7WuPrtgpfIUrPGhjQ9B+8RB1+eagbWN/mLfXvHl9zUb6 nFIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=beGOR/aD; 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 s40si11733357ioi.361.2017.08.28.01.58.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 01:58:53 -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=beGOR/aD; 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 1dmFqz-00057a-BH; Mon, 28 Aug 2017 08:57:05 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFqx-00055W-Og for xen-devel@lists.xenproject.org; Mon, 28 Aug 2017 08:57:03 +0000 Received: from [193.109.254.147] by server-1.bemta-6.messagelabs.com id 6B/EE-03414-FDAD3A95; Mon, 28 Aug 2017 08:57:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsXiVRtsqHvv1uJ Ig+1/1Cy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozujTMYC7YIVTy8cJKtgbGfv4uRi0NIYCaj xMOdj9lAHBaBecwSE24sYwZxJAT6WSVmv/4KlOEEctIkHp3qZYewKyW6N95iAbGFBLQkjp6az Qoxaj+TxOMv+4AaODjYBEwkZnVIgNSICChJ3Fs1mQmkhllgPqNE06ResKHCAukSn88dAxvEIq Aq8XDZLLBeXgEfiQN3uSB2yUncPNfJDGJzAoV3rL3LDrHXW6Lr9QfWCYwCCxgZVjGqF6cWlaU W6VroJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIEBhYDEOxgnH3Z/xCjJAeTkijv zorFkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeM/cBMoJFqWmp1akZeYAQxwmLcHBoyTC+wEkz VtckJhbnJkOkTrFqMsx6cD2L0xCLHn5ealS4rw+IEUCIEUZpXlwI2DxdolRVkqYlxHoKCGegt Si3MwSVPlXjOIcjErCvAdBpvBk5pXAbXoFdAQT0BGKggtBjihJREhJNTC2em1InWLTWNfzoeG +VtbBz2+OPJZRvGtW3ZHz027H78LSdeViD67GMWVK+S9MfeOv3+pvK7LloJdSu3evpEzrUa1/ tlURNmVHfZ7sOJK0oYVzcvPvl5ImzUd/sW7cXfbYravYaMnVLSFcrfNqBa76HdhkX3rpiqdCV k/A4vLyb3rTWlZrtSmxFGckGmoxFxUnAgD+4A3YsgIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-27.messagelabs.com!1503910621!108265385!1 X-Originating-IP: [74.125.83.49] 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 58043 invoked from network); 28 Aug 2017 08:57:02 -0000 Received: from mail-pg0-f49.google.com (HELO mail-pg0-f49.google.com) (74.125.83.49) by server-5.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Aug 2017 08:57:02 -0000 Received: by mail-pg0-f49.google.com with SMTP id t193so11124697pgc.1 for ; Mon, 28 Aug 2017 01:57:02 -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=beGOR/aDSbxc5THvLpqRprlmI7HjGMj12Hcq0hQDYqT41yJ29KlMOP1/KBHFXUrf2a TptYUT0QfdEkdvwupBPmHubUG6hnIt8yv9L4fnm3Y4V2YLBWGoo8f4QwkuTrwJkvLvHx VcHz7GTVt0zd2vNzxiXTqjiV8BciUShX3O108= 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=WODc1ldJAWKOJCCOUHQldCnEHmWYBUU/7NFZVeUTmPxJ+SRldZEly+1xxg2HN+knlR M7Wo+djaHfIYODXG1LGtmzjkh4vJFBCOv7wXNEtV6aD+ZIHQCwOc13CSVTtVb5x+CHsg /nobiXNnaJ9Mb/fW0dF0UmKMv4c6oLEtkd70k7L04Zxww55kkwqi03C+bEyGM9/GHG6t YKvBw/EqskpFrptn0zA7od4L1nkmjKHPvTNdkKvJt9kWPi6p8ubB5dG9Lz59kiBAek94 ZIk1lVJsgArpD8ifJuKo8v3LFNWWPHjBYNEjFTnnpdiVvJOv6vrNfrx2DEtZXOGpSPc0 vlnw== X-Gm-Message-State: AHYfb5j9MqJxREXk7aZ7BJk90rfofOU/NoLaqX9BhbpY7cCgJk0wNbiW dk0n9XEigTFIJakzl/xn6A== X-Received: by 10.84.216.81 with SMTP id f17mr7635770plj.176.1503910621065; Mon, 28 Aug 2017 01:57:01 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id d88sm21713569pfl.158.2017.08.28.01.56.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Aug 2017 01:57:00 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 28 Aug 2017 14:25:56 +0530 Message-Id: <1503910570-24427-14-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> References: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 13/27 v8] 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;