From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Xie, Huawei" <huawei.xie@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Unlinking hugepage backing file after initialiation
Date: Mon, 5 Oct 2015 23:20:27 +0300 [thread overview]
Message-ID: <20151005231323-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <C37D651A908B024F974696C65296B57B4B0FD13A@SHSMSX103.ccr.corp.intel.com>
On Mon, Oct 05, 2015 at 01:08:52PM +0000, Xie, Huawei wrote:
> On 9/30/2015 5:36 AM, Michael S. Tsirkin wrote:
> > On Tue, Sep 29, 2015 at 05:50:00PM +0000, shesha Sreenivasamurthy (shesha) wrote:
> >> Sure. Then, is there any real reason why the backing files should not be
> >> unlinked ?
> > AFAIK qemu unlinks them already.
> Sorry, i didn't make it clear. Let us take the physical Ethernet
> controller in the host for example
>
> 1) DPDK app1 unlinked huge page after initialization.
> 2) DPDK app1 crashed or got killed unexpectedly.
> 3) The nic device is just DMAing to the buffer memory allocated from
> the huge page.
> 4) Another app2 started, allocated memory from the hugetlbfs, and the
> memory allocated happened to be the buffer memory.
> Ok, the nic device dmaed to memory of app2, which corrupted app2.
> Btw, the window opened is very very narrow, but we could avoid this
> corruption if we don't unlink huge page immediately. We could
> reinitialize the nic through binding operation and then remove the huge
> page.
>
> I mentioned virtio at the first time. For its case, the one who does DMA
> is vhost and i am talking about the guest huge page not the huge pages
> used to back guest memory.
>
> So we had better not unlink huge pages unless we have other solution to
> avoid the corruption.
Oh, I get it now. It's when you (ab)use UIO to bypass all normal kernel
protections. There's no problem when using VFIO.
So kernel doesn't protect you in case of a crash, but I guess you
can try to protect yourself.
For example, write a separate service that you can pass the hugepage FDs
and the device FDs to. Have it hold on to them, and when it detects your
app crashed, have it reset the device before closing the FDs.
Just make sure that one doesn't crash :).
But really, people should just use VFIO.
--
MST
next prev parent reply other threads:[~2015-10-05 20:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-29 0:04 shesha Sreenivasamurthy (shesha)
2015-09-29 2:37 ` Xie, Huawei
2015-09-29 15:15 ` Xie, Huawei
2015-09-29 15:48 ` shesha Sreenivasamurthy (shesha)
2015-09-29 16:16 ` Michael S. Tsirkin
2015-09-29 17:50 ` shesha Sreenivasamurthy (shesha)
2015-09-29 21:35 ` Michael S. Tsirkin
2015-09-30 21:44 ` shesha Sreenivasamurthy (shesha)
2015-09-30 21:53 ` Ananyev, Konstantin
2015-09-30 22:04 ` shesha Sreenivasamurthy (shesha)
2015-10-01 8:41 ` Bruce Richardson
2015-10-05 13:08 ` Xie, Huawei
2015-10-05 20:20 ` Michael S. Tsirkin [this message]
2015-10-12 8:46 ` Xie, Huawei
2015-09-29 9:03 ` Ananyev, Konstantin
2015-09-29 11:14 ` Bruce Richardson
2015-09-29 14:03 ` shesha Sreenivasamurthy (shesha)
2015-09-29 0:24 shesha Sreenivasamurthy (shesha)
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=20151005231323-mutt-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=dev@dpdk.org \
--cc=huawei.xie@intel.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;
as well as URLs for NNTP newsgroup(s).