Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2173391ybl; Sat, 7 Dec 2019 09:43:00 -0800 (PST) X-Google-Smtp-Source: APXvYqz3zrZC4zLRr6s7bJdiopzBkGunBXhq1YFYIcfiJ1ASXHv7z8u87YbcZZo9vBFYR9tbADzP X-Received: by 2002:a9d:4543:: with SMTP id p3mr16092317oti.350.1575740580764; Sat, 07 Dec 2019 09:43:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575740580; cv=none; d=google.com; s=arc-20160816; b=dv5if7Oa21vpktcVBxtg2VdpE+xa7HWcdkAACeVx3Rh5ays+C52mIsvhKuObjw3OJa 391/3BRZDiJtcwT/Kk4jB9fRzg9CRY8RMvGWBs6TIPescoO62Cmg4HJZV6CKCdzwaLTD I+eO4rOdS9Zo9TsOgnSjUHxp4x2b4nyrxC0kjfkO4QI++mICI/f8uCflMdslICReTMrG BnOpHqK7vmvs1ZIqSetlNIsgYVplCYTk0eiwlQQOw1gSGvb4jBxPbCweP9aD3GUZX3Z7 2KP80FN/mklX6RVGW4OynhVWib3j1mfEWXeDg6MvICNF3LvIR4yk5JtDVUbuSDbIyGW7 c1Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=3e59AWDtaGgL4wkSs8EqP4YcD7bXzgeiqD5lUwdhgCU=; b=oOTASgzjn6CkpRK30cH032+WjcMGXKz1O7Ldtpa+AY1GErqZn3Z+nietZsrqbsfFDz Pu4RxxJJXevaqU1GRBhc5idkbDMkXCcnE3Kv/c/GhSItBZaNcnpfVrYC+QVEYtGc3b4l hl9YZcwrlN3kgLBDq5IY+hVeYncRRqiDjw3bOmsTFCAhqhtgob6j1fZ4j1LvOxLDRVS/ 5ctj70KgXOsDy+yskMD8XEc5lHsgOlHUpjiVV7KaYgScDW4eHRWbZHq4Tw7rjEgE+qXk nTBuhW0HZZwoYZQkgpG3idckU3gOeTpdysIyIghNgaqxvlOB36ibRn/1lCjduioeNLvo ILQg== ARC-Authentication-Results: i=1; mx.google.com; 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 g21si1097649otq.134.2019.12.07.09.42.49; Sat, 07 Dec 2019 09:43: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; 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 S1726626AbfLGRlW (ORCPT + 99 others); Sat, 7 Dec 2019 12:41:22 -0500 Received: from gate.crashing.org ([63.228.1.57]:56303 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726455AbfLGRlW (ORCPT ); Sat, 7 Dec 2019 12:41:22 -0500 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id xB7Hewkd008740; Sat, 7 Dec 2019 11:40:58 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id xB7HevGr008739; Sat, 7 Dec 2019 11:40:57 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sat, 7 Dec 2019 11:40:57 -0600 From: Segher Boessenkool To: Christophe Leroy Cc: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v4 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq() Message-ID: <20191207174057.GY3152@gate.crashing.org> References: <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> <20191206205953.GQ3152@gate.crashing.org> <2a22feca-d6d6-6cb0-6c76-035234fa8742@c-s.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2a22feca-d6d6-6cb0-6c76-035234fa8742@c-s.fr> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 07, 2019 at 10:42:28AM +0100, Christophe Leroy wrote: > Le 06/12/2019 ? 21:59, Segher Boessenkool a ?crit?: > >If the compiler can see the callee wants the same TOC as the caller has, > >it does not arrange to set (and restore) it, no. If it sees it may be > >different, it does arrange for that (and the linker then will check if > >it actually needs to do anything, and do that if needed). > > > >In this case, the compiler cannot know the callee wants the same TOC, > >which complicates thing a lot -- but it all works out. > > Do we have a way to make sure which TOC the functions are using ? Is > there several TOC at all in kernel code ? Kernel modules have their own TOC, I think? > >I think things can still go wrong if any of this is inlined into a kernel > >module? Is there anything that prevents this / can this not happen for > >some fundamental reason I don't see? > > This can't happen can it ? > do_softirq_own_stack() is an outline function, defined in powerpc irq.c > Its only caller is do_softirq() which is an outline function defined in > kernel/softirq.c > > That prevents inlining, doesn't it ? Hopefully, sure. Would be nice if it was clearer that this works... It is too much like working by chance, the way it is :-( > Anyway, until we clarify all this I'll limit my patch to PPC32 which is > where the real benefit is I guess. > > At the end, maybe the solution should be to switch to IRQ stack > immediately in the exception entry as x86_64 do ? > > And do_softirq_own_stack() could be entirely written in assembly like > x86_64 as well ? Maybe? I'm out of my depth there. Segher