From patchwork Thu Jan 3 06:59:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 1926481 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4F9A3DF25A for ; Thu, 3 Jan 2013 07:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751569Ab3ACHA7 (ORCPT ); Thu, 3 Jan 2013 02:00:59 -0500 Received: from alvesta.synopsys.com ([198.182.60.77]:44903 "EHLO alvesta.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751365Ab3ACHA6 (ORCPT ); Thu, 3 Jan 2013 02:00:58 -0500 Received: from mailhost.synopsys.com (unknown [10.9.202.240]) by alvesta.synopsys.com (Postfix) with ESMTP id 7E20A2D7615; Wed, 2 Jan 2013 23:00:43 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 891E298E; Wed, 2 Jan 2013 23:00:33 -0800 (PST) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 7846398D; Wed, 2 Jan 2013 23:00:33 -0800 (PST) Received: from IN01WEHTC2.internal.synopsys.com (10.144.199.212) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.2.298.4; Wed, 2 Jan 2013 23:00:19 -0800 Received: from localhost.localdomain (10.12.197.205) by in01wehtc2.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.2.298.4; Thu, 3 Jan 2013 12:30:14 +0530 From: Vineet Gupta To: "James E.J. Bottomley" , Helge Deller CC: , , , , Vineet Gupta , "Eric W. Biederman" , "Serge Hallyn" Subject: [RESEND PATCH] sysctl: Enable PARISC "unaligned-trap" to be used cross-arch Date: Thu, 3 Jan 2013 12:29:48 +0530 Message-ID: <1357196388-1247-2-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1357196388-1247-1-git-send-email-vgupta@synopsys.com> References: <50D2B75A.3000208@synopsys.com> <1357196388-1247-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.12.197.205] Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org PARISC defines /proc/sys/kernel/unaligned-trap to runtime toggle unaligned access emulation. The exact mechanics of enablig/disabling are still arch specific, we can make the sysctl usable by other arches. Signed-off-by: Vineet Gupta Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: "Eric W. Biederman" Cc: Serge Hallyn Acked-by: Helge Deller --- arch/parisc/Kconfig | 1 + init/Kconfig | 8 ++++++++ kernel/sysctl.c | 7 ++++++- 3 files changed, 15 insertions(+), 1 deletions(-) diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index b77feff..8c76095 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -20,6 +20,7 @@ config PARISC select ARCH_HAVE_NMI_SAFE_CMPXCHG select GENERIC_SMP_IDLE_THREAD select GENERIC_STRNCPY_FROM_USER + select SYSCTL_ARCH_UNALIGN_ALLOW select HAVE_MOD_ARCH_SPECIFIC select MODULES_USE_ELF_RELA select CLONE_BACKWARDS diff --git a/init/Kconfig b/init/Kconfig index e188f9f..e64bb18 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1240,6 +1240,14 @@ config SYSCTL_ARCH_UNALIGN_NO_WARN unaligned access emulation going on under the hood. see arch/ia64/kernel/unaligned.c for reference +config SYSCTL_ARCH_UNALIGN_ALLOW + bool + help + Enable support for /proc/sys/kernel/unaligned-trap + Allows arches to define/use @unaligned_enabled to runtime toggle + the unaligned access emulation. + see arch/parisc/kernel/unaligned.c for reference + config KALLSYMS bool "Load all symbols for debugging/ksymoops" if EXPERT default y diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 840fd5e..c4cd655 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -157,13 +157,16 @@ extern int sysctl_tsb_ratio; #ifdef __hppa__ extern int pwrsw_enabled; -extern int unaligned_enabled; #endif #ifdef CONFIG_IA64 extern int unaligned_dump_stack; #endif +#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW +extern int unaligned_enabled; +#endif + #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN extern int no_unaligned_warning; #endif @@ -548,6 +551,8 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, +#endif +#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW { .procname = "unaligned-trap", .data = &unaligned_enabled,