From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FE9AECE589 for ; Tue, 1 Oct 2019 09:28:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 630A22133F for ; Tue, 1 Oct 2019 09:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729289AbfJAJ2Q (ORCPT ); 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-Google-Smtp-Source: APXvYqxUufz8LGb/JAoIgX1fGGEw9iT8aiUJjPt7oB7FJ2AuPPMS33WxhIxXcjmTRYGD42MwfUAanBkCEJnpdi94Fqg= 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