From patchwork Tue Dec 8 16:02:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jungseok Lee X-Patchwork-Id: 7799421 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31242BEEE1 for ; Tue, 8 Dec 2015 16:04:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E7D6204B5 for ; Tue, 8 Dec 2015 16:04:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 462E2203B0 for ; Tue, 8 Dec 2015 16:04:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6Kis-0003HP-0f; Tue, 08 Dec 2015 16:02:38 +0000 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6Kim-00036l-NY for linux-arm-kernel@lists.infradead.org; Tue, 08 Dec 2015 16:02:34 +0000 Received: by pacdm15 with SMTP id dm15so13975224pac.3 for ; Tue, 08 Dec 2015 08:02:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=P5ZVNJ5tgHtFJYCXqi2EciS2aKM25+ZIDXQMaojB3GY=; b=i0xeIde8xgeaexm5/8hzbjRNATtGTFeGiDLyf2MI4iTo/TS3AKfa7mgiVyMCzYGquN FfMgORWky7TXITT1s4M6f9lro0UfwyGSO//T1CqRlQU76grKYg6EC6elCYP68iTCghq+ +voC3Ht9jcEywA1UGHLFe8z12b5EY0Ff++wNoFiYkzM+lhMyw+bjl6tD8ddvaRKl24IH Hz82ymFVtTJ4VUM0lklpN/WIsSIw3Ai9rFvj3jp3z4ZPf1j9k0P/W1IHOD0QhDvXbwr0 WX10ZkH+ByyeJSqsbiDZqWF2BJp2uONFKH7iccpMpb8cSgZL+8ZbrBqrK3hLnSHZqbxf 7jGg== X-Received: by 10.66.182.165 with SMTP id ef5mr856977pac.95.1449590531593; Tue, 08 Dec 2015 08:02:11 -0800 (PST) Received: from [192.168.123.149] ([116.121.77.221]) by smtp.gmail.com with ESMTPSA id 24sm5646929pfm.75.2015.12.08.08.02.09 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 08:02:10 -0800 (PST) Subject: Re: [PATCH v8 3/4] arm64: Add do_softirq_own_stack() and enable irq_stacks Mime-Version: 1.0 (Apple Message framework v1283) From: Jungseok Lee In-Reply-To: <20151208114321.GD19612@arm.com> Date: Wed, 9 Dec 2015 01:02:07 +0900 Message-Id: <4EBA6141-5CFB-4CAC-97D2-26346AAA91F0@gmail.com> References: <1449226948-14251-1-git-send-email-james.morse@arm.com> <1449226948-14251-4-git-send-email-james.morse@arm.com> <20151207224805.GA20777@MBP.local> <20151208114321.GD19612@arm.com> To: Will Deacon X-Mailer: Apple Mail (2.1283) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151208_080232_971826_3BD9F6F3 X-CRM114-Status: GOOD ( 16.77 ) X-Spam-Score: -2.5 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , James Morse , linux-arm-kernel@lists.infradead.org, AKASHI Takahiro Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Dec 8, 2015, at 8:43 PM, Will Deacon wrote: > On Mon, Dec 07, 2015 at 10:48:07PM +0000, Catalin Marinas wrote: >> On Fri, Dec 04, 2015 at 11:02:27AM +0000, James Morse wrote: >>> entry.S is modified to switch to the per_cpu irq_stack during el{0,1}_irq. >>> irq_count is used to detect recursive interrupts on the irq_stack, it is >>> updated late by do_softirq_own_stack(), when called on the irq_stack, before >>> __do_softirq() re-enables interrupts to process softirqs. >>> >>> do_softirq_own_stack() is added by this patch, but does not yet switch >>> stack. >>> >>> This patch adds the dummy stack frame and data needed by the previous >>> stack tracing patches. >>> >>> Signed-off-by: James Morse >> >> In the interest of getting things moving on this series: >> >> Reviewed-by: Catalin Marinas >> >> I propose that we skip patch 4 for now and, as James suggested, keep the >> THREAD_SIZE to 16KB for one more release cycle. It would be good to get >> some statistics on stack usage. >> >> Patches 1-3 look fine to me on their own. > > I'll pick them up and see if they survive testing. Dear All I've seen the following BUG log with CONFIG_DEBUG_SPINLOCK=y kernel. BUG: spinlock lockup suspected on CPU#1 Under that option, I cannot even complete a single kernel build successfully. I hope I'm the only person to experience it. My Android machine is running well for over 12 hours now with the below change. ----8<---- ----8<---- If I read the patches correctly, the dummy stack frame looks as follows. top ------------ <- irq_stack_ptr | dummy_lr | ------------ | x29 | ------------ <- new frame pointer (x29) | x19 | ------------ | xzr | ------------ So, we should refer to x19 in order to retrieve frame->sp. But, frame->sp is xzr under the current implementation. I suspect this causes spinlock lockup. Please correct me if I'm wrong. Best Regards Jungseok Lee diff --git a/arch/arm64/include/asm/irq.h b/arch/arm64/include/asm/irq.h index fa2a8d0..db90a69 100644 --- a/arch/arm64/include/asm/irq.h +++ b/arch/arm64/include/asm/irq.h @@ -27,7 +27,7 @@ DECLARE_PER_CPU(unsigned long [IRQ_STACK_SIZE/sizeof(long)], irq_stack); * The offset from irq_stack_ptr where entry.S will store the original * stack pointer. Used by unwind_frame() and dump_backtrace(). */ -#define IRQ_STACK_TO_TASK_STACK(ptr) *((unsigned long *)(ptr - 0x10)); +#define IRQ_STACK_TO_TASK_STACK(ptr) *((unsigned long *)(ptr - 0x20)); extern void set_handle_irq(void (*handle_irq)(struct pt_regs *)); diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 81cc538..7d54c26 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -199,7 +199,7 @@ alternative_endif /* Add a dummy stack frame */ stp x29, \dummy_lr, [sp, #-16]! // dummy stack frame mov x29, sp - stp xzr, x19, [sp, #-16]! + stp x19, xzr, [sp, #-16]! 9998: .endm