From patchwork Mon Jul 17 13:06:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 107951 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4495310qge; Mon, 17 Jul 2017 06:09:34 -0700 (PDT) X-Received: by 10.107.62.212 with SMTP id l203mr22403312ioa.162.1500296974927; Mon, 17 Jul 2017 06:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500296974; cv=none; d=google.com; s=arc-20160816; b=cC2CZngZDAyBlgnEybYtNzQYXMlxh/IlZC05Rgz1MPFY2QdAFOl9Y0xPhW65Bc3gH0 DC9Cul2L8KbBuyHP3rGKiXev9YtxyFq3OUy7DntgXH1DZ08Dpex6VvM65AUx1SF/hoZZ ng4GS48pMUrYs38wvgtXZR6g/Du90jBWz47RI/hYc521O/C8X5mgSR3Tix94p9fEQt/X sXzmH2+cxYu71gCKUk5XEQxlM5e0xZARNh1Oh54gvJ5Md/+4hq2L05u2t5HKG4WubdEe zbG/nj3SB88V7QX5lsuho0ejnY9QtZZ9wIXClGeEoC7KzWU0mhvBOG5lk9cmbxl3UCcn fBfw== 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=SuDvKpAyYJtzewclbCuh8T9UybaQKqE4/6eNlguqOtQ=; b=ev2r127sPalpa2PZa+sT5aVMDWGE23i0jErSyW4aeBpkzV9JUAzWfiEQys0LuyFYXi BULXFf3bboKTEKdwpktBTdj7piBHywDqTdsFQ17hn8CSXM93hxglHVgZGXyA44/4ipkZ H3SLyi8qLY+6qSPyCEIQ9fds0OyR05KY7QQfC/XrSdnmgBApPUwgKgfehxr2HhQWg5oh b1wqBQN2CplKGvyfkuV/pixHIY4Af/wbYNytiAkmSjM6Wqqsj/QuWQznqPId+OjEWSc0 YMsuv+NV18iakAZzSVXoMNNok2uBekoQuQQ+KGc7zNrOZYzKPVfpUUbfUlEuCps5UsMQ Gb4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=VoNq4npU; 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 o123si16136354iof.26.2017.07.17.06.09.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 06:09:34 -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=VoNq4npU; 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 1dX5kX-0004XV-VJ; Mon, 17 Jul 2017 13:07:45 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX5kW-0004Vf-LN for xen-devel@lists.xenproject.org; Mon, 17 Jul 2017 13:07:44 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id 23/CA-22472-F96BC695; Mon, 17 Jul 2017 13:07:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRWlGSWpSXmKPExsVyMfTAZt3523I iDX5uFbH4vmUykwOjx+EPV1gCGKNYM/OS8isSWDM+9D5hKfgtUPG4awNzA+Nz3i5GTg4hgRmM EisO53YxcnGwCMxjljh8+RYriCMh0M8qsXfFAXaQKgmBNIkDF1YxQ9hlErM/LWKC6NaSOHpqN liDkEArk8TFPe+BEhwcbAImErM6JEBqRASUJO6tmswEUsMsMJ9RomlSLxtIjbBAosSXmVUgNS wCqhJXZ7eCzecV8JGYsuw61C45iZvnOsFsTqD4mQ2rofZ6S9w8MpFpAqPAAkaGVYwaxalFZal FuoYmeklFmekZJbmJmTm6hgbGermpxcWJ6ak5iUnFesn5uZsYgYHFAAQ7GFds9zzEKMnBpCTK e5EtO1KILyk/pTIjsTgjvqg0J7X4EKMMB4eSBO/mrTmRQoJFqempFWmZOcAQh0lLcPAoifBuB UnzFhck5hZnpkOkTjFacly5su4LE8eUA9uB5KsJ/78xCbHk5eelSonzrgBpEABpyCjNgxsHi8 NLjLJSwryMQAcK8RSkFuVmlqDKv2IU52BUEuZdDjKFJzOvBG7rK6CDmIAOEvYFO6gkESEl1cA 4c++xNOeyqP2as7bI/5TdZ/rx7Q+b4rCNrE5TuYUfTVr89sHvRb+PH1+c+mfPeqnEnOSJbLOF DlrH6sY0Kp/Z1G/3octLaFd48fywENuTaaeO5swuE7599opCYpZWw6T+7B+vFYxnL39ieJrtj 6maY3hUis27Iz+q/8ts2n5O1rvC4chLgZ+dSizFGYmGWsxFxYkAafMppL4CAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-31.messagelabs.com!1500296862!102568789!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.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 65144 invoked from network); 17 Jul 2017 13:07:43 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-5.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jul 2017 13:07:43 -0000 Received: by mail-pf0-f179.google.com with SMTP id e26so8422108pfd.0 for ; Mon, 17 Jul 2017 06:07:43 -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=37oZi0nu7UAyMXiV7hqqdTBmxWHw3BJBPX8/0GlkuXE=; b=VoNq4npU//veoODrJKoAdD5iYxy/TvNhkzYnt0CE5b9Rynv5HVYfcJebbXYUqNLnD8 lOaB1SGkwTbDdlxlD4w6w0pnRkgdoQgwfYYyPIVvB2DHvMP1vOmgfVMisWwffP04HhUL VOq0iZgI7h2unMTr9yJgtq+Xv5mwoJ7yJNnCk= 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=37oZi0nu7UAyMXiV7hqqdTBmxWHw3BJBPX8/0GlkuXE=; b=ZX98peAWjq6kJAcLg5jixK8Wggg7qxZSL/jortjtLfMNsHl5RacrOY4Rw3upMCQGUr Su8oL3SGw/U9W45hH1ScVO8RLwLz0aH6y8LQbktC6m4BAGYh14l+ljsCT7pGnXtHZGrK J/lZC5mQO6oUj5lq8ZPclXJnkTTw88I8d6+Zg6HZN10tAYq47Sr1CcNXLj5e1Kkp9JEt Hp34jUREDQ8Q/5HdcNIclKuSxCQM7802ZvOU0LSKKGRn8uasXQgUFhP19M08GRCagtXm kW7fg0hvHNEoHqZQ9vIxj0xNbMUGHNpEztyiK3875cx2WIsDqeRfcZ5tXD6Fy3ke9xPb EChw== X-Gm-Message-State: AIVw113zMroAnCPeQnjpX+YN48xCVSm2LuZdqmFzHewdUhLLSeJ7A45s yj5c8phHLbeBBGmt0TE3qA== X-Received: by 10.84.229.1 with SMTP id b1mr593518plk.273.1500296861670; Mon, 17 Jul 2017 06:07:41 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id z69sm15705665pgz.42.2017.07.17.06.07.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 06:07:41 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 17 Jul 2017 18:36:43 +0530 Message-Id: <1500296815-10243-14-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> References: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 13/25 v6] xen/arm: vpl011: Add a new 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 add_console_evtchn_fd function. This function adds the console event channel FD to list of polled FDs. Signed-off-by: Bhupinder Thakur --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v5: - Split this change in a separate patch. tools/console/daemon/io.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index e4882e2..dc96203 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1048,6 +1048,27 @@ static void reset_fds(void) memset(fds, 0, sizeof(struct pollfd) * current_array_size); } +static void 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; @@ -1125,18 +1146,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); - } - } + add_console_evtchn_fd(con, (void *)&next_timeout); if (con->master_fd != -1) { short events = 0;