From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id B48B05A004F for ; Fri, 26 Jul 2024 13:51:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721994694; 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=DNPO01QKcGjewm25hafnCLL8qrqTN7nlYOcr6mIiYCk=; b=ffmxXEQqm7bBBHCOJv/N2aY4ExwnJj2sTZtz4QSGimljUmhDzRYZ8ipXhuBOWNT7ZFWTnV vs/z4FpjvsK2jpy1bAvvd4j3vfRKD8/0O9GxDoeRt12XfQpyCvZzK64Xm9BHHcLlaO6E5u 52ad316nTY6Ql58wcoKP94NuETDPDlg= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-307-FBvKdVGJPzimB8a1PFFxmQ-1; Fri, 26 Jul 2024 07:51:33 -0400 X-MC-Unique: FBvKdVGJPzimB8a1PFFxmQ-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-44fe1a88f85so8805951cf.1 for ; Fri, 26 Jul 2024 04:51:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721994691; x=1722599491; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=DNPO01QKcGjewm25hafnCLL8qrqTN7nlYOcr6mIiYCk=; b=QHPwNpavnqDvhlWNoul0IltEkC8Sms4Q4FuUjpT2WSUS/Xs1LExOY1gt0o8YDbkwgG 3Ys1xvASFqutH6kKr1VyP9DHxbTbUbRvAwMrrTUmedzfl4DBBpzNyct/1Q4OlRqLtrfx Gwtwn2psgOHimULCkbQHftLVeXNXzV/UPH244WWI7ZlEi7lZ1EIr8vEgmNDXNqfGFtzP vgl/cODox05lVq5eCbTVVzLLNZF4Tj2B2fAX3kekPHrsZgF0nj7F1VLiCdXNcVJJCFe9 hzVbIycRENyMGoPLKy4Q2hLHbns07L0vrSV1eqpzXg7EPmjNJ8QgjIA5yTHQtO5NQ0mt XQGw== X-Gm-Message-State: AOJu0YzsrUDYurAjjM/0hbM3i9ooAX+QGUI+UVjeCROR+CFgsSNJvTyd C1l5IAHAkDlc2mZYZ9p6k982LXkFs4ZL/XcA28FNtPmI3TNYWxkpjrffzjc8X2NvJNngB9wOwLn M71G9GFhM9Xr6pKXij2xYyPTUph9ewd5DbInP3fUF6co0Yxnu6veshWpcGHgQ X-Received: by 2002:a05:622a:43:b0:447:e04d:51c3 with SMTP id d75a77b69052e-44fe491982emr77621121cf.51.1721994691644; Fri, 26 Jul 2024 04:51:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvIkRyE2E+KL8DsKFRZQcJYS+EcIrexX4d0urEdFHhNZsnVtVR7PqvLTR2K9VpicIaUZu5Pw== X-Received: by 2002:a05:622a:43:b0:447:e04d:51c3 with SMTP id d75a77b69052e-44fe491982emr77620821cf.51.1721994691175; Fri, 26 Jul 2024 04:51:31 -0700 (PDT) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-44fe8199100sm12792101cf.57.2024.07.26.04.51.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jul 2024 04:51:30 -0700 (PDT) Date: Fri, 26 Jul 2024 13:50:56 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 1/5] tap: Better report errors receiving from QEMU socket Message-ID: <20240726135056.314dfd7b@elisabeth> In-Reply-To: <20240726132508.6a4d1147@elisabeth> References: <20240726072031.3941305-1-david@gibson.dropbear.id.au> <20240726072031.3941305-2-david@gibson.dropbear.id.au> <20240726132508.6a4d1147@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: CUMOFYXFZM24WXUPKA5DVJO62R5FSVFU X-Message-ID-Hash: CUMOFYXFZM24WXUPKA5DVJO62R5FSVFU 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 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 Fri, 26 Jul 2024 13:25:08 +0200 Stefano Brivio wrote: > On Fri, 26 Jul 2024 17:20:27 +1000 > David Gibson wrote: > > > If we get an error on recv() from the QEMU socket, we currently don't > > print any kind of error. Although this can happen in a non-fatal situation > > such as a guest restarting, it's unusual enough that we realy should report > > something for debugability. > > > > Add an error message in this case. Also always report when the qemu > > connection closes for any reason, not just when it will cause us to exit > > (--one-off). > > > > Signed-off-by: David Gibson > > --- > > tap.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/tap.c b/tap.c > > index 44bd4445..a2ae7c2a 100644 > > --- a/tap.c > > +++ b/tap.c > > @@ -969,10 +969,10 @@ void tap_add_packet(struct ctx *c, ssize_t l2len, char *p) > > */ > > static void tap_sock_reset(struct ctx *c) > > { > > - if (c->one_off) { > > - info("Client closed connection, exiting"); > > + info("Client connection closed%s", c->one_off ? ", exiting" : ""); > > + > > + if (c->one_off) > > exit(EXIT_SUCCESS); > > - } > > > > /* Close the connected socket, wait for a new connection */ > > epoll_ctl(c->epollfd, EPOLL_CTL_DEL, c->fd_tap, NULL); > > @@ -1005,8 +1005,10 @@ redo: > > > > n = recv(c->fd_tap, p, TAP_BUF_FILL, MSG_DONTWAIT); > > if (n < 0) { > > - if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) > > + if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) { > > + err_perror("Error receiving from QEMU socket"); > > Nit I'm fixing up on merge: it's not necessarily QEMU, because libkrun > and perhaps others also use this path (in fact, the whole problem was > reported as part of the libkrun integration). > > Maybe it's obvious to users anyway, but this might seriously confuse > somebody who's using e.g. krun on Asahi Linux (is QEMU running, one > might wonder): > https://github.com/slp/krun#motivation > https://github.com/slp/krun/blob/main/crates/krun/src/net.rs > > On top of that, now that we have an error message, I guess it would be > nice to state we're resetting the connection, because it's not really > obvious: the subsequent message from tap_sock_reset() makes it look like > the client decided to close the connection on its own. > > So I'm changing this to: > > err("Error receiving from guest, resetting connection"); ...or rather: err_perror("Receive error on guest connection, reset"); -- Stefano