Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp256243ybl; Thu, 23 Jan 2020 23:07:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyFXGIWxGrpZfLc2bTYScxg7DrSIaTFvl/Yzg3ZEfzMG2nTjE/wv63Dj6j2RbqvlX/+31wX X-Received: by 2002:aca:b608:: with SMTP id g8mr1187117oif.142.1579849620841; Thu, 23 Jan 2020 23:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579849620; cv=none; d=google.com; s=arc-20160816; b=0NwEvCb86iMmhTq1tvgk5QnWvC2AMPYiInYtmVmpn8XS8hL7WJLr1swzBVm/oA/eVe SGW32D6lPTz90dNqcNBd6pPGAjCNGi4oFgYBIdCXQXpMeCtfm58jpDlGc5MNOvflznEO BQfAg2jX1gpIzSI6eR0nMycV0fCNzZbbAgM33HSceJ8IEh1x/A+sWEnQBCmsZz+9m+l0 8H6AOD9a0fErP+l77lfEwbvSn3KnuIGMkL3oJPw2vqUP/zEW1woCDanOO8SRxxiPRqDU tVS0Uh4MMynro8GGUrz9y5DMg/iYJtMEE1wEbK5Uk8eUZvOl/cwXXwWGWGqvF1FpkdtA Hi/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=ITaOlJ0/QZZrDkYtjFjngyVQpAL/zHUltBD1tC8H/AY=; b=triHudkezAaRDk+9TnDuBbL9pEjEGkwQGnvvUL8V5becpfIiaaMchqd4GngyxS921F amdmxPVHtK7AAJ3yV5VbmfAUMSlwBx5tYq16pDu47UkOQIzsRggS2cESZseVcd0ilBmw 02ce5hmU6+LqMaOcZXjVjUnMBydfslxyY9imj/KN9AaKbihieIdw+UI7gHAWtbAUYScg K0gNMO1MwUhXMi+MgA+v4n0VVvGUlsgxaTGs1hVMiJpYgfP+8/4BOIJGJrIxbpNdZ4CY CW66Z9Zia1wyQI1WZOFjz/HOyXbf3INWYhU0QV6HUkIA1+F0kjc6frbiDPfVfEmI1a2o jquA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=AmfhqxCL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si2000511oic.274.2020.01.23.23.06.49; Thu, 23 Jan 2020 23:07:00 -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=@c-s.fr header.s=mail header.b=AmfhqxCL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730713AbgAXHDj (ORCPT + 99 others); Fri, 24 Jan 2020 02:03:39 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:48814 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbgAXHDi (ORCPT ); Fri, 24 Jan 2020 02:03:38 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 483qqX1ywTz9tyWR; Fri, 24 Jan 2020 08:03:36 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=AmfhqxCL; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 1MTHMFIssLu8; Fri, 24 Jan 2020 08:03:36 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 483qqW6WN3z9tyWM; Fri, 24 Jan 2020 08:03:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1579849415; bh=ITaOlJ0/QZZrDkYtjFjngyVQpAL/zHUltBD1tC8H/AY=; h=Subject:From:To:Cc:References:Date:In-Reply-To:From; b=AmfhqxCLvYIIarRc5Sj6TqXdi78MZxs1FJIy8UehPMFzYNeRnkGrPgkHJmGwOZujp owUVkiZjvW4DtF3OJ28hx/nh5NlUgcag9iG4v4NCT7B8lTB0CRmNtoha0qps7OzE/o r00NWOLgPqUZvtDLxJJmjEqEg7OEz6W6rUUx14n8= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BBC498B83D; Fri, 24 Jan 2020 08:03:36 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id JdtNjI8kHPZZ; Fri, 24 Jan 2020 08:03:36 +0100 (CET) Received: from po14934vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.111]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7AE098B768; Fri, 24 Jan 2020 08:03:36 +0100 (CET) Subject: Re: [PATCH 1/2] powerpc/irq: don't use current_stack_pointer() in check_stack_overflow() From: Christophe Leroy To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <87d0b9iez3.fsf@mpe.ellerman.id.au> Message-ID: <74cb4227-1a24-6fe1-2df4-3d4b069453c4@c-s.fr> Date: Fri, 24 Jan 2020 07:03:36 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/24/2020 06:19 AM, Christophe Leroy wrote: > > > Le 24/01/2020 à 06:46, Michael Ellerman a écrit : >> >> If I do this it seems to work, but feels a little dicey: >> >>     asm ("" : "=r" (r1)); >>     sp = r1 & (THREAD_SIZE - 1); > > > Or we could do add in asm/reg.h what we have in boot/reg.h: > > register void *__stack_pointer asm("r1"); > #define get_sp()    (__stack_pointer) > > And use get_sp() > It works, and I guess doing it this way is acceptable as it's exactly what's done for current in asm/current.h with register r2. Now I (still) get: sp = get_sp() & (THREAD_SIZE - 1); b9c: 54 24 04 fe clrlwi r4,r1,19 if (unlikely(sp < 2048)) { ba4: 2f 84 07 ff cmpwi cr7,r4,2047 Allthough GCC 8.1 what doing exactly the same with the form CLANG don't like: register unsigned long r1 asm("r1"); long sp = r1 & (THREAD_SIZE - 1); b84: 54 24 04 fe clrlwi r4,r1,19 if (unlikely(sp < 2048)) { b8c: 2f 84 07 ff cmpwi cr7,r4,2047 Christophe