Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5708721ioo; Wed, 1 Jun 2022 10:49:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6k/2T+4FX62iQ7yjVnAsi/yTuGaMLAjc92pgB2T9FzVo2Sq9V/2Uu/CiFnqlM0Z/MqUv+ X-Received: by 2002:a05:6a00:1907:b0:4f7:945:14cf with SMTP id y7-20020a056a00190700b004f7094514cfmr670293pfi.47.1654105781841; Wed, 01 Jun 2022 10:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654105781; cv=none; d=google.com; s=arc-20160816; b=R8BxmZ63T8iTBy8Wj12K+uVdxingP1uUMCSMIhLZey4h5uHcpiAEuBHH4NK+hV71uE b9nrENoQcOiMaRD/D9GeLxRG8KgWsjAmRIIOsKAScl6BwhvoVeayYxrSkwvHSybj2jpX JC2NFTBk5AAHmaO9Msxd1XZDiPxrM4p2PcPDD7nM7VwJZd+bchJMHeKw4fejuiHepO7M 0XnoqJppY0/kYUzGdtr5Pt69dIK2PkOW+Bnhdm3HR9ddgeb8yiGPtzpo83ME0daYkirk 2xzIgkGSX1wQEMQYjmRv/Flf8RcGMfi2cUWl9pUjUbMFVni7GiI3tLUJMSeaXYBJhQ8S /ZFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=Vhsrz++zOScPCObhONnyXrr24xL7G/28VsUqFD0yOzA=; b=rfGytssvx8vbEU5KjzARJM7WEMX/OyKa5eAgxYxKAqSwDt153adtwBDQ3BG9eZiPwI inYAn/5dqdFYOtikq3lbbkgGc7UK1Td352eQ5TtIU9g+Efmm6bRLY5pYNe7tcfD5nwTD dwPIxXVCAxai6N2uGR4KH+fgysKpJe5lXZfKRC5NVy53Ce5JI8NKA0MSGD3wnA/U93gX HuxwfKnzcmjgWvp/ih+ZBuz9DfJk3MYqQWeyd1YP028knKmQRPrL6ods1iCrl9RnqPQV /0+Vg9JoElic6nGbrOzfz0+LC5H3Rw1AYgfEd+AI1vGMxrNfpHocQ5hstedPS0OA/ZOu 9pqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=qk3nfQDq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s22-20020a056a00179600b0050822e94cefsi3166479pfg.369.2022.06.01.10.49.28; Wed, 01 Jun 2022 10:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=qk3nfQDq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346272AbiFARNp (ORCPT + 99 others); Wed, 1 Jun 2022 13:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244187AbiFARNo (ORCPT ); Wed, 1 Jun 2022 13:13:44 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 912FFA309C for ; Wed, 1 Jun 2022 10:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=Vhsrz++zOScPCObhONnyXrr24xL7G/28VsUqFD0yOzA=; t=1654103623; x=1655313223; b=qk3nfQDqK053MwUb7E5Edl8sdNPpqkfyB8Fva9XvU20lTqI gtOPH1crjldg6MIp1C/lQrIFh/c6fegWL+iG/KaCwW+vNaFlXcqpuflusDYOa9nE8o20kbyXQeY2T QIwPeml5oaGYiLEPgDDNYyxG9ZrjFHML7rVE4FQ9ykhOzi/tGh3OqsjcXF0M112llEXfL47NQyY25 Aq0xBgS6LxZVP+t03DjNzodyJ8WhH7xKq2kliZ0AfIPe7BKzjWCGB1QiIQJvcPX/LG3bDIzgbu0Im QZ9dWbwd50pFZ0TTpI/FlFSdvi3TpZsUVvmoy+tcpzZOrzy/s9/Z0jCVCc9781EA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nwRuU-00AUqk-6W; Wed, 01 Jun 2022 19:13:30 +0200 Message-ID: <360edf352f888f4607e0411df8a994aa087e9db4.camel@sipsolutions.net> Subject: Re: [PATCH] um: read multiple msg from virtio slave request fd From: Johannes Berg To: Benjamin Beichler , jdike@addtoit.com, Richard Weinberger , Anton Ivanov Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org Date: Wed, 01 Jun 2022 19:13:29 +0200 In-Reply-To: <20220601153722.181427-1-benjamin.beichler@uni-rostock.de> References: <20220601153722.181427-1-benjamin.beichler@uni-rostock.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.1 (3.44.1-1.fc36) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2022-06-01 at 15:37 +0000, Benjamin Beichler wrote: > If VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS is activated, the user mode > linux virtio irq handler only read one msg from the corresponding socket. > This creates issues, when the device emulation creates multiple call > requests (e.g. for multiple virtqueues), as the socket buffer tend to fil= l > up and the call requests are delayed. >=20 > This creates a deadlock situation, when the device simulation blocks, > because of sending a msg and the kernel side blocks because of > synchronously waiting for an acknowledge of kick request. >=20 > Actually inband notifications are meant to be used in combination with th= e > time travel protocol, but it is not required, therefore this corner case > needs to be handled. Hmm. How did you run into this? Why would a device send many messages and not wait for ACK, but the kernel side actually waits for ACK? What would the use case for that be? Seems a bit odd, if both wait for ACK there shouldn't be an issue? Anyway, I guess I don't mind fixing this regardless of whether I see a use case where it could happen :-) > +++ b/arch/um/drivers/virtio_uml.c > @@ -363,45 +363,47 @@ static irqreturn_t vu_req_read_message(struct virti= o_uml_device *vu_dev, > struct vhost_user_msg msg; > u8 extra_payload[512]; > } msg; > - int rc; > - > - rc =3D vhost_user_recv_req(vu_dev, &msg.msg, > - sizeof(msg.msg.payload) + > - sizeof(msg.extra_payload)); > - > - if (rc) This code changed a bit, you should rebase onto the uml tree's for-next branch. > + while (1) { > + if (vhost_user_recv_req(vu_dev, &msg.msg, > + sizeof(msg.msg.payload) > + + sizeof(msg.extra_payload))) prefer to keep the + on the previous line. That said, my attempt at rebasing this made it all fail completely, maybe you have better luck :) johannes