From: Jan Kiszka <jan.kiszka@siemens.com>
To: Paul Brook <paul@codesourcery.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] How to lock-up your tap-based VM network
Date: Tue, 13 Apr 2010 15:15:35 +0200 [thread overview]
Message-ID: <4BC46E77.8020706@siemens.com> (raw)
In-Reply-To: <201004131403.19402.paul@codesourcery.com>
Paul Brook wrote:
>> Paul Brook wrote:
>>>> A major reason for this deadlock could likely be removed by shutting
>>>> down the tap (if peered) or dropping packets in user space (in case of
>>>> vlan) when a NIC is stopped or otherwise shut down. Currently most (if
>>>> not all) NIC models seem to signal both "queue full" and "RX disabled"
>>>> via !can_receive().
>>> No. A disabled device should return true from can_recieve, then discard
>>> the packets in its receive callback. Failure to do so is a bug in the
>>> device. It looks like the virtio-net device may be buggy.
>> That's not a virtio-only issue. In fact, we ran into this over pcnet,
>> and a quick check of other popular PCI NIC models (except for rtl8139)
>> revealed the same picture: They only report can_receive if their
>> receiver unit is up and ready (some also include the queue state, but
>> that's an "add-on").
>
> If so these are also buggy.
>
>> I think it's clear why: "can_receive" strongly suggests that a suspended
>> receiver should make the model return false. If we want to keep this
>> handler, it should be refactored to something like "queue_full".
>
> I don't see a need to refactor anything. You just need to fix the devices
> that incorrectly return false when their RX engine is disabled.
"can_receive" is a misleading name. NIC model developers will continue
to make mistakes when implementing this function. And I don't think we
want such implementations all around:
static int rtl8139_can_receive(VLANClientState *nc)
{
RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque;
int avail;
/* Receive (drop) packets if card is disabled. */
if (!s->clock_enabled)
return 1;
if (!rtl8139_receiver_enabled(s))
return 1;
if (rtl8139_cp_receiver_enabled(s)) {
/* ??? Flow control not implemented in c+ mode.
This is a hack to work around slirp deficiencies anyway. */
return 1;
} else {
avail = MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr,
s->RxBufferSize);
return (avail == 0 || avail >= 1514);
}
}
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2010-04-13 13:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-12 16:43 [Qemu-devel] How to lock-up your tap-based VM network Jan Kiszka
2010-04-12 20:07 ` Paul Brook
2010-04-12 21:49 ` Jamie Lokier
2010-04-12 23:20 ` Paul Brook
2010-04-13 12:30 ` Jan Kiszka
2010-04-13 13:02 ` Paul Brook
2010-04-13 12:22 ` Jan Kiszka
2010-04-13 12:19 ` Jan Kiszka
2010-04-13 13:03 ` Paul Brook
2010-04-13 13:15 ` Jan Kiszka [this message]
2010-04-13 18:48 ` Blue Swirl
2010-04-13 19:13 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BC46E77.8020706@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).