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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 4928AC1B0E3 for ; Mon, 7 Dec 2020 23:00:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10840239EE for ; Mon, 7 Dec 2020 23:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728166AbgLGXAB (ORCPT ); Mon, 7 Dec 2020 18:00:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725814AbgLGXAA (ORCPT ); Mon, 7 Dec 2020 18:00:00 -0500 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5126BC061749; Mon, 7 Dec 2020 14:59:20 -0800 (PST) Received: by mail-lj1-x243.google.com with SMTP id x23so9893257lji.7; Mon, 07 Dec 2020 14:59:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AKys6aQAOOu2xRthtid9ZbGkHLUjLpfvBcgRg/5bxvk=; b=elsF3rSNZAbI9/2G00yUr28qtowqhHbiZKFz1Ivb86RoPN3Dp4DLIdvcRNNHESwjyY pjcvDvL6tHu/xJ6uMTL01G9KkoFt7b/+0CiZalRi/XQ+o6dLDWim7dr4P7eve4FIxHxz 2/LXHyYCWZcMr4JGJxELX5vtEZF9Wna51soS7M9XZ8BNcWTva09khvzq8S+2OVMy6e0e +kbHIKWQ8O3jASOt1kG/BD6ZA2yWHXg9YW6KVAX/V3e2NzWAI3PvHNWn7kvbgPeWksCb WwULrk0gcjI7s4w15BtaNO3w7uJl2jAfhT6p9aFN2rx8LQNAA8WAcEGOKO63HA2ZYYKJ Hi0g== 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:content-transfer-encoding; bh=AKys6aQAOOu2xRthtid9ZbGkHLUjLpfvBcgRg/5bxvk=; b=jd/Gjw9PFoRMxlqzxBV+e8jiPBqkP78sIu7NpD8ym4Sa/rHbIIKZJm2cXOep/viZdx bAHliat5uNEMy1nwj7pFE/KHgnehMKZnABcgzadlsIVAbZRR+VsUNvSWDFXpjZMLBxLA 81k3JFp+jqoDMAgVhoehgDh0qF4J/U8dYW9T2zU3poZ3Fo7xYCsl0CCf0GFbSClWJW50 lAKQts15U6LJaCpIYbz1PaeNApy2HkNZ8dpKW+4OG+hljr4kD55R7xnxOLHZxwDZPvNK 14HBv+Py5H+72ZYFUXd1eWe2HQWTOGCeZkmrCscLTWzUzeuW4KacRHLyO6XhsCuP00HO /CBw== X-Gm-Message-State: AOAM530fuLfCHxPnfPyY44enu1kA1vXUCAgH7bit5MbYVha+J7lxuNwa 2Pdy6hXSP/3VuBrXKvI2hbxcJ22pIrT3pPnCjP4= X-Google-Smtp-Source: ABdhPJxd50n5Yn5CbKb//VSZsmqHaObc8/h0mN/v7CJKhtAeL7MydpDBbu+pR+pE7Y42p9/WHBrYFVzuR5xs2PRfWJo= X-Received: by 2002:a2e:b4b3:: with SMTP id q19mr2015643ljm.121.1607381958870; Mon, 07 Dec 2020 14:59:18 -0800 (PST) MIME-Version: 1.0 References: <1604661895-5495-1-git-send-email-alex.shi@linux.alibaba.com> <20201110115037.f6a53faec8d65782ab65d8b4@linux-foundation.org> <20201207081556.pwxmhgdxayzbofpi@lion.mk-sys.cz> <20201207225351.2liywqaxxtuezzw3@lion.mk-sys.cz> In-Reply-To: <20201207225351.2liywqaxxtuezzw3@lion.mk-sys.cz> From: Alexei Starovoitov Date: Mon, 7 Dec 2020 14:59:07 -0800 Message-ID: Subject: Re: [PATCH] mm/filemap: add static for function __add_to_page_cache_locked To: Michal Kubecek Cc: Justin Forbes , bpf , Alex Shi , Andrew Morton , Souptick Joarder , Linux-MM , LKML , Alexei Starovoitov , Daniel Borkmann , Josef Bacik Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 7, 2020 at 2:53 PM Michal Kubecek wrote: > > On Mon, Dec 07, 2020 at 02:44:22PM -0800, Alexei Starovoitov wrote: > > On Mon, Dec 7, 2020 at 10:36 AM Justin Forbes wr= ote: > > > > > > On Mon, Dec 7, 2020 at 2:16 AM Michal Kubecek wrot= e: > > > > > > > > On Thu, Nov 12, 2020 at 08:18:57AM +0800, Alex Shi wrote: > > > > > > > > > > > > > > > =E5=9C=A8 2020/11/11 =E4=B8=8A=E5=8D=883:50, Andrew Morton =E5=86= =99=E9=81=93: > > > > > > On Tue, 10 Nov 2020 08:39:24 +0530 Souptick Joarder wrote: > > > > > > > > > > > >> On Fri, Nov 6, 2020 at 4:55 PM Alex Shi wrote: > > > > > >>> > > > > > >>> Otherwise it cause gcc warning: > > > > > >>> ^~~~~~~~~~~~~~~ > > > > > >>> ../mm/filemap.c:830:14: warning: no previous prototype for > > > > > >>> =E2=80=98__add_to_page_cache_locked=E2=80=99 [-Wmissing-proto= types] > > > > > >>> noinline int __add_to_page_cache_locked(struct page *page, > > > > > >>> ^~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > >> > > > > > >> Is CONFIG_DEBUG_INFO_BTF enabled in your .config ? > > > > > > > > > > > > hm, yes. > > > > > > > > > > When the config enabled, compiling looks good untill pahole tool > > > > > used to get BTF info, but I still failed on a right version pahol= e > > > > > > 1.16. Sorry. > > > > > > > > > > > > > > > > >>> > > > > > >>> Signed-off-by: Alex Shi > > > > > >>> Cc: Andrew Morton > > > > > >>> Cc: linux-mm@kvack.org > > > > > >>> Cc: linux-kernel@vger.kernel.org > > > > > >>> --- > > > > > >>> mm/filemap.c | 2 +- > > > > > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > >>> > > > > > >>> diff --git a/mm/filemap.c b/mm/filemap.c > > > > > >>> index d90614f501da..249cf489f5df 100644 > > > > > >>> --- a/mm/filemap.c > > > > > >>> +++ b/mm/filemap.c > > > > > >>> @@ -827,7 +827,7 @@ int replace_page_cache_page(struct page *= old, struct page *new, gfp_t gfp_mask) > > > > > >>> } > > > > > >>> EXPORT_SYMBOL_GPL(replace_page_cache_page); > > > > > >>> > > > > > >>> -noinline int __add_to_page_cache_locked(struct page *page, > > > > > >>> +static noinline int __add_to_page_cache_locked(struct page *= page, > > > > > >>> struct address_space = *mapping, > > > > > >>> pgoff_t offset, gfp_t= gfp, > > > > > >>> void **shadowp) > > > > > > > > > > > > It's unclear to me whether BTF_ID() requires that the target sy= mbol be > > > > > > non-static. It doesn't actually reference the symbol: > > > > > > > > > > > > #define BTF_ID(prefix, name) \ > > > > > > __BTF_ID(__ID(__BTF_ID__##prefix##__##name##__)) > > > > > > > > > > > > > > > > The above usage make me thought BTF don't require the symbol, tho= ugh > > > > > the symbol still exist in vmlinux with 'static'. > > > > > > > > > > So any comments of this, Alexei? > > > > Sorry. I've completely missed this thread. > > Now I have a hard time finding context in archives. > > If I understood what's going on the removal of "static" cases issues? > > Yes. That's expected. > > noinline alone is not enough to work reliably. > > Not removal, commit 3351b16af494 ("mm/filemap: add static for function > __add_to_page_cache_locked") made the function static which breaks the > build in btfids phase - but it seems to happen only on some > architectures. In our case, ppc64, ppc64le and riscv64 are broken, > x86_64, i586 and s390x succeed. (I made a mistake above, aarch64 did not > fail - but only because it was not built at all.) > > The thread starts with > http://lkml.kernel.org/r/1604661895-5495-1-git-send-email-alex.shi@linux.= alibaba.com Got it. So the above commit is wrong. The addition of "static" is incorrect here. Regardless of btf_id generation. "static noinline" means that the error injection in that spot is unreliable= . Even when bpf is completely compiled out of the kernel. 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 4C253C433FE for ; Mon, 7 Dec 2020 22:59:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CA3E5239EC for ; Mon, 7 Dec 2020 22:59:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA3E5239EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4BF928D0002; Mon, 7 Dec 2020 17:59:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 448E18D0001; Mon, 7 Dec 2020 17:59:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3373A8D0002; Mon, 7 Dec 2020 17:59:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 17AD08D0001 for ; Mon, 7 Dec 2020 17:59:21 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C770B180AD81D for ; Mon, 7 Dec 2020 22:59:20 +0000 (UTC) X-FDA: 77568004080.03.flesh66_580c818273e2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id A609828A4ED for ; Mon, 7 Dec 2020 22:59:20 +0000 (UTC) X-HE-Tag: flesh66_580c818273e2 X-Filterd-Recvd-Size: 7623 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Mon, 7 Dec 2020 22:59:20 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id o24so16913506ljj.6 for ; Mon, 07 Dec 2020 14:59:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AKys6aQAOOu2xRthtid9ZbGkHLUjLpfvBcgRg/5bxvk=; b=elsF3rSNZAbI9/2G00yUr28qtowqhHbiZKFz1Ivb86RoPN3Dp4DLIdvcRNNHESwjyY pjcvDvL6tHu/xJ6uMTL01G9KkoFt7b/+0CiZalRi/XQ+o6dLDWim7dr4P7eve4FIxHxz 2/LXHyYCWZcMr4JGJxELX5vtEZF9Wna51soS7M9XZ8BNcWTva09khvzq8S+2OVMy6e0e +kbHIKWQ8O3jASOt1kG/BD6ZA2yWHXg9YW6KVAX/V3e2NzWAI3PvHNWn7kvbgPeWksCb WwULrk0gcjI7s4w15BtaNO3w7uJl2jAfhT6p9aFN2rx8LQNAA8WAcEGOKO63HA2ZYYKJ Hi0g== 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:content-transfer-encoding; bh=AKys6aQAOOu2xRthtid9ZbGkHLUjLpfvBcgRg/5bxvk=; b=qklEjiv+XyWK4G648rYoYMmdRJo/jC1PIHpKje4SFBwyqZxtKiGBPr4Fgj8fEMETp0 BY3zt2neb1v4n1EkFO3RJQAKMRPZsrnZ5GKU/w9g+2xMaBS7Povcel78+WAE9Tqi7ccv mfG+7JBc6ErSuYvuDqnNHgitcKVvj/I/HuQAo1zZVtNb3IqWtYTzK4lKT9kPoI5C2Uap zGguuym37fNfYN4WkLDDYzBNc1jqrxzvBb9NldMP64O0UwL2w0Q0j+SweLGLrUEo8kE6 TJLz/HVh8aYsCPAiddF6MtvRVYUioQ7fuKNB6FJxC9dlxlUJ6eOaFsgF+DeW2gLQC8H0 ivKg== X-Gm-Message-State: AOAM532XQa8RGebWMA55e0m2NhVGplN0qZp6JtkmJlLJyPFwPNSWLvap oEbf1XI75M6CAz2vxv3z4qAjellMz3QY1Ik7lr0= X-Google-Smtp-Source: ABdhPJxd50n5Yn5CbKb//VSZsmqHaObc8/h0mN/v7CJKhtAeL7MydpDBbu+pR+pE7Y42p9/WHBrYFVzuR5xs2PRfWJo= X-Received: by 2002:a2e:b4b3:: with SMTP id q19mr2015643ljm.121.1607381958870; Mon, 07 Dec 2020 14:59:18 -0800 (PST) MIME-Version: 1.0 References: <1604661895-5495-1-git-send-email-alex.shi@linux.alibaba.com> <20201110115037.f6a53faec8d65782ab65d8b4@linux-foundation.org> <20201207081556.pwxmhgdxayzbofpi@lion.mk-sys.cz> <20201207225351.2liywqaxxtuezzw3@lion.mk-sys.cz> In-Reply-To: <20201207225351.2liywqaxxtuezzw3@lion.mk-sys.cz> From: Alexei Starovoitov Date: Mon, 7 Dec 2020 14:59:07 -0800 Message-ID: Subject: Re: [PATCH] mm/filemap: add static for function __add_to_page_cache_locked To: Michal Kubecek Cc: Justin Forbes , bpf , Alex Shi , Andrew Morton , Souptick Joarder , Linux-MM , LKML , Alexei Starovoitov , Daniel Borkmann , Josef Bacik Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Dec 7, 2020 at 2:53 PM Michal Kubecek wrote: > > On Mon, Dec 07, 2020 at 02:44:22PM -0800, Alexei Starovoitov wrote: > > On Mon, Dec 7, 2020 at 10:36 AM Justin Forbes wr= ote: > > > > > > On Mon, Dec 7, 2020 at 2:16 AM Michal Kubecek wrot= e: > > > > > > > > On Thu, Nov 12, 2020 at 08:18:57AM +0800, Alex Shi wrote: > > > > > > > > > > > > > > > =E5=9C=A8 2020/11/11 =E4=B8=8A=E5=8D=883:50, Andrew Morton =E5=86= =99=E9=81=93: > > > > > > On Tue, 10 Nov 2020 08:39:24 +0530 Souptick Joarder wrote: > > > > > > > > > > > >> On Fri, Nov 6, 2020 at 4:55 PM Alex Shi wrote: > > > > > >>> > > > > > >>> Otherwise it cause gcc warning: > > > > > >>> ^~~~~~~~~~~~~~~ > > > > > >>> ../mm/filemap.c:830:14: warning: no previous prototype for > > > > > >>> =E2=80=98__add_to_page_cache_locked=E2=80=99 [-Wmissing-proto= types] > > > > > >>> noinline int __add_to_page_cache_locked(struct page *page, > > > > > >>> ^~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > >> > > > > > >> Is CONFIG_DEBUG_INFO_BTF enabled in your .config ? > > > > > > > > > > > > hm, yes. > > > > > > > > > > When the config enabled, compiling looks good untill pahole tool > > > > > used to get BTF info, but I still failed on a right version pahol= e > > > > > > 1.16. Sorry. > > > > > > > > > > > > > > > > >>> > > > > > >>> Signed-off-by: Alex Shi > > > > > >>> Cc: Andrew Morton > > > > > >>> Cc: linux-mm@kvack.org > > > > > >>> Cc: linux-kernel@vger.kernel.org > > > > > >>> --- > > > > > >>> mm/filemap.c | 2 +- > > > > > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > >>> > > > > > >>> diff --git a/mm/filemap.c b/mm/filemap.c > > > > > >>> index d90614f501da..249cf489f5df 100644 > > > > > >>> --- a/mm/filemap.c > > > > > >>> +++ b/mm/filemap.c > > > > > >>> @@ -827,7 +827,7 @@ int replace_page_cache_page(struct page *= old, struct page *new, gfp_t gfp_mask) > > > > > >>> } > > > > > >>> EXPORT_SYMBOL_GPL(replace_page_cache_page); > > > > > >>> > > > > > >>> -noinline int __add_to_page_cache_locked(struct page *page, > > > > > >>> +static noinline int __add_to_page_cache_locked(struct page *= page, > > > > > >>> struct address_space = *mapping, > > > > > >>> pgoff_t offset, gfp_t= gfp, > > > > > >>> void **shadowp) > > > > > > > > > > > > It's unclear to me whether BTF_ID() requires that the target sy= mbol be > > > > > > non-static. It doesn't actually reference the symbol: > > > > > > > > > > > > #define BTF_ID(prefix, name) \ > > > > > > __BTF_ID(__ID(__BTF_ID__##prefix##__##name##__)) > > > > > > > > > > > > > > > > The above usage make me thought BTF don't require the symbol, tho= ugh > > > > > the symbol still exist in vmlinux with 'static'. > > > > > > > > > > So any comments of this, Alexei? > > > > Sorry. I've completely missed this thread. > > Now I have a hard time finding context in archives. > > If I understood what's going on the removal of "static" cases issues? > > Yes. That's expected. > > noinline alone is not enough to work reliably. > > Not removal, commit 3351b16af494 ("mm/filemap: add static for function > __add_to_page_cache_locked") made the function static which breaks the > build in btfids phase - but it seems to happen only on some > architectures. In our case, ppc64, ppc64le and riscv64 are broken, > x86_64, i586 and s390x succeed. (I made a mistake above, aarch64 did not > fail - but only because it was not built at all.) > > The thread starts with > http://lkml.kernel.org/r/1604661895-5495-1-git-send-email-alex.shi@linux.= alibaba.com Got it. So the above commit is wrong. The addition of "static" is incorrect here. Regardless of btf_id generation. "static noinline" means that the error injection in that spot is unreliable= . Even when bpf is completely compiled out of the kernel.