Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8056973ybn; Tue, 1 Oct 2019 02:28:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxylbNJpNzZccfkI14oa31G1fzH/HPCG+n8SclVt2tOHbN1UQjG/LQgoxm3NHSiwkBA/8yV X-Received: by 2002:aa7:c759:: with SMTP id c25mr23994013eds.15.1569922138399; Tue, 01 Oct 2019 02:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569922138; cv=none; d=google.com; s=arc-20160816; b=eW2V7j3F9/NtfzaiOZsYR7OBvwjb7LdK/5yRLXDKnnDxNspq7w2JQv3PJ6WmreEPcw 2uL3lzrDeQYhrd5tkDP7cynPXyiEi8gSOncHEKgNc8Z4Lez2AMHXhtQZLgluCCCzESkx 2KTnnCMQqhPWcV31MvA7k7DzTJeYiVKyhkj7p1pPM+8+qAcyiZjN1FThcUzWc3jp2Gyn 9MT6SAT9cIN4HQe6tKjuImsrNXfvUplXXybQa1KniYYLjRMbjTWzBFEZM6CcoPKf9N9T sMXXQvvtlkVzIAqqrng9UUoOflLFJelC/akAdQ6/1d/bSwSsvD+wb6AHKUkDDPbMg6wB YMlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=7GWGh2D7aZcVTalvii3cK7UDmHvdrp+om18ofNeVba8=; b=GSJNgm3j0XIvttiPj2PzAOsQMyeAK73eDUx1L81Gos3Yvfrr2k0gmEK4jizYLWjWwY wFBPytVuFTaYWyEmByyM8Wp1AwziOqABX55Wn1Ilh3KRsrdn10WToOzNSZHiLlTEHilk q091wyG2nYNM7SduTA7NV+ZwQxpL6N6qRkmJTGvYXBX+vzMWiVRPlYRHI7qdSoD58W7R 9iOOREmINekgiEDTOeWaKwhxC1mwWBWmPnfCYtBBSLjAeEnH0P08VFk7YMGvWo/9JyH9 hfIGqfSHT8SOTfqf7Nb4VzUAvqfNZip2/Q6oDUTl0E3Tb1ovJi40h9VUBJrzUKz28QeC gP8g== 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 a14si9879982eda.111.2019.10.01.02.28.33; Tue, 01 Oct 2019 02:28:58 -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; 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 S1728974AbfJAJ2Q (ORCPT + 99 others); Tue, 1 Oct 2019 05:28:16 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:44991 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727326AbfJAJ2Q (ORCPT ); Tue, 1 Oct 2019 05:28:16 -0400 Received: by mail-ot1-f66.google.com with SMTP id 21so10904671otj.11; Tue, 01 Oct 2019 02:28:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7GWGh2D7aZcVTalvii3cK7UDmHvdrp+om18ofNeVba8=; b=qpj1jnLn8JowzM99dz8TaGdKjJ3LzU8RufP7gu+sSUSUF/5jb1MHmUsPl/giAwhZpu 0qS4zi3t5y6AC4S7k0dhzslvbG+R7aBw5pDO2NljXQP9FJYvLlgSH6m40DjMA3SpQgmE 4OjoNYtLnSOxMPMHxjDrA1d4WXXqikFAkQWp2sNE8Jozo47N+LQuJ9bVPMf2pNb0aPHZ KwXuOg7f4VVwdUG+uqQ7/tahq4V2/7eYVxZUB2glVp7Y1pMtJiGGSONSAScbRD2bOLGx k5RivpKgNovWj74c5c7C1+YHmzvyzKDCmHQL2Iee3UogpaZmMd7WRIxkRHgpukIlRHaC tzmg== X-Gm-Message-State: APjAAAWUlJVdvkqNib1LKqgV4rafimudoYEnAIC74oVl21VczjjgZipo r/GIOFjfjjd3i7j+mJQ67oKhzn+E/QaY7LqWass= X-Received: by 2002:a9d:404d:: with SMTP id o13mr17559692oti.39.1569922094967; Tue, 01 Oct 2019 02:28:14 -0700 (PDT) MIME-Version: 1.0 References: <20190930055925.25842-1-yamada.masahiro@socionext.com> In-Reply-To: <20190930055925.25842-1-yamada.masahiro@socionext.com> From: Geert Uytterhoeven Date: Tue, 1 Oct 2019 11:28:03 +0200 Message-ID: Subject: Re: [PATCH] ARM: fix __get_user_check() in case uaccess_* calls are not inlined To: Masahiro Yamada Cc: Linux ARM , Russell King , Arnd Bergmann , Vincent Whitchurch , Nick Desaulniers , Russell King , Stefan Agner , Linux Kernel Mailing List , Julien Thierry , Olof Johansson , Thomas Gleixner , Linus Torvalds , Nicolas Saenz Julienne , Linux-Renesas Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 30, 2019 at 8:01 AM Masahiro Yamada wrote: > KernelCI reports that bcm2835_defconfig is no longer booting since > commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING > forcibly"): > > https://lkml.org/lkml/2019/9/26/825 > > I also received a regression report from Nicolas Saenz Julienne: > > https://lkml.org/lkml/2019/9/27/263 > > This problem has cropped up on arch/arm/config/bcm2835_defconfig > because it enables CONFIG_CC_OPTIMIZE_FOR_SIZE. The compiler tends > to prefer not inlining functions with -Os. I was able to reproduce > it with other boards and defconfig files by manually enabling > CONFIG_CC_OPTIMIZE_FOR_SIZE. > > The __get_user_check() specifically uses r0, r1, r2 registers. > So, uaccess_save_and_enable() and uaccess_restore() must be inlined > in order to avoid those registers being overwritten in the callees. > > Prior to commit 9012d011660e ("compiler: allow all arches to enable > CONFIG_OPTIMIZE_INLINING"), the 'inline' marker was always enough for > inlining functions, except on x86. > > Since that commit, all architectures can enable CONFIG_OPTIMIZE_INLINING. > So, __always_inline is now the only guaranteed way of forcible inlining. > > I want to keep as much compiler's freedom as possible about the inlining > decision. So, I changed the function call order instead of adding > __always_inline around. > > Call uaccess_save_and_enable() before assigning the __p ("r0"), and > uaccess_restore() after evacuating the __e ("r0"). > > Fixes: 9012d011660e ("compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING") > Reported-by: "kernelci.org bot" > Reported-by: Nicolas Saenz Julienne > Signed-off-by: Masahiro Yamada Thanks, this fixes the issues I was seeing on r8a7791/koelsch. Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds