Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752050AbdHARkM (ORCPT ); Tue, 1 Aug 2017 13:40:12 -0400 Received: from mga02.intel.com ([134.134.136.20]:10681 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751832AbdHARkL (ORCPT ); Tue, 1 Aug 2017 13:40:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,306,1498546800"; d="scan'208";a="134637428" From: kan.liang@intel.com To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, axboe@fb.com, viro@zeniv.linux.org.uk, kirill.shutemov@linux.intel.com, ying.huang@intel.com, npiggin@gmail.com, mingo@kernel.org Cc: Kan Liang Subject: [PATCH] mm: allow page_cache_get_speculative in interrupt context Date: Tue, 1 Aug 2017 13:39:06 -0400 Message-Id: <1501609146-59730-1-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.4.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1350 Lines: 40 From: Kan Liang 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(). Signed-off-by: Kan Liang --- include/linux/pagemap.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index baa9344..79b36f5 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -163,8 +163,6 @@ void release_pages(struct page **pages, int nr, bool cold); */ static inline int page_cache_get_speculative(struct page *page) { - VM_BUG_ON(in_interrupt()); - #ifdef CONFIG_TINY_RCU # ifdef CONFIG_PREEMPT_COUNT VM_BUG_ON(!in_atomic() && !irqs_disabled()); -- 2.4.3