From patchwork Fri Sep 22 08:23:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113987 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011258qgf; Fri, 22 Sep 2017 01:26:12 -0700 (PDT) X-Received: by 10.107.21.1 with SMTP id 1mr4548579iov.209.1506068772421; Fri, 22 Sep 2017 01:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068772; cv=none; d=google.com; s=arc-20160816; b=lBmtxR5WlF5JxdoqT7VrGpyf3jxuI9g1cx9hh+3n8R9w4BI4gMRhJMLgoOZ9bDxRzX /83k4OaYLDb7+Ow+oktRYNPAqVftRkNVMgfXdi3OEJe7geeP8Ay7a6H7K9JeZJSJ9bd0 BHI0u9+5E/CdXzhz6TDi9IvXiAUV1Jj7eEhZ/E/aQV3HKdLKKl5xV9jGUTPAw1NF2h8L HFimsMlfHt5yPAe4AeYkTQBou4wK4kmv2iY+Q9vtnhDuOTx+fQCa95cuo+8sYfA+MKj0 IQI3IDcASrgiVXsAgzwH8RdpoK9N5cLR0HGyhhKaQacrvBSN/GnjRmfupeBAjlzg6ET3 4uWg== 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=vyYTQ42ONI5WJMaLA/Koav0DiFraK8SRrKQKe4YGpvUOBfdtfoSWB14Bs22MHoKs+G DdXR/1Uz8BglMYaFXgSkWBz228hrieqELWuxpgKJIcvyb/c1d1F64lcU6Ea939veJ4jp tJoY8cYGdV25mSIh5VOJ8seOKakDQc7WWmtcyu3qEUzNgIsjc+qaVKlkCrDm/hjG79h4 HcJ6/Te4OvzQahPZ1npyc7S6X5KGPJaipsI4ZXrzG1VBMYDhbO0DBQla0vZadIBEN5ht UTyUbboUi3k8/wlbVVyHpfhDLtf5uLF0vuylwKpwjYOgQ53eXVm5/1sZ4mpS3pzbVz4R y2KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Dgq6FM5d; 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 m2si2867789iob.265.2017.09.22.01.26.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:12 -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=Dgq6FM5d; 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 1dvJFx-00043G-Cl; Fri, 22 Sep 2017 08:24:17 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFw-00041k-C7 for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:16 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id 36/12-03616-FA8C4C95; Fri, 22 Sep 2017 08:24:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVyMfTASt31J45 EGqw+yGfxfctkJgdGj8MfrrAEMEaxZuYl5VcksGZ0b5zBWLBFqOLhhZNsDYz9/F2MXBxCAjMY JXrvr2UHcVgE5jFLzD61gAXEkRDoZ5V4uG8KaxcjJ5CTJ/F1zzm2LkYOIDtNornDCCJcKTH10 GM2EFtIQEvi6KnZrBBTdzBJ7PpyjAmknk3ARGJWhwRIjYiAksS9VZOZQGqYBeYzSjRN6gVrFh bIkFh27T0ziM0ioCrxa+tUsDivgI/E4dUrmCGWyUncPNcJZnMCxdf+38ACsdhbYuuNqywTGAU XMDKsYlQvTi0qSy3SNdZLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMOAYg2MHY 8c/pEKMkB5OSKO/jI0cihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwfj8OlBMsSk1PrUjLzAGGP kxagoNHSYQ3HCTNW1yQmFucmQ6ROsVoyXHhzqU/TBwH9twCkh037/5hEmLJy89LlRLnnQ/SIA DSkFGaBzcOFp+XGGWlhHkZgQ4U4ilILcrNLEGVf8UozsGoJMx7HWQKT2ZeCdzWV0AHMQEdVL4 a7KCSRISUVAMjl6FR+QqeKT6qv05pLtgjEWfpcdtxj1jSijLJu0qTIh6ci/nXcWVm8Y67Yi/Z i3+EMHg/knjYrma04OVz5+71DzVqNvg1cMVwbF/EHRv33aLLWtFIkOmCTJjVbuYHS5pTeLif3 ro0t/vF++CPL++zliTMF9tzULlpqUCGXaj3Hb4wr9ebT91XYinOSDTUYi4qTgQA8Rl4ZcoCAA A= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1506068654!77458929!1 X-Originating-IP: [209.85.192.169] 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 35707 invoked from network); 22 Sep 2017 08:24:15 -0000 Received: from mail-pf0-f169.google.com (HELO mail-pf0-f169.google.com) (209.85.192.169) by server-10.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:15 -0000 Received: by mail-pf0-f169.google.com with SMTP id l188so236517pfc.6 for ; Fri, 22 Sep 2017 01:24:14 -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=Dgq6FM5dXh+tR7MJ2xVvxfEihnwqQXU9o+U++27UMVWFwUbLA5Z/19CIo+hH1lr7jJ z5QaePyuOKO0i/Y1E4URv7S0pXw/x88VIGOfeMnZIt3kAR7LKbbDgqBUpgiDBKIFJMd5 2g6WcayyOOHIC/GKS+CgGqBxBg585LB23cw2w= 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=M7m7zzzRuRRT4MulPZR83W1o6oAYxBhEReMPZBSck1/XKMnJg4sL58BdLBKAA2AGIb FcKy///q0DABa+ttrZN/2VaRrwIe8GvEY/E/MCXNxqMOI2YS7nc0fm+Phf/zrDSjxq87 o4Fs2AE7O1aBuXsif/w2Eif55B+6LzT1HM9z+BusL06xYvC/TE2F2sqb0lbDzehgR7qU NKjZvZ8M2Ru6mCgUbSUOC0djG7v+m75cl6HlF5FiOqNXKENviwonr36Te6ZksOmH5MIX 7RccHsNSC07iPh9C7gAQrakoDV15LLEgfq9ApKxvsYagsx7MgmFFnRRePASe2QmCzoE8 MkhA== X-Gm-Message-State: AHPjjUgu67o5lnEY2eNE+CB0vFlY4L00cXvjVytlT5fFuiR0KAt6ykGA /NB/maE5rCTTe0/BLXNMgw9z05G3WNo= X-Google-Smtp-Source: AOwi7QC5uHnxZStSmJt3160o/gRPkDfHN52hJmxo+KHTyt+zSrUMcimBezUMZHsqXgFLJ322dEzruw== X-Received: by 10.99.135.193 with SMTP id i184mr8592058pge.5.1506068653518; Fri, 22 Sep 2017 01:24:13 -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 f74sm5569284pfa.36.2017.09.22.01.24.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:13 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:12 +0530 Message-Id: <1506068606-17066-14-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 13/27 v10] 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;