Received: from eggs.gnu.org ([2001:4830:134:3::10]:34194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwlkz-0007Bg-0Y for qemu-devel@nongnu.org; Wed, 19 Oct 2016 03:57:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwlku-0001NB-6q for qemu-devel@nongnu.org; Wed, 19 Oct 2016 03:57:49 -0400 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:35838) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwlkt-0001Md-Kh for qemu-devel@nongnu.org; Wed, 19 Oct 2016 03:57:44 -0400 Received: by mail-wm0-x231.google.com with SMTP id c78so42586920wme.0 for ; Wed, 19 Oct 2016 00:57:43 -0700 (PDT) From: Dmitry Fleytman Message-Id: <4635F072-CAD3-4FD1-978A-8E0136878CBD@daynix.com> Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Date: Wed, 19 Oct 2016 10:57:39 +0300 In-Reply-To: <20161019072510.GB5336@noname.redhat.com> References: <1476657307-26165-1-git-send-email-mail@kevin-wolf.de> <20161018142705.GK4706@noname.str.redhat.com> <22FF2CCB-272D-4202-A7F0-D29E848C366A@daynix.com> <20161019072510.GB5336@noname.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] e1000e: Don't zero out buffer address in rx descriptor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Kevin Wolf , Qemu Developers , jasowang@redhat.com > On 19 Oct 2016, at 10:25 AM, Kevin Wolf wrote: >=20 > Am 19.10.2016 um 08:48 hat Dmitry Fleytman geschrieben: >> Another related thing that I noticed while debugging this and = turning on >> tracing is that the interrupt throttling timers kept firing even = if >> there was no activity at all. Something might be wrong, there, = too. >>=20 >> Next thing I wondered why throttling was enabled at all because = the spec >> says the default is 0 (turned off). So one thing that I'm pretty = sure is >> just a misunderstanding is the following defintion: >>=20 >> #define E1000E_MIN_XITR (500) /* No more then 7813 interrupts = per >> second according to spec = 10.2.4.2 */ >>=20 >>=20 >> As I understand it, the spec is just giving an example there and = lower >> values are valid as well. At the very least, 0 should be accepted = as a >> special case because it means "disabled" and it's specified to be = the >> default. >>=20 >>=20 >> Right, this according to the spec this value should be 0 by default = and >> throttling should be disabled. >>=20 >> Current device implementation does not allow specification of >> throttling interval less than 500 and treats interval 0 as throttling >> enabled with interval 500. >>=20 >> This is done by intention because according to the spec (10.2.4.2) >> device cannot produce more than 7813 interrupts per second even when >> throttling is disabled. Therefore, even in case of interrupt storm >> (continuous interrupt re-injection by device), number of interrupts >> produced by device is limited and CPU (driver) has enough time to do >> its job and handle problematic interrupt state. >=20 > I think you're misinterpreting the spec here. This is the paragraph > we're talking about, right? >=20 > For example, if the interval is programmed to 500 (decimal), the > 82574 guarantees the CPU is not interrupted by it for 128 =C2=B5s = from > the last interrupt. The maximum observable interrupt rate from the > 82574 should never exceed 7813 interrupts/sec. >=20 > It says "for example", so this is just demonstrating how you can > calculate the effects of a specific throttling setting. It says that > _if_ you set ITR to 500, you get an interrupt at most every > 500 * 256 ns =3D 128 =C2=B5s. And 1 / 128 =C2=B5s =3D 7821.5 Hz, so = this is the > effective maximum frequency that _this specific_ ITR setting allows. >=20 > I also don't think it would make any sense for hardware to be unable = to > trigger interrupts more often than that. Triggering an interrupt is = not > a complex operation that involves a lot of calculation or anything. Hi Kevin, Yes, I assume that sentence =E2=80=9CThe maximum observable interrupt rate from the 82574 should never exceed 7813 interrupts/sec." is not a related to a specific case, but describes a generic limitation, however it might be I=E2=80=99m misreading the spec indeed. >=20 >> Opposed to this, virtual device is able to raise interrupts with rate >> limited by CPU speed only therefore driver has no chance to fix >> interrupt storm condition.=20 >>=20 >> Windows e1000e drivers rely on upper limit for number of interrupts >> per second in some cases and absence of this limit leads to infinite >> interrupt storms. >>=20 >> To summarise, while usage of throttling mechanisms is a little bit >> different from what specification says, effective emulated device >> behavior is totally compliant to the real device. >=20 > So Windows doesn't configure ITR (i.e. it is 0) even though it can't > handle unlimited interrupts? That would be a driver bug then, and > perhaps an important enough one to keep a workaround in our code. But > then let's be explicit that this is a workaround for a Windows bug and > not mandated by the spec. >=20 > I'm not sure in what setup you produced this error, but possibly a > reason why this doesn't happen with real hardware isn't the NIC itself > but the backend: Communication with the host can obviously be faster > than talking to a physical network (so if you were doing the latter, = the > rate in the VM wouldn't be limited by the CPU, but by the physical > network). This issue is reproduced on device disable and not related=20 to intensive device/backend communication. One RX packet with right timing is enough to trigged the problem. The same issue was fixed in e1000 device some time ago as well. ~Dmitry >=20 >> As this wasn't blocking me after I had patched the above constant >> locally to 0 so that I could see the actually meaningful trace = events, I >> didn't dig deeper, but I suspect that my local workaround for the >> trace point spam may actually be a valid fix. >>=20 >>=20 >> This part that looks suspicious. >>=20 >> Even when throttling is enabled, timers should be idle >> unless there are packets on corresponding path. >>=20 >> In case you see times firing when device is idle - something >> might be wrong in throttling mechanisms. >=20 > I saw a lot of trace events related to the timer between the really > interesting information (that is, multiple timer invocations with > nothing else in between), but I think it may not have been always. I > didn't really look too closely at the cause of this one because it was > easy enough to patch it out of the way. >=20 > Kevin