Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4474833imm; Mon, 15 Oct 2018 15:47:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV62SO2uTMCL6U05maYuWy29zWY2wPOFdM5fBu8Kec6VqZaRN0Ye7rgtQFhUlfRyjGW2y1Kr1 X-Received: by 2002:a62:6346:: with SMTP id x67-v6mr10540579pfb.234.1539643633041; Mon, 15 Oct 2018 15:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539643633; cv=none; d=google.com; s=arc-20160816; b=marw22BwfpHsuSJwakBdY38xLapl6SHwntNUY210FXg+GsZ4j9/4RrxNKSYTsuKr5B aBBFSbKu9h498nJrbJ2ITTHyaxbqEyHRRPIQkRBMKSwUc9Kmwv/97Tj+7H9/SvIXOogV mfIp8PceNNcZi7Til9kjjU3+dWLRGKnJdTCrZAgXVozJwWBfbnCXllj4S+Ms/2Uszpwc SJQH1IELo0lPHQ4ARvvhtqRvGGtl/xCGV9jnRwuOk/Yqg8GGopti8S7fQpG0czjx5u87 uOA8n2WEZH7GW55LX8oYwo2rJI+9KzjwHl7ng4ftWYidNiGtZgnap3VXyF970BFksG8m 0OSQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UCoWwX2S9E711TzGUVIIx4f9EOPJS+c/GE06I+tcRzs=; b=K3GF5PimxxGy5hN4s2UGiCaucs6kWpORfrLYvjnxQhlPQENFXQWlXZACpvzy4zqBHw oi8qgtonj2H6XnfhPPDqhfE1fd4CatEqt63Z6HFlDgsuKqAiB6C79RTjcKTnX1/AII2Z SSXwkCqLbCI8yEkNYx+p3xp+Py1VfA8TcD32WddfSQyTomdkAsMrqcY13ZQIdAkQ4cj0 FDVhoXWA/mq5S6tiHEgUrWG0shW6/wLvWklvSG/nbgA0bsoNZg0bX7XPO1SG3+cUu7uf xVcRGA4ynrXWl6NdE2NhX4hR24NPaEZKffwB6lUyeSWpdxoIn5YpcfCifumlrqy8gBBc FbmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=Qe463r7A; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68-v6si11760440pld.314.2018.10.15.15.46.56; Mon, 15 Oct 2018 15:47:13 -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=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=Qe463r7A; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbeJPGdt (ORCPT + 99 others); Tue, 16 Oct 2018 02:33:49 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:48296 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726836AbeJPGdt (ORCPT ); Tue, 16 Oct 2018 02:33:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UCoWwX2S9E711TzGUVIIx4f9EOPJS+c/GE06I+tcRzs=; b=Qe463r7AQXrPmPYJfhPx3JLa3 0QP4kijFWLWbmzqwz1etaPdRtyxY8zGZut9twYwu5gdjF9t8O3eIfM8ltl9L5Xn8vcOsPjAjCO6zf zdtg3M2zpWH8+O42ohLaC0WoJFY5qCtPbjIjOIDPyV+eVKkjlrPqs1cSi3CJgDlmAwFHs=; Received: from n2100.armlinux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:49415) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1gCBd2-00037h-5f; Mon, 15 Oct 2018 23:46:24 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1gCBcx-000809-0m; Mon, 15 Oct 2018 23:46:19 +0100 Date: Mon, 15 Oct 2018 23:46:15 +0100 From: Russell King - ARM Linux To: Stefan Agner 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 Message-ID: <20181015224614.GB30658@n2100.armlinux.org.uk> References: <20181015221629.13924-1-stefan@agner.ch> <20181015222302.GZ30658@n2100.armlinux.org.uk> <26d465580722c7f65b6916e96e283967@agner.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <26d465580722c7f65b6916e96e283967@agner.ch> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up