From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=W9k7XRm1; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 6CFF55A0625 for ; Sun, 11 Jan 2026 00:33:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768088037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0GHn/uCuvxQ2XGxpf0C+rGbqSWau4TgdnwkSyb21hm0=; b=W9k7XRm13bSY32ptH0FvrE1eXOo3IOcR1G/KHSCvX9WA2LyV3FhFeY1xJmksSFP/Pl3Y+Z iK7eQwNJPgXWJn1RD3uKNtv2DMarykkNGXWV/13EOgWRWpGNnWt5d8ghCTEDTAH9HUUiwb xvhxOLzvbaFK9cNTnA71UY+/ZfR1LDA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-369-kCTFrHr1PV-hCiR3nLCVxQ-1; Sat, 10 Jan 2026 18:33:55 -0500 X-MC-Unique: kCTFrHr1PV-hCiR3nLCVxQ-1 X-Mimecast-MFC-AGG-ID: kCTFrHr1PV-hCiR3nLCVxQ_1768088035 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-430fcfe4494so4268723f8f.2 for ; Sat, 10 Jan 2026 15:33:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768088035; x=1768692835; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0GHn/uCuvxQ2XGxpf0C+rGbqSWau4TgdnwkSyb21hm0=; b=do1XLEg5gCQfyL4yeGsDwu/VWvY2A/Wza07uV2OZ4u8sP7Qrr/1zDkM81fnA0HSAD7 WZj0dCXRzKWvBaA/CdCgfN4bKGwl4ZrxmNYhPfJNQChZdfGRW5ENjtfEh7mGywHk7Swx 945N2FbvAD8upE1YSMPlZ/4tUkPgdHNDe4l8GkE1bAEZWav8bXtAljmW868iY7luSkr3 hOXJR30pQwnUQmpp7it0KJSUO7ltpRG0a5w7cSTXSLP7YOTnEURwbl5ttcU41ch7MimW KPf0HQye0Ec2/cD2vW+6vo7zR29iPiAv0xWpr58JVVd5c/KWx4l25lVKcztpQX+Rl5DW rjCA== X-Gm-Message-State: AOJu0YyVeU/+XMB24gzCE2PS9kRA4SNbMvKJw/obORiQWteWJapLE0ap Fh+D9ywRFroaxPcQHX10CfhFy5kz7QOmJSy6as4WDYHUnBA7Jg6L7McJibPPmuqngpzFF6k2JOi 7nDld8Udh2pnlmpbAEHAMCDr39VQEoiG99dnaJtjZTC3wQKW8p5hZnw== X-Gm-Gg: AY/fxX65lUHqdrkLnvGH5sdAhBLyXna9NiVWFnpNQBDsU04phTU60PmIW/P8HGC0tV9 0tZSOAmWHIoVgERqrga7plzv4YqH/siVVzi9K/COonaxJIyaEMA+iJtG5H+goBsvoi9L+yrELxG Um8S2noYRA9OAUB60yuBwNKQycpIRV0WaIOrtz6ok0HCOv5FQt9jgdwZJozEYnLI1uxe6+Cuk1K PNuzSrlhlo0mlTTXB+8BuKcoBwZTfp1/kYN58s1a30R6XOHY5Wa0S+VfJlgBZgpLVWrR13tstHo Gs+BF1Z7zOG+vEul039RP81V9Kd7ZgkGhz9bn6GMOpeiK4hqqaaMLVCsG/JR88plrWb6WDbEylb 1On3TzNwrPSEg3dKGgLms X-Received: by 2002:a05:6000:2891:b0:430:f742:fbb2 with SMTP id ffacd0b85a97d-432c3760bfemr17600671f8f.19.1768088034789; Sat, 10 Jan 2026 15:33:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5hFrDGfW8xHyq74DcY5eiMGfAM4ezRsAFj9tD899fUJk421F6v4voiolhukrMTCP5sjnplw== X-Received: by 2002:a05:6000:2891:b0:430:f742:fbb2 with SMTP id ffacd0b85a97d-432c3760bfemr17600663f8f.19.1768088034361; Sat, 10 Jan 2026 15:33:54 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5fe67csm29998589f8f.40.2026.01.10.15.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jan 2026 15:33:53 -0800 (PST) Date: Sun, 11 Jan 2026 00:33:52 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v2] udp_vu: Discard datagrams when RX virtqueue is not usable Message-ID: <20260111003352.455a9005@elisabeth> In-Reply-To: <20260107080809.3440007-1-lvivier@redhat.com> References: <20260107080809.3440007-1-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nglGAWPyyzet7X3bb4Qn9No9rwNaYxNgPozXj_HP-FQ_1768088035 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 4UFLIO2TWNKEUH4OHYRN5URJBUQZSWSJ X-Message-ID-Hash: 4UFLIO2TWNKEUH4OHYRN5URJBUQZSWSJ X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, 7 Jan 2026 09:08:09 +0100 Laurent Vivier wrote: > During vhost-user device initialization, UDP datagrams may arrive on > listening sockets before the guest has enabled the RX virtqueue. > > When this happens, udp_vu_sock_recv() returns 0 without consuming > the datagram from the socket. The caller, udp_sock_fwd(), uses a > while loop with udp_peek_addr() to process pending datagrams. Since > the datagram remains in the socket buffer, udp_peek_addr() keeps > returning data available, causing a busy loop with 100% CPU usage. > > To avoid that, we need to discard the data when the virtqueue is not > ready. udp_buf_sock_to_tap() actually does the same as it reads data > with udp_sock_recv() and if fd_tap is not initialized tap_send_frames() > drops them. > > Fixes: 28997fcb29b5 ("vhost-user: add vhost-user") > Link: https://bugs.passt.top/show_bug.cgi?id=185 > Signed-off-by: Laurent Vivier > --- > > Notes: > v2: > - move recvmsg() from udp_vu_sock_to_tap() to udp_vu_sock_recv() Applied. -- Stefano