From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 88F076B0006 for ; Mon, 25 Jun 2018 07:08:33 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id t25-v6so2226971edq.14 for ; Mon, 25 Jun 2018 04:08:33 -0700 (PDT) Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id x38-v6si1437426eda.438.2018.06.25.04.08.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 25 Jun 2018 04:08:31 -0700 (PDT) Date: Mon, 25 Jun 2018 13:08:30 +0200 From: Michal Hocko Subject: Re: [RFC PATCH] mm, oom: distinguish blockable mode for mmu notifiers Message-ID: <20180625110830.GJ28965@dhcp22.suse.cz> References: <20180622150242.16558-1-mhocko@kernel.org> <20180625075715.GA28965@dhcp22.suse.cz> <20180625084529.GC28965@dhcp22.suse.cz> <45e1a12c-280b-635a-fc76-716440f084ec@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45e1a12c-280b-635a-fc76-716440f084ec@redhat.com> Sender: owner-linux-mm@kvack.org List-ID: To: Paolo Bonzini Cc: LKML , kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , linux-mm@kvack.org, Andrea Arcangeli , =?iso-8859-1?B?Suly9G1l?= Glisse On Mon 25-06-18 12:34:43, Paolo Bonzini wrote: > On 25/06/2018 10:45, Michal Hocko wrote: > > On Mon 25-06-18 10:10:18, Paolo Bonzini wrote: > >> On 25/06/2018 09:57, Michal Hocko wrote: > >>> On Sun 24-06-18 10:11:21, Paolo Bonzini wrote: > >>>> On 22/06/2018 17:02, Michal Hocko wrote: > >>>>> @@ -7215,6 +7216,8 @@ void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, > >>>>> apic_address = gfn_to_hva(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); > >>>>> if (start <= apic_address && apic_address < end) > >>>>> kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD); > >>>>> + > >>>>> + return 0; > >>>> > >>>> This is wrong, gfn_to_hva can sleep. > >>> > >>> Hmm, I have tried to crawl the call chain and haven't found any > >>> sleepable locks taken. Maybe I am just missing something. > >>> __kvm_memslots has a complex locking assert. I do not see we would take > >>> slots_lock anywhere from the notifier call path. IIUC that means that > >>> users_count has to be zero at that time. I have no idea how that is > >>> guaranteed. > >> > >> Nevermind, ENOCOFFEE. This is gfn_to_hva, not gfn_to_pfn. It only > >> needs SRCU. > > > > OK, so just the make sure I follow, the change above is correct? > > Yes. It's only gfn_to_pfn that calls get_user_pages and therefore can > sleep. OK, thanks for the confirmation! -- Michal Hocko SUSE Labs