Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbdH3ITp (ORCPT ); Wed, 30 Aug 2017 04:19:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:53153 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750780AbdH3ITn (ORCPT ); Wed, 30 Aug 2017 04:19:43 -0400 Date: Wed, 30 Aug 2017 10:19:40 +0200 From: Michal Hocko To: Andrea Arcangeli Cc: Adam Borowski , Takashi Iwai , Bernhard Held , Nadav Amit , Paolo Bonzini , Wanpeng Li , Radim =?utf-8?B?S3LEjW3DocWZ?= , Joerg Roedel , "Kirill A. Shutemov" , Andrew Morton , Linus Torvalds , kvm , "linux-kernel@vger.kernel.org" Subject: Re: kvm splat in mmu_spte_clear_track_bits Message-ID: <20170830081940.d3xfwedjzdtyqjlp@dhcp22.suse.cz> References: <20170825131419.r5lzm6oluauu65nx@angband.pl> <0a85df4b-ca0a-7e70-51dc-90bd1c460c85@redhat.com> <20170827123505.u4kb24kigjqwa2t2@angband.pl> <0dcca3a4-8ecd-0d05-489c-7f6d1ddb49a6@gmx.de> <79BC5306-4ED4-41E4-B2C1-12197D9D1709@gmail.com> <20170829125923.g3tp22bzsrcuruks@angband.pl> <20170829140924.GB21615@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170829140924.GB21615@redhat.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1310 Lines: 29 On Tue 29-08-17 16:09:24, Andrea Arcangeli wrote: [...] > The other bug where you can reproduce the same corruption with OOM is > unrelated and caused by the OOM reaper. OOM reaper was even corrupting > data if a task was writing to disk and stuck in OOM in write() syscall > or async io write. > > To fix the KVM corruption in the OOM reaper, it needs to call > mmu_notifier_invalidate_start/end around > oom_kill.c:unmap_page_range. This additional > mmu_notifier_invalidate_start will not be good for the OOM reaper > because it's yet another case (like the mmap_sem for writing) that > will prevent the OOM reaper to run, so hindering its ability to hide > XFS OOM deadlocks, and making those resurface. Not in KVM case because > we use a spinlock to serialize against the secondary MMU activity and > the KVM critical section under spinlock isn't going to allocate > memory, but range_start can schedule or block on slow hardware where > the secondary MMU is accessed through PCI (not KVM case). I am not really familiar with mmu notifiers and what they can actually do. But from what you wrote above it is indeed not very safe to call them from the oom reaper. So I will prepare and post a patch to disable the reaper when mm_has_notifiers(). Thanks for pointing this out. -- Michal Hocko SUSE Labs