From patchwork Mon Aug 7 08:53:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 109543 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2482232obb; Mon, 7 Aug 2017 01:56:10 -0700 (PDT) X-Received: by 10.36.142.131 with SMTP id h125mr172947ite.7.1502096170802; Mon, 07 Aug 2017 01:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502096170; cv=none; d=google.com; s=arc-20160816; b=Ke5+PgHhjI6E9LB6GqtCbvxJjNNmy8DDKzLoozbGP5bWZtEwNOs3VUOhvLhD8UwgZS NvwaDufsr3b7dMTQeMso/LJYxseR24JUb3VoFJlLbW3BtofJSrIedY+JjDY1Mz+cxuca af0mDxBw9+OwgEAtbxMQNAHUsxtPaqfRuZ9He8XTznju1gzCbNkKK24rn1YlhTiBzHWh MocqTvPfZBAM7uy8VBJVG0rLjlpJpbuGrIjfMA+idctSZw0eQ3YQwO/3jp3yeCl7rVfg KeOBQdDBZTn8otNPsrHLyrtfH/i/XzmFpnGc1ckU3J9Y2dWsSg+i4HjmI91IbRzoycJX KZAA== 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=4HmeNHSctFtvf+CVS0U2qVgUjTt688zOnJbR8kHkIhU=; b=H6zPpvuw7Wx8QTrrfOnInwPoxGuRR+O2e3op8IQVv3x2HRNezO9UgEGQhYVkPKVW0M WfKajrAhLbzklQD/KPAdB6YfK4+i0sdyEdGF0ZpsnC9Gccbtk6BptR3VwS8WkIED041c fjS6prk3I/STv4AFrg0jCSibOG7dctFc/wBCBxeQMJyrI85H4kAtutUHCIm4gVTpNOm7 8s61mqtVtpck+XplynZDqgWNhoF6np0PqA8fS1CKZhYCohmoqk/ABL3p1Dgnqrj+xKiV jg0HZ6Gfvmo++S5syjJ1YPzyGbOqHWMailvBmpp0JBkHGt74BvsBvlizdqvZR/Ak2atv vqww== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=LUd5rWKn; 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 x124si8181721iod.149.2017.08.07.01.56.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Aug 2017 01:56:10 -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=LUd5rWKn; 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 1dedni-0004m4-Fz; Mon, 07 Aug 2017 08:54:14 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dedng-0004ja-Uq for xen-devel@lists.xenproject.org; Mon, 07 Aug 2017 08:54:13 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id A8/34-02176-3BA28895; Mon, 07 Aug 2017 08:54:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRWlGSWpSXmKPExsXiVRuso7tZqyP S4NwWaYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPDww2MBXf4K3ZOPcfSwNjO28XIxSEkMJNR YuWt3UwgDovAPGaJxxdusYM4EgL9rBIb329m7GLkBHLSJHa+P88EYVdKTLr1BMwWEtCSOHpqN ivEqDYmiQkbFwElODjYBEwkZnVIgNSICChJ3Fs1GWwDs8B8RommSb1sIAlhgRSJBa8XsIPYLA KqEicnfWQFsXkFfCRuNkxkh1gmJ3HzXCcziM0JFD9/6Q0LxGJvidvH+hgnMAosYGRYxahRnFp Ullqka2Sml1SUmZ5RkpuYmaNraGCsl5taXJyYnpqTmFSsl5yfu4kRGFz1DAyMOxgb9vodYpTk YFIS5Y1f0RYpxJeUn1KZkVicEV9UmpNafIhRhoNDSYI3QbMjUkiwKDU9tSItMwcY5jBpCQ4eJ RHeF+pAad7igsTc4sx0iNQpRmOOSQe2f2HieDXh/zcmIZa8/LxUKXHeHJBJAiClGaV5cINg8X eJUVZKmJeRgYFBiKcgtSg3swRV/hWjOAejkjDvJJApPJl5JXD7XgGdwgR0ypvEVpBTShIRUlI NjD2rmYLVnrL9vO3KqJLAf/8496bWVbdf32Plv9tdv/XbJ28xEbYls78vfmrezbtK+Iae1Fb5 Ip3ZVz8d0FrxzVh2SmKUu7MHy1NWKUPef4rVBh2z79xcOoEhKYVzy6yYdcVtU4qPL6sN+Ttt7 vQ/dpcmlT0ouf6hsVXz33OeGq8pYVNYdfeaHFNiKc5INNRiLipOBAAKcjUvugIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-31.messagelabs.com!1502096050!108710543!1 X-Originating-IP: [74.125.83.44] 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 32456 invoked from network); 7 Aug 2017 08:54:11 -0000 Received: from mail-pg0-f44.google.com (HELO mail-pg0-f44.google.com) (74.125.83.44) by server-14.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Aug 2017 08:54:11 -0000 Received: by mail-pg0-f44.google.com with SMTP id y129so31668983pgy.4 for ; Mon, 07 Aug 2017 01:54:11 -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=mYozS+nQ1yf9epDA8ZcGc8wJCUO5kNWx++UC3Kttf7g=; b=LUd5rWKnbgymAoIDBt73vYDqDna92q4WoczCvdMGN28IrcU84+sFGvsgSArLz3AF8G zZrtc04s8PPxaVXvKKIjmHm5DppyO26znDeicI+oStzjihAqGHlHprtAuH7+8qE+S5MZ 4E+rEkNnNyWTuk0LczWHZC2LJSjNZMCgHZshg= 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=mYozS+nQ1yf9epDA8ZcGc8wJCUO5kNWx++UC3Kttf7g=; b=tQxxWmq0mLgECaxon37yMqX1YelskpEwLDgm7QfMzgiztupKXF4T3urZCa34/C6juC aDSTBZ6xUAbARpBfVMPWEStL5YsyE869xFmOI1RqYQjl2vjexYy12mIB8IzLPSt0CXil IRevyrFBCi3jWw5qPpm6K84x80Q01LwhrxXmU3TC97PaH0qvMoS4Gz5j9GsUxtUzrbRu XGpw+1MsRojfGLRr7ZnwAL+6qrALbwXNuHj79G0h9RYK9ljKwp8KoMuVE9yqUTWGT76j OFOHREr2G3QZCj8nFXd76sdqveAnMxw0Z+WPgr0K7wTwmApD8/n4Ghl4zVS8WSS5boxx kJuw== X-Gm-Message-State: AIVw111BN7FIXEy1Ts0CgZzPa3sgFX6rmMYHLCT6oS7/uQfzImb0T6Vo p1v92DCiY4rBnpMyRB8mxw== X-Received: by 10.84.130.108 with SMTP id 99mr12864756plc.76.1502096049772; Mon, 07 Aug 2017 01:54:09 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id p77sm12604047pfi.153.2017.08.07.01.54.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 01:54:09 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 7 Aug 2017 14:23:06 +0530 Message-Id: <1502095997-31219-15-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> References: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 14/25 v7] xen/arm: vpl011: Add a new maybe_add_console_tty_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_tty_fd function. This function adds the tty fd to the list of polled fds. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v6: - Renamed add_console_tty_fd to maybe_add_console_tty_fd since it adds the tty FD to the poll list conditionally. - I have retained the reviewed-by tag as only the function name has been changed. Changes since v5: - Split this change in a separate patch. tools/console/daemon/io.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 3483252..a0b35da 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -1067,6 +1067,22 @@ static void maybe_add_console_evtchn_fd(struct console *con, void *data) *((long long *)data) = next_timeout; } +static void maybe_add_console_tty_fd(struct console *con) +{ + if (con->master_fd != -1) { + short events = 0; + if (!con->d->is_dead && ring_free_bytes(con)) + events |= POLLIN; + + if (!buffer_empty(&con->buffer)) + events |= POLLOUT; + + if (events) + con->master_pollfd_idx = + set_fds(con->master_fd, events|POLLPRI); + } +} + void handle_io(void) { int ret; @@ -1146,19 +1162,7 @@ void handle_io(void) maybe_add_console_evtchn_fd(con, (void *)&next_timeout); - if (con->master_fd != -1) { - short events = 0; - if (!d->is_dead && ring_free_bytes(con)) - events |= POLLIN; - - if (!buffer_empty(&con->buffer)) - events |= POLLOUT; - - if (events) - con->master_pollfd_idx = - set_fds(con->master_fd, - events|POLLPRI); - } + maybe_add_console_tty_fd(con); } /* If any domain has been rate limited, we need to work