From: Alexander Duyck <alexander.h.duyck@intel.com>
To: Dmitry Fleytman <dmitry@daynix.com>
Cc: linux-kernel@vger.kernel.org, e1000-devel@lists.sourceforge.net,
Chris Webb <chris.webb@elastichosts.com>,
Richard Davies <richard.davies@elastichosts.com>
Subject: Re: [PATCH] e1000 driver RX race condition fixed
Date: Mon, 15 Oct 2012 13:03:31 -0700 [thread overview]
Message-ID: <507C6C13.4000609@intel.com> (raw)
In-Reply-To: <CAGHCxhe=2N8G8v66uZaNDQKyiRVRN11_Lw17mkOdxxrrpXgPHQ@mail.gmail.com>
Hello Dmitry,
My concern is that on many of our parts the behavior is to initialize
both the head and tail to 0, enable Rx for either the ring or device
depending on the queue configuration, and then allocate buffers and bump
tail to indicate that the new buffers are present. The reason behind
enabling Rx and bumping tail is because that signals the DMA engine to
start fetching buffers. In my experience most of our hardware will
ignore the tail bump if it is done first and the Rx is enabled.
With both head and tail at the same value it should not be possible for
any of the devices to start a DMA. This is probably what you should be
checking for in fixing QEMU/KVM as it may be incorrectly assuming it can
fetch the descriptor pointed to by tail.
We have your patch in our queue and can test to verify my assumptions
are correct. If they are we will let you know and reject the patch.
Thanks,
Alex
On 10/15/2012 12:44 PM, Dmitry Fleytman wrote:
> Hello, Alex
>
> Originally this bug was reported for virtual machines running on top
> of QEMU/KVM.
> After patch preparation I've tested it on physical e1000 card and it
> worked fine.
>
> However, it could be I've missed something, as I see now other Intel
> drivers (e1000e, ixgb, etc.)
> use the same sequence (RX enable and then ring allocate), so I'm
> starting to suspect that this is
> the correct behavior.
>
> If you confirm this is the way HW works, the this patch should be
> ignored. This is pure QEMU bug and we'll fix it there.
>
> Thanks,
> Dmitry.
>
> On Mon, Oct 15, 2012 at 8:53 PM, Alexander Duyck
> <alexander.h.duyck@intel.com> wrote:
>> On 10/14/2012 10:19 AM, Dmitry Fleytman wrote:
>>> There is a race condition in e1000 driver.
>>> It enables HW receive before RX rings initalization.
>>> In case of specific timing this may lead to host memory corruption
>>> due to DMA write to arbitrary memory location.
>>> Following patch fixes this issue by reordering initialization steps.
>>>
>>> Other Intel network drivers does not seem to have this issue.
>>>
>>> Dmitry Fleytman (1):
>>> RX initialization sequence fixed - enable RX after corresponding ring
>>> initialization only
>>>
>>> drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 9 +++++----
>>> drivers/net/ethernet/intel/e1000/e1000_main.c | 18 ++++++++++++++++--
>>> 2 files changed, 21 insertions(+), 6 deletions(-)
>>>
>> What device was it you saw this issue with? The reason why I ask is
>> because I suspect this change should cause most of our e1000 hardware to
>> lock up since normally if you allocate buffers and then enable Rx it
>> will mean the ring was not updated and it will treat it as if there are
>> no buffers available.
>>
>> Thanks,
>>
>> Alex
next prev parent reply other threads:[~2012-10-15 20:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-14 17:19 [PATCH] e1000 driver RX race condition fixed Dmitry Fleytman
2012-10-14 17:19 ` [PATCH] RX initialization sequence fixed - enable RX after corresponding ring initialization only Dmitry Fleytman
2012-10-15 5:52 ` [E1000-devel] " Jeff Kirsher
2012-10-15 17:41 ` Dmitry Fleytman
2012-10-19 19:19 ` Richard Davies
2012-10-19 19:34 ` Dmitry Fleytman
2012-10-23 5:23 ` Jeff Kirsher
2012-10-15 18:53 ` [PATCH] e1000 driver RX race condition fixed Alexander Duyck
2012-10-15 19:44 ` Dmitry Fleytman
2012-10-15 20:03 ` Alexander Duyck [this message]
2012-10-15 20:20 ` Dmitry Fleytman
2012-10-15 21:17 ` Alexander Duyck
2012-10-17 17:46 ` Jan Ceuleers
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=507C6C13.4000609@intel.com \
--to=alexander.h.duyck@intel.com \
--cc=chris.webb@elastichosts.com \
--cc=dmitry@daynix.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.davies@elastichosts.com \
/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