Received: by 10.223.185.116 with SMTP id b49csp3213997wrg; Mon, 5 Mar 2018 16:42:39 -0800 (PST) X-Google-Smtp-Source: AG47ELvxj773PsAidhv3MXHxnd08heDQyTBRUa5yS8z/vIhm7Se96gRQ7iknaz0J/WoZeVpNIu/8 X-Received: by 10.101.96.73 with SMTP id b9mr13692638pgv.339.1520296959286; Mon, 05 Mar 2018 16:42:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296959; cv=none; d=google.com; s=arc-20160816; b=tjf56hf2RI66bRCAEZQCeo1OUkPq5MTA41H08DQJcWt2vguj1eAceY+eexbD6IRS+r ttKCmyw0dE70wHDctmHjBLcWSESKQo1V41ATY3CoHn3WB+2jNzQMrAVKJZDFzgbi3PE1 STFlkEaNbZ3pzZh0lf7lFSwbf5eD0NldK4uZ8FhOXp8coR0v3XOBWkXKpVOv0KZ7oa67 XHQmt44ViUxYEcw8A+qD3ESQCH55PggapaX2K46X+nM9pd9T8nGwY8Mufs78FChwiPql OV1N6R293M6SvlgJ1EXOXreqBls/4F6s2U0+w4/thT+sMgAqoVMW8wJ94uu1dRGGfohE AQoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=HZrVxKT7IeiAd6dhR07u8+LeXK7g1Fntd5W+o6y2r4o=; b=E4N0USzlRoOk881e9LDgEooes/4LCTj4azdj30wCDD5VeeraybjVNFvDYSlgh3I/rF 9J7OTFB0uf68tn+VqCxbhWcCYxXPUdaJV3t1ExYqmZoIgIGwuwfqHjeBVfupKaK0YEBc RRLeQL85eJWXx3bcf3Jp6ah1DzwZaMg92mcpjzwOzqf7cTD10y61tQBVRRpDib6yRaAh 1zsSAXh5vgYBcVSlaUP/8woaiTjqOzr9uLKaJ60WA7TOYYLXk/xY1lNHmI/G1lRFPu6x YjgQp40SZo9/vaEsVks3CXQBCi4hdHTgbNtTg66xEgAsoQARXgMYoSLdQTg9YeBJVRCg 0NcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=P4q5r+Zq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si10236070plk.592.2018.03.05.16.42.25; Mon, 05 Mar 2018 16:42:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=P4q5r+Zq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933445AbeCFAk1 (ORCPT + 99 others); Mon, 5 Mar 2018 19:40:27 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:56132 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932929AbeCFA0K (ORCPT ); Mon, 5 Mar 2018 19:26:10 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260Llfe034943; Tue, 6 Mar 2018 00:26:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=HZrVxKT7IeiAd6dhR07u8+LeXK7g1Fntd5W+o6y2r4o=; b=P4q5r+Zql+3LSN0TSrlQNUxsq1DJa9r45hRVj4oZ7LHubBu9ILuExG1PZNeFD/vlkF6P /AlXyBAHc/bQgGwchyfBkbav+TToPte4UKfN0x2oZvIsNkUGW34k34Epu3bWGsGaDdTU XBAvSIYD4bRPcJ/2T3B2lYLJI9KpIuDUZ9pbyNYAPOuLZhzoi8i1MnEsyGv1GNlIFJHA YNw7qpKq1cGaW2n69n9ffQ2nerySthIScnXa2iemS+Kbk80C8WMvvQ8uCD5PkK/yrr16 d9XfA/ujqPY1fOYXNh6Ld9aYTT36OS2ervG01axgXz+QZWlMm8/lESsQSjrC0qKd73Ib pg== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2ghe3kgg31-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:06 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w260Q6x3022996 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:06 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w260Q53Z024908; Tue, 6 Mar 2018 00:26:05 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:05 -0800 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, Alexander.Levin@microsoft.com, dan.j.williams@intel.com, sathyanarayanan.kuppuswamy@intel.com, pankaj.laxminarayan.bharadiya@intel.com, akuster@mvista.com, cminyard@mvista.com, pasha.tatashin@oracle.com, gregkh@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH 4.1 10/65] ARM: Hide finish_arch_post_lock_switch() from modules Date: Mon, 5 Mar 2018 19:24:43 -0500 Message-Id: <20180306002538.1761-11-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306002538.1761-1-pasha.tatashin@oracle.com> References: <20180306002538.1761-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060003 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Rostedt commit ef0491ea17f8019821c7e9c8e801184ecf17f85a upstream. The introduction of switch_mm_irqs_off() brought back an old bug regarding the use of preempt_enable_no_resched: As part of: 62b94a08da1b ("sched/preempt: Take away preempt_enable_no_resched() from modules") the definition of preempt_enable_no_resched() is only available in built-in code, not in loadable modules, so we can't generally use it from header files. However, the ARM version of finish_arch_post_lock_switch() calls preempt_enable_no_resched() and is defined as a static inline function in asm/mmu_context.h. This in turn means we cannot include asm/mmu_context.h from modules. With today's tip tree, asm/mmu_context.h gets included from linux/mmu_context.h, which is normally the exact pattern one would expect, but unfortunately, linux/mmu_context.h can be included from the vhost driver that is a loadable module, now causing this compile time error with modular configs: In file included from ../include/linux/mmu_context.h:4:0, from ../drivers/vhost/vhost.c:18: ../arch/arm/include/asm/mmu_context.h: In function 'finish_arch_post_lock_switch': ../arch/arm/include/asm/mmu_context.h:88:3: error: implicit declaration of function 'preempt_enable_no_resched' [-Werror=implicit-function-declaration] preempt_enable_no_resched(); Andy already tried to fix the bug by including linux/preempt.h from asm/mmu_context.h, but that didn't help. Arnd suggested reordering the header files, which wasn't popular, so let's use this workaround instead: The finish_arch_post_lock_switch() definition is now also hidden inside of #ifdef MODULE, so we don't see anything referencing preempt_enable_no_resched() from a header file. I've built a few hundred randconfig kernels with this, and did not see any new problems. Tested-by: Guenter Roeck Signed-off-by: Steven Rostedt Signed-off-by: Arnd Bergmann Acked-by: Russell King Cc: Alexander Shishkin Cc: Andy Lutomirski Cc: Andy Lutomirski Cc: Ard Biesheuvel Cc: Arnaldo Carvalho de Melo Cc: Borislav Petkov Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mel Gorman Cc: Peter Zijlstra Cc: Russell King - ARM Linux Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: linux-arm-kernel@lists.infradead.org Fixes: f98db6013c55 ("sched/core: Add switch_mm_irqs_off() and use it in the scheduler") Link: http://lkml.kernel.org/r/1463146234-161304-1-git-send-email-arnd@arndb.de Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman (cherry picked from commit c22d4b4d1c7fcc0d9eb4d8618d86c554c48ed9c0) Signed-off-by: Pavel Tatashin --- arch/arm/include/asm/mmu_context.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index 9b32f76bb0dd..10f662498eb7 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h @@ -61,6 +61,7 @@ static inline void check_and_switch_context(struct mm_struct *mm, cpu_switch_mm(mm->pgd, mm); } +#ifndef MODULE #define finish_arch_post_lock_switch \ finish_arch_post_lock_switch static inline void finish_arch_post_lock_switch(void) @@ -82,6 +83,7 @@ static inline void finish_arch_post_lock_switch(void) preempt_enable_no_resched(); } } +#endif /* !MODULE */ #endif /* CONFIG_MMU */ -- 2.16.2