From patchwork Mon Jul 25 07:56:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 12927816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80189C433EF for ; Mon, 25 Jul 2022 07:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232492AbiGYH5X (ORCPT ); Mon, 25 Jul 2022 03:57:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbiGYH5W (ORCPT ); Mon, 25 Jul 2022 03:57:22 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3305FD135; Mon, 25 Jul 2022 00:57:20 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id 7EEF45FD0B; Mon, 25 Jul 2022 10:57:18 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1658735838; bh=3yFDKShsdzLtXczy78DAfWUgL5KDQChLK4zk2QgRds0=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=EGu2Dbrm/JzyVU9s17oiJ4dY2K+UGlqrAuSJazSarGzav5+kEnjvT9NLhiO3MAtzY B4hY3uiJuy4ewR9VYVJXcWjwWTg6AfDWEZ0g8AGlQuE/P5ZcNThMwenBSLnpt1oK7r /zV/5iPkuwnITY+xbjl5T5j21MrKqfi69r7bM33ZHZh/X2CDTOSLhfykFOs7glH47Z gH6wryAX5DRKyndQQUSkZuooBhlv4akGpTjyoCVIxRHmRxPXBHNLFFqCGQ0dYEoW4c wT7xlN4kG8QUZNIgyWvYvbffFoKMuh1FYgZjxMmzfgGupPCvE7U1yE2AieaC4kweBj ODTc/xd9LblQQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mail.sberdevices.ru (Postfix) with ESMTP; Mon, 25 Jul 2022 10:57:18 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "David S. Miller" , "edumazet@google.com" , "Jakub Kicinski" , Paolo Abeni , "kys@microsoft.com" , "haiyangz@microsoft.com" , "sthemmin@microsoft.com" , "wei.liu@kernel.org" , Dexuan Cui , Stefan Hajnoczi , "Michael S. Tsirkin" , Arseniy Krasnov , Krasnov Arseniy CC: "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "kvm@vger.kernel.org" , kernel Subject: [RFC PATCH v2 1/9] vsock: use sk_rcvlowat to set POLLIN/POLLRDNORM Thread-Topic: [RFC PATCH v2 1/9] vsock: use sk_rcvlowat to set POLLIN/POLLRDNORM Thread-Index: AQHYn/weV9iJ1kN02k+zjfwbZg+ycw== Date: Mon, 25 Jul 2022 07:56:59 +0000 Message-ID: In-Reply-To: <19e25833-5f5c-f9b9-ac0f-1945ea17638d@sberdevices.ru> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-ID: <8ED96AEDE2917D419B416B6B7150A4C0@sberdevices.ru> MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/07/25 03:52:00 #19956163 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-State: RFC Both bits indicate, that next data read call won't be blocked, but when sk_rcvlowat is not 1, these bits will be set by poll anyway, thus when user tries to dequeue data,it will wait until sk_rcvlowat bytes of data will be available. Signed-off-by: Arseniy Krasnov --- net/vmw_vsock/af_vsock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index f04abf662ec6..63a13fa2686a 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1066,8 +1066,9 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock, if (transport && transport->stream_is_active(vsk) && !(sk->sk_shutdown & RCV_SHUTDOWN)) { bool data_ready_now = false; + int target = sock_rcvlowat(sk, 0, INT_MAX); int ret = transport->notify_poll_in( - vsk, 1, &data_ready_now); + vsk, target, &data_ready_now); if (ret < 0) { mask |= EPOLLERR; } else {