From patchwork Mon Jul 25 08:01:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 12927826 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 BA329C43334 for ; Mon, 25 Jul 2022 08:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233408AbiGYICI (ORCPT ); Mon, 25 Jul 2022 04:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233254AbiGYIBn (ORCPT ); Mon, 25 Jul 2022 04:01:43 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F8F0C4D; Mon, 25 Jul 2022 01:01:23 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id 6D3C55FD0D; Mon, 25 Jul 2022 11:01:21 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1658736081; bh=clwHLJbaAdIOxlNPZw2nq1Q/tNfbQXWFX/0A1JAfY1A=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=JSJb3jvdz27xbfWwjpzAyXwjiBz1t+R9hEP6DBSuP/icxq/lSxSJpirmts2mZVpHc 3sdJE6TbMr69rpJFKvE+rdlw1eQ6tjrf4PPKRCGKl39BoTWWrMXSpp5mLwudktu36m NQ0eBeIASqh8WIh5xWzseHOSLEMqczHpYXoPIbdC5cPqICzXM7mIhG5hcozWHLFxeI bxZmU9JOIbqWDz3bCLomb44FZtw1rHyRp7ISFILWyps08JXbY04ljpQqiJDsn1Du8f kPnsBctDmZTNDPktCzgohpBjTIC/qbZ5d9emSDvICqowJeUH9xnHfXl8ISdALO4hBm 1uTzFKHlJWZTA== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mail.sberdevices.ru (Postfix) with ESMTP; Mon, 25 Jul 2022 11:01:20 +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 , Arseniy Krasnov , Krasnov Arseniy CC: "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "netdev@vger.kernel.org" , "kvm@vger.kernel.org" , kernel Subject: [RFC PATCH v2 3/9] vmci/vsock: use 'target' in notify_poll_in, callback Thread-Topic: [RFC PATCH v2 3/9] vmci/vsock: use 'target' in notify_poll_in, callback Thread-Index: AQHYn/yuG7nDISN+mkeT5PR9a2L0xw== Date: Mon, 25 Jul 2022 08:01:01 +0000 Message-ID: <355f4bb6-82e7-2400-83e9-c704a7ef92f3@sberdevices.ru> 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: 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 This callback controls setting of POLLIN,POLLRDNORM output bits of poll() syscall,but in some cases,it is incorrectly to set it, when socket has at least 1 bytes of available data. Use 'target' which is already exists and equal to sk_rcvlowat in this case. Signed-off-by: Arseniy Krasnov --- net/vmw_vsock/vmci_transport_notify.c | 2 +- net/vmw_vsock/vmci_transport_notify_qstate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/vmw_vsock/vmci_transport_notify.c b/net/vmw_vsock/vmci_transport_notify.c index d69fc4b595ad..1684b85b0660 100644 --- a/net/vmw_vsock/vmci_transport_notify.c +++ b/net/vmw_vsock/vmci_transport_notify.c @@ -340,7 +340,7 @@ vmci_transport_notify_pkt_poll_in(struct sock *sk, { struct vsock_sock *vsk = vsock_sk(sk); - if (vsock_stream_has_data(vsk)) { + if (vsock_stream_has_data(vsk) >= target) { *data_ready_now = true; } else { /* We can't read right now because there is nothing in the diff --git a/net/vmw_vsock/vmci_transport_notify_qstate.c b/net/vmw_vsock/vmci_transport_notify_qstate.c index 0f36d7c45db3..a40407872b53 100644 --- a/net/vmw_vsock/vmci_transport_notify_qstate.c +++ b/net/vmw_vsock/vmci_transport_notify_qstate.c @@ -161,7 +161,7 @@ vmci_transport_notify_pkt_poll_in(struct sock *sk, { struct vsock_sock *vsk = vsock_sk(sk); - if (vsock_stream_has_data(vsk)) { + if (vsock_stream_has_data(vsk) >= target) { *data_ready_now = true; } else { /* We can't read right now because there is nothing in the