Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4479286imm; Mon, 15 Oct 2018 15:53:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV62fK1xADIFFhOM10gIZ8CEmtulJnmWvtQSX3WDjekzlq+oSoU8GLzwGxUq88CyrxGf2lm46 X-Received: by 2002:a17:902:8609:: with SMTP id f9-v6mr18911341plo.134.1539644019598; Mon, 15 Oct 2018 15:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539644019; cv=none; d=google.com; s=arc-20160816; b=MRs3dqLbxbTPp0E/2EBJbrfevtS9flaRv0W18/qwfV7gK5zmNqN4jT3rgRBespYRwy NJb65ZWDveKa1O2S0HGnk8Q84x8p9P9R9Zc5bbaRSLEZsuaoQy5abaaeQau0Io3tX52O vqKVuJZzS18wFAjlJJXK3CT54RZPgSGYZrqjeQqeMmrtY0ihSrYLvQXEIJTikuaVI8oj W3ccU9g3O2r//VRTEN5Y3Zj+Nc49wjQ9tyq1lJY0sAPQ4v80RBgwkQh2dVHUpLoywTLA Xz/PU2uYURLWtlOlmj518hiJSLyh7oDs5qabmLayWUVnOBbIrjMmwaEmZfmwxwcmgyNr xn/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=5rkbavHPfQxCl8Z0lLzsOUojKGBkuNkTW+NpVmjRfyA=; b=k0kuItTs5y7UG6EHMDK+a8HVufAG80eIgFO62pA7nN4pKsRVhm0WLfJ2ZT+OtV5YOU RH0X/wL+UHTuWwbuYX8rs4yNwodSyRks5a76TtgBs0ieZj/d8Zyl8Gw+zzai7v5zFrbS UIqhqRTd5Xy6Eu0W5/Ldk0rjlCAxV1Z60YVZH3H2J7IJIfX9P8pkbzJNvo9WGhj27CRA ecGXTo61IVfhM61CWFJ2SYyLvFPnHkMaf+C9m03XNGzOzErZAPGSQDbuVFoEIJ0ff84c 4NHraC9Nw18wbiM+fGPpb8gu41h7IgV95cVTzasjZSadypnwGHmtIftk+61olCIGQVqm IkGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b="A7ep+OK/"; 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 h34-v6si6223741pld.332.2018.10.15.15.53.24; Mon, 15 Oct 2018 15:53:39 -0700 (PDT) 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=@agner.ch header.s=dkim header.b="A7ep+OK/"; 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 S1726987AbeJPGkT (ORCPT + 99 others); Tue, 16 Oct 2018 02:40:19 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:38836 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726877AbeJPGkT (ORCPT ); Tue, 16 Oct 2018 02:40:19 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 375C35C0106; Tue, 16 Oct 2018 00:52:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1539643978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5rkbavHPfQxCl8Z0lLzsOUojKGBkuNkTW+NpVmjRfyA=; b=A7ep+OK/qOFGzWZQi4losLpgwzegLdOs3WnZoaRML+Rup7hl78EGWsu6w1iF5f5pVdpZoR cispOSCkjqIA5tXZcVoAQRsJWxY6vRSHyrxj4UW38XNSOyvxM1+umWy+sbe7IN7JQI6Xjr YCr34V0C7AojgFktO19jLyBlQOcepfE= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Tue, 16 Oct 2018 00:52:58 +0200 From: Stefan Agner To: Russell King - ARM Linux Cc: raj.khem@gmail.com, ulli.kroll@googlemail.com, joel@jms.id.au, nico@linaro.org, arnd@arndb.de, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] ARM: copypage-fa: add kto and kfrom to input operands list In-Reply-To: <20181015224614.GB30658@n2100.armlinux.org.uk> References: <20181015221629.13924-1-stefan@agner.ch> <20181015222302.GZ30658@n2100.armlinux.org.uk> <26d465580722c7f65b6916e96e283967@agner.ch> <20181015224614.GB30658@n2100.armlinux.org.uk> Message-ID: <2802c0e549149872aa58da5fb54471fc@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.10.2018 00:46, Russell King - ARM Linux wrote: > On Tue, Oct 16, 2018 at 12:39:54AM +0200, Stefan Agner wrote: >> On 16.10.2018 00:23, Russell King - ARM Linux wrote: >> > On Tue, Oct 16, 2018 at 12:16:29AM +0200, Stefan Agner wrote: >> >> When functions incoming parameters are not in input operands list gcc >> >> 4.5 does not load the parameters into registers before calling this >> >> function but the inline assembly assumes valid addresses inside this >> >> function. This breaks the code because r0 and r1 are invalid when >> >> execution enters v4wb_copy_user_page () >> > >> > NAK. Naked functions must never be inlined. Please add a "noinline" >> > attribute to the function rather than making things more complex. >> > >> >> To be honest, I did not put much thought into this commit since it is >> just doing to copypage-fa.c what 9a40ac86152c ("ARM: 6164/1: Add kto and >> kfrom to input operands list.") has been done to the other copypage >> implementations... >> >> [adding Khem] >> >> > The GCC manual states: >> > >> > `naked' >> > Use this attribute on the ARM, AVR, MCORE, MSP430, NDS32, RL78, RX >> > and SPU ports to indicate that the specified function does not >> > need prologue/epilogue sequences generated by the compiler. It is >> > up to the programmer to provide these sequences. The only >> > ^^^^^^^^ >> > statements that can be safely included in naked functions are >> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> > `asm' statements that do not have operands. All other statements, >> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> > including declarations of local variables, `if' statements, and so >> > forth, should be avoided. Naked functions should be used to >> > implement the body of an assembly function, while allowing the >> > compiler to construct the requisite function declaration for the >> > assembler. >> > >> > The 'I' attribute is fine here because it is a constant that is not >> > allowed to be in a register (and hence has no code generation side >> > effects.) >> > >> > Adding operands for the input parameters, however, isn't going to >> > work around the fact that _this_ assembly is written to be out of >> > line and so it must never be inlined by the compiler. >> >> I briefly looked at a disassembled version after applying both patches, >> it indeed leads to inlining. However, the code seems to be working >> (thanks to asm volatile?)... > > Apart from v4wb_copy_user_page() and mc_copy_user_page(), how is > Clang inlining these static functions that are only used through > function pointers? I only looked at copypage-xscale.c (the mc_copy_user_page() case)... -- Stefan