kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm-devel <kvm@vger.kernel.org>
Subject: Re: KVM: mmu_notifiers release method
Date: Wed, 24 Dec 2008 16:28:44 +0100	[thread overview]
Message-ID: <20081224152844.GE29319@random.random> (raw)
In-Reply-To: <49523031.1000305@redhat.com>

On Wed, Dec 24, 2008 at 02:50:57PM +0200, Avi Kivity wrote:
> Marcelo Tosatti wrote:
>> The destructor for huge pages uses the backing inode for adjusting
>> hugetlbfs accounting.
>>
>> Hugepage mappings are destroyed by exit_mmap, after
>> mmu_notifier_release, so there are no notifications through
>> unmap_hugepage_range at this point.
>>
>> The hugetlbfs inode can be freed with pages backed by it referenced
>> by the shadow. When the shadow releases its reference, the huge page
>> destructor will access a now freed inode.
>>
>> Implement the release operation for kvm mmu notifiers to release page
>> refs before the hugetlbfs inode is gone.
>>
>>   
>
> I see this isn't it.  Andrea, comments?

Yeah, the patch looks good, I talked a bit with Marcelo about this by
PM. The issue is that it's not as strightforward as it seems,
basically when I implemented the ->release handlers and had sptes
teardown running before the files were closed (instead of waiting the
kvm anon inode release handler to fire) I was getting bugchecks from
debug options including preempt=y (certain debug checks only becomes
functional with preempt enabled unfortunately), so eventually I
removed ->release because for kvm ->release wasn't useful because no
guest mode can run any more by the time mmu notifier ->release is
invoked, and that avoided the issues with the bugchecks.

We'll be using the mmu notifiers ->release because it's always called
just before the filehandle are destroyed, it's not really about the
guest mode or secondary mmu but just an ordering issue with hugetlbfs
internals.

So in short if no bugcheck triggers this is fine (at least until
hugetlbfs provides a way to register some callback to invoke at the
start of the hugetlbfs->release handler).

  reply	other threads:[~2008-12-24 15:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-10 20:23 KVM: mmu_notifiers release method Marcelo Tosatti
2008-12-24 12:50 ` Avi Kivity
2008-12-24 15:28   ` Andrea Arcangeli [this message]
2008-12-29 14:58     ` __purge_vmap_area_lazy crash with CONFIG_PREEMPT_RCU=y Marcelo Tosatti
2008-12-30  3:53       ` Nick Piggin
2008-12-30 15:13         ` Marcelo Tosatti
2008-12-30 15:32           ` Avi Kivity
2008-12-31  2:32             ` Nick Piggin
2009-01-06 19:53               ` Marcelo Tosatti
2009-01-07 10:02                 ` Avi Kivity

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=20081224152844.GE29319@random.random \
    --to=aarcange@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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).