Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752493AbdHATtd (ORCPT ); Tue, 1 Aug 2017 15:49:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49472 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752469AbdHATtT (ORCPT ); Tue, 1 Aug 2017 15:49:19 -0400 Date: Tue, 1 Aug 2017 12:49:18 -0700 From: Andrew Morton To: kan.liang@intel.com Cc: linux-kernel@vger.kernel.org, axboe@fb.com, viro@zeniv.linux.org.uk, kirill.shutemov@linux.intel.com, ying.huang@intel.com, npiggin@gmail.com, mingo@kernel.org Subject: Re: [PATCH] mm: allow page_cache_get_speculative in interrupt context Message-Id: <20170801124918.af266c95fa6671e6cc1dc136@linux-foundation.org> In-Reply-To: <1501609146-59730-1-git-send-email-kan.liang@intel.com> References: <1501609146-59730-1-git-send-email-kan.liang@intel.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1048 Lines: 24 On Tue, 1 Aug 2017 13:39:06 -0400 kan.liang@intel.com wrote: > Kernel panic when calling the IRQ-safe __get_user_pages_fast in NMI > handler. > > The bug was introduced by commit: > > 2947ba054a4d ("x86/mm/gup: Switch GUP to the generic > get_user_page_fast() implementation") > > The original x86 __get_user_page_fast used plain get_page() or > page_ref_add(). However, the generic __get_user_page_fast uses > page_cache_get_speculative(), which has VM_BUG_ON(in_interrupt()). > > There is no reason to prevent page_cache_get_speculative from using in > interrupt context. According to the author, putting a BUG_ON there is > just because the code is not verifying correctness of interrupt races. > I did some tests in interrupt context. There is no issue found. > Removing VM_BUG_ON(in_interrupt()) for page_cache_get_speculative(). What code calls page_cache_get_speculative() from NMI context? I'm trying to work out which kernel versions need this fix, but there isn't enough info in the changelog for this. Please don't do that.