Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp23464ybl; Tue, 3 Dec 2019 20:34:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwpTt709Pxswj3dBZTZQpHjQUeKcWUJDyec3xKDIza7tk7OmRY4CNl5bC1BBuaghYGYWjBC X-Received: by 2002:aca:b702:: with SMTP id h2mr1036806oif.145.1575434054974; Tue, 03 Dec 2019 20:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575434054; cv=none; d=google.com; s=arc-20160816; b=s6Vcd2HilRq32hyt8xR1q75XAnYUagLSYi6sxo18F+Bi33zOcu1g3z+PsXAnpmznyM Z7KJDb851r3pXnIebBc+HwPXqkeD0W4YfTu9+nSJHbJxLdQ5C+1k4l0wxw0qj0SI2JUK wI8khtOx42gXF/jF0Zpanuu97Q2hjvLVvU92A7De/GZzIPGvuGSSCPfV9LXCF2Oq3Nx5 klfL5DCxWwRG5MBqofIpcS6Eq68JWsdszJAkgezT9sLLVnUmjLHglMgZB1XjrOj/ZHtg 2sXhjB9lwYfbZhAk/Rt4XN9yxNCUyuw3MvrM+NBnRko6jVomfZyXMHNXJ2qKFKxPvRTm I8cw== 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:from:references:cc:to:subject:dkim-signature; bh=JpFN3Nh7EoLxvzsnF7qnjZOmLclHkS0vKsPmhr9E1rY=; b=VTaVAF0ypW69VTLyLJdzIopqJV5vNDjez8yM/4JlZeziuTvsgQW7WS4/NK/ciqs4Ak dZJXIfYenFz+2dJV88dPoQ1WLal8ARKZ5FekPWTybKLFuk+FPTvbrY3OF3ttBIvTDH6k KT4kgvCbOU53FRgMCw4ZJbrdJzHTpg5HXIlm490FGb6MJKYZX+DdVUufdnvPa6Cbtx8y J57NTIn4z59UdsqzWGAaf9Ms/kq8xOXGYENJvOxIaRTdiXHuij0FUFhUxghuvoXRB+8k Kne4pk9OydqiOBPKnios3aT3B6bZ7p1csefIkW/phX9dpMEZk86ApQoES+5ddEVH/GCW ZoyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="iH/GkB/i"; 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 u8si2624393otq.262.2019.12.03.20.33.53; Tue, 03 Dec 2019 20:34:14 -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="iH/GkB/i"; 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 S1726958AbfLDEc5 (ORCPT + 99 others); Tue, 3 Dec 2019 23:32:57 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:41092 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726845AbfLDEc4 (ORCPT ); Tue, 3 Dec 2019 23:32:56 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47SQvB1X8Wz9v3nv; Wed, 4 Dec 2019 05:32:54 +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=iH/GkB/i; 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 Rjy7c9LzwKGl; Wed, 4 Dec 2019 05:32:54 +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 47SQvB0NRVz9v3nt; Wed, 4 Dec 2019 05:32:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1575433974; bh=JpFN3Nh7EoLxvzsnF7qnjZOmLclHkS0vKsPmhr9E1rY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=iH/GkB/irOi2Glg4L74cAldoyoVItS8ctviRTvxAZRFX+JtQxGP2s8VqMePMeuWkh yLOXAen36+IZLAyTa0ypzL/6w1cGK+w5tZBtoyIvVMQv4jf2Bfu4bStE5R4rz3FTet Vg9585kYP6cFkfhf/qdplxHaO7voIqLyJruy1YDY= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BAF1A8B838; Wed, 4 Dec 2019 05:32:54 +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 mxoDTfKPwG7V; Wed, 4 Dec 2019 05:32:54 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4D6298B815; Wed, 4 Dec 2019 05:32:54 +0100 (CET) Subject: Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq() To: Segher Boessenkool Cc: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <5ca6639b7c1c21ee4b4138b7cfb31d6245c4195c.1570684298.git.christophe.leroy@c-s.fr> <877e3tbvsa.fsf@mpe.ellerman.id.au> <20191121101552.GR16031@gate.crashing.org> <87y2w49rgo.fsf@mpe.ellerman.id.au> <20191125142556.GU9491@gate.crashing.org> <5fdb1c92-8bf4-01ca-f81c-214870c33be3@c-s.fr> <20191127145958.GG9491@gate.crashing.org> <2072e066-1ffb-867e-60ec-04a6bb9075c1@c-s.fr> <20191129184658.GR9491@gate.crashing.org> From: Christophe Leroy Message-ID: Date: Wed, 4 Dec 2019 05:32:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191129184658.GR9491@gate.crashing.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Le 29/11/2019 à 19:46, Segher Boessenkool a écrit : > Hi! > > On Wed, Nov 27, 2019 at 04:15:15PM +0100, Christophe Leroy wrote: >> Le 27/11/2019 à 15:59, Segher Boessenkool a écrit : >>> On Wed, Nov 27, 2019 at 02:50:30PM +0100, Christophe Leroy wrote: >>>> So what do we do ? We just drop the "r2" clobber ? >>> >>> You have to make sure your asm code works for all ABIs. This is quite >>> involved if you do a call to an external function. The compiler does >>> *not* see this call, so you will have to make sure that all that the >>> compiler and linker do will work, or prevent some of those things (say, >>> inlining of the function containing the call). >> >> But the whole purpose of the patch is to inline the call to __do_irq() >> in order to avoid the trampoline function. > > Yes, so you call __do_irq. You have to make sure that what you tell the > compiler -- and what you *don't tell the compiler -- works with what the > ABIs require, and what the called function expects and provides. > >>> That does not fix everything. The called function requires a specific >>> value in r2 on entry. >> >> Euh ... but there is nothing like that when using existing >> call_do_irq(). > >> How does GCC know that call_do_irq() has same TOC as __do_irq() ? > > The existing call_do_irq isn't C code. It doesn't do anything with r2, > as far as I can see; __do_irq just gets whatever the caller of call_do_irq > has. > > So I guess all the callers of call_do_irq have the correct r2 value always > already? In that case everything Just Works. Indeed, there is only one caller for call_do_irq() which is do_IRQ(). And do_IRQ() is also calling __do_irq() directly (when the stack pointer is already set to IRQ stack). do_IRQ() and __do_irq() are both in arch/powerpc/kernel/irq.c As far as I can see when replacing the call to call_do_irq() by a call to __do_irq(), the compiler doesn't do anything special with r2, and doesn't add any nop after the bl either, whereas for all calls outside irq.c, there is a nop added. So I guess that's ok ? Now that call_do_irq() is inlined, we can even define __do_irq() as static. And that's the same for do_softirq_own_stack(), it is only called from do_softirq() which is defined in the same file as __do_softirq() (kernel/softirq.c) Christophe