From patchwork Sun Apr 12 07:59:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 47092 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 38BD220553 for ; Sun, 12 Apr 2015 07:59:52 +0000 (UTC) Received: by lbbrr5 with SMTP id rr5sf11588832lbb.3 for ; Sun, 12 Apr 2015 00:59:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=9dtMqMhIuomOpwO3qWKIGRau/D/1Z5/DLH9VJkyrJhM=; b=Xu8wI230bI/kh8Ra48e5U7UZ087EXZ0c9G5TID5MIs+Nd5xYl6E0yKX5bw/xQ7SeUR kgS92/IRUVCtq5qyyzOHDM0QFVmVSIh3XhiUZAVMuBL4gkp349mrXLj7N3POvEGLsAt/ A8FpBEPd70FvBg9WCBeWMLS/3i3zvNUMHm98YAiubyHG+uFINN8oze3v6BdC4QkEept6 V9jz7DNnYnt9QYgCWubumUZwZFN4wDbHK3NfW7GdcO5U+LTboMzZRHY3OtawSiiulcyW DSqkj9xjPrLADRYywDHpIvP27mPYgMQSR5Co0Eto0ClqxOCsj0n6K8RY4pXfKW9XwEAy H7rA== X-Gm-Message-State: ALoCoQlGnQjZey1EyLrUuA6Eg0ANJDczTYiNluXkgx0cEk1ysHJ6RDB7lbkexZycm/VnrCkr2ONx X-Received: by 10.180.81.134 with SMTP id a6mr861056wiy.1.1428825590503; Sun, 12 Apr 2015 00:59:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.169 with SMTP id x9ls614631lal.92.gmail; Sun, 12 Apr 2015 00:59:50 -0700 (PDT) X-Received: by 10.152.116.11 with SMTP id js11mr8354571lab.106.1428825590206; Sun, 12 Apr 2015 00:59:50 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id o2si5519309lbl.51.2015.04.12.00.59.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Apr 2015 00:59:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by laat2 with SMTP id t2so38154077laa.1 for ; Sun, 12 Apr 2015 00:59:49 -0700 (PDT) X-Received: by 10.152.36.2 with SMTP id m2mr8210246laj.72.1428825589769; Sun, 12 Apr 2015 00:59:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp614041lbt; Sun, 12 Apr 2015 00:59:48 -0700 (PDT) X-Received: by 10.67.4.138 with SMTP id ce10mr16648626pad.102.1428825587703; Sun, 12 Apr 2015 00:59:47 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ck14si5116560pdb.97.2015.04.12.00.59.46; Sun, 12 Apr 2015 00:59:47 -0700 (PDT) Received-SPF: none (google.com: linux-rt-users-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750871AbbDLH7p (ORCPT + 4 others); Sun, 12 Apr 2015 03:59:45 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:35255 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750834AbbDLH7p (ORCPT ); Sun, 12 Apr 2015 03:59:45 -0400 Received: by lbbuc2 with SMTP id uc2so39098924lbb.2 for ; Sun, 12 Apr 2015 00:59:43 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr8531566lac.56.1428825583346; Sun, 12 Apr 2015 00:59:43 -0700 (PDT) Received: from localhost (c-853670d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.54.133]) by mx.google.com with ESMTPSA id a7sm868224lbc.48.2015.04.12.00.59.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Apr 2015 00:59:42 -0700 (PDT) From: Anders Roxell To: linux-rt-users@vger.kernel.org Cc: Anders Roxell Subject: [PATCH] arch/arm64: Enable PREEMPT_RT_FULL Date: Sun, 12 Apr 2015 09:59:38 +0200 Message-Id: <1428825578-12326-1-git-send-email-anders.roxell@linaro.org> X-Mailer: git-send-email 2.1.4 Sender: linux-rt-users-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: anders.roxell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , arm64 is missing support for PREEMPT_RT. The main feature which is lacking is support for lazy preemption. The arch-specific entry code, thread information structure definitions, and associated data tables have to be extended to provide this support. Then the Kconfig file has to be extended to indicate the support is available, and also to indicate that support for full RT preemption is now available. Signed-off-by: Anders Roxell --- I tested this on an arm64 juno target, to get that to boot I had to backport the dtb from v4.0-rc6 to v3.18.11-rt6. arch/arm64/Kconfig | 2 ++ arch/arm64/include/asm/thread_info.h | 3 +++ arch/arm64/kernel/asm-offsets.c | 1 + arch/arm64/kernel/entry.S | 14 ++++++++++---- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 9532f8d..62f4e00 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -59,7 +59,9 @@ config ARM64 select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE + select HAVE_PREEMPT_LAZY select HAVE_SYSCALL_TRACEPOINTS + select IRQ_FORCED_THREADING select IRQ_DOMAIN select MODULES_USE_ELF_RELA select NO_BOOTMEM diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 459bf8e..3e24ea1 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -50,6 +50,7 @@ struct thread_info { struct exec_domain *exec_domain; /* execution domain */ struct restart_block restart_block; int preempt_count; /* 0 => preemptable, <0 => bug */ + int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ int cpu; /* cpu */ }; @@ -108,6 +109,7 @@ static inline struct thread_info *current_thread_info(void) #define TIF_NEED_RESCHED 1 #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ #define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */ +#define TIF_NEED_RESCHED_LAZY 4 #define TIF_NOHZ 7 #define TIF_SYSCALL_TRACE 8 #define TIF_SYSCALL_AUDIT 9 @@ -124,6 +126,7 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE) +#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) #define _TIF_NOHZ (1 << TIF_NOHZ) #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 9a9fce0..f774136 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -36,6 +36,7 @@ int main(void) BLANK(); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); + DEFINE(TI_PREEMPT_LAZY, offsetof(struct thread_info, preempt_lazy_count)); DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); DEFINE(TI_TASK, offsetof(struct thread_info, task)); DEFINE(TI_EXEC_DOMAIN, offsetof(struct thread_info, exec_domain)); diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 726b910..8a631bb 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -347,11 +347,16 @@ el1_irq: #ifdef CONFIG_PREEMPT get_thread_info tsk ldr w24, [tsk, #TI_PREEMPT] // get preempt count - cbnz w24, 1f // preempt count != 0 + cbnz w24, 2f // preempt count != 0 ldr x0, [tsk, #TI_FLAGS] // get flags - tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? - bl el1_preempt + tbz x0, #_TIF_NEED_RESCHED, 2f // needs rescheduling? + + ldr w24, [tsk, #TI_PREEMPT_LAZY] // get preempt lazy count + cbnz w24, 1f // preempt count != 0 + tbz x0, #_TIF_NEED_RESCHED_LAZY, 2f // needs rescheduling? 1: + bl el1_preempt +2: #endif #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_on @@ -364,7 +369,8 @@ el1_preempt: mov x24, lr 1: bl preempt_schedule_irq // irq en/disable is done inside ldr x0, [tsk, #TI_FLAGS] // get new tasks TI_FLAGS - tbnz x0, #TIF_NEED_RESCHED, 1b // needs rescheduling? + tbnz x0, #_TIF_NEED_RESCHED, 2b // needs rescheduling? + tbnz x0, #_TIF_NEED_RESCHED_LAZY, 2b ret x24 #endif