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=1.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 771E6C48BE5 for ; Sat, 12 Jun 2021 00:19:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DBC67611C9 for ; Sat, 12 Jun 2021 00:19:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBC67611C9 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 6BADE6B006C; Fri, 11 Jun 2021 20:19:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 66B456B006E; Fri, 11 Jun 2021 20:19:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E47A6B0070; Fri, 11 Jun 2021 20:19:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id 2019B6B006C for ; Fri, 11 Jun 2021 20:19:24 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B3344181B04AA for ; Sat, 12 Jun 2021 00:19:23 +0000 (UTC) X-FDA: 78243162606.23.0043D67 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf11.hostedemail.com (Postfix) with ESMTP id 50FF2200107C for ; Sat, 12 Jun 2021 00:19:16 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id v13so3630335ple.9 for ; Fri, 11 Jun 2021 17:19:23 -0700 (PDT) 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; bh=bQTFQP7LZeZrLtw2Imxi1n33yXlsSrtqScii1I/X28U=; b=ttizM0WF8tJ6743TUaTJDjf8I6TZFN49hwA3rVid+lG876wHhRK8DYP6xA8Jknmhbv odCcJrD45VlAvSmfLGaT6uEDAlokQvfk10W4usdZfpqOKWDGD7uK/tvZfQvojXJAT4y6 jfz04pXcSpZOGjNo5W6uQjwrlYYGrzGgAA+xJziQ+lwc3tHKxKz28RYLW920SN8hVUvy b56NcoKhRc8dNdHFmTxLiQcHgBRKHTpfsxyb8oqgwOksoekQMn9H14H6CjMk0j8iiGdp jWudzdBBmy2x+/IpvWuwSmQrNlzz29d7ueOTNe6jVYL4LJFyqybM/aHz2z1fi4mlPJfM sa2g== 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=bQTFQP7LZeZrLtw2Imxi1n33yXlsSrtqScii1I/X28U=; b=HCqFfCg8xKCgiMb4vfCOrJB2tj0y/7dhIjAExicH2dy0CDWPxy5Bf71CPIfa4tYgqD VcahlXOJKP7qXnQ2YWqwredCQSbzTnlStgQ87mALAdIMHDiVcdH6i6rPi6fgIL3SWQ2A J7B7aB0rsU6kkehFCv0qvtFKTWQ54tStN7fiZWsIQAFl+mdfxR9t8/Q9oKRcEw1OYZNx WHvlXwXv3t+pAW1y0FVBpUBJ+c396gilYlfC4fueVK3D20bKr1cTSBde+OEEnzX6WYQp W8MyuyWzPGSG0I9U2cljCZHLgitbwd9SrjSdS1aqOE0DFthPB550LAChxMt07tBaT5P3 5hZg== X-Gm-Message-State: AOAM533KjVbaJUW0pvT/rGCkIVFPotNueB7b9oaZj2QY18KK4iFrkcyP c01v4hCb86xfWk6803SEk0RV06z2avwRfaKywxs= X-Google-Smtp-Source: ABdhPJyWrGMBrcicFb292uofkwYSA6zNIE6J1OU0tFndJNBAC0VjPQ3/tiICOn3sZMQKhlMnxppuDkVz1vtdgcT+bBM= X-Received: by 2002:a17:90a:fe12:: with SMTP id ck18mr6787920pjb.27.1623457162501; Fri, 11 Jun 2021 17:19:22 -0700 (PDT) MIME-Version: 1.0 References: <202106051442.G1VJubTz-lkp@intel.com> <20210606110839.GA13828@hyeyoo> <20210607122550.GA752464@hyeyoo> <06af75da-ffe9-7070-1da8-bcb2cb7881d2@suse.cz> <20210607154957.GB927582@hyeyoo> <6e1d48f2-409c-0a71-4d04-a907fe4183b8@suse.cz> <20210608170528.GA28015@hyeyoo> <2d2d792e-e189-99a4-36cb-f1473a4df9ad@suse.cz> <20210608184501.GA5505@hyeyoo> <513f82e6-175c-d040-691c-5d0e7dacfb83@suse.cz> In-Reply-To: From: Hyeonggon Yoo <42.hyeyoo@gmail.com> Date: Sat, 12 Jun 2021 09:19:05 +0900 Message-ID: Subject: Re: [linux-next:master 7012/7430] include/linux/compiler_types.h:328:38: error: call to '__compiletime_assert_183' declared with attribute error: unexpected size in kmalloc_index() To: Vlastimil Babka Cc: kernel test robot , kbuild-all@lists.01.org, Linux Memory Management List , Andrew Morton , Nathan Chancellor , Nick Desaulniers Content-Type: multipart/alternative; boundary="0000000000007aa16505c48693d1" Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=ttizM0WF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of 42hyeyoo@gmail.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=42hyeyoo@gmail.com X-Rspamd-Server: rspam02 X-Stat-Signature: u14z9giwoenzt3ep56in9mz5hxoqczwd X-Rspamd-Queue-Id: 50FF2200107C X-HE-Tag: 1623457156-459493 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: --0000000000007aa16505c48693d1 Content-Type: text/plain; charset="UTF-8" On Sat, Jun 12, 2021, 8:59 AM Vlastimil Babka wrote: > On 6/11/21 1:56 PM, Hyeonggon Yoo wrote: > > On Fri, Jun 11, 2021, 7:27 PM Vlastimil Babka > > wrote: > > I meant the the condition to use BUILD_BUG_ON instead of BUG_ON > would include > > !IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES) > > > > > > You mean this? (This will make kmalloc_index return -1 without BUG()) > > > > if ((IS_ENABLED(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION >= 110000) && > > size_is_constant) > > BUILD_BUG_ON_MSG(!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES), > "unexpected > > size in kmalloc_index()"); > > else > > BUG(); > > No, > > > Or This? > > > > if ((IS_ENABLED(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION >= 110000) && > > size_is_constant && !IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES)) > > BUILD_BUG_ON_MSG(1, "unexpected size in kmalloc_index()"); > > else > > BUG(); > > > > Maybe this version seems better > > Yeah, meant that. > Ah, okay! > > But little bit worried :( > > The code is getting too complicated... > > How do you think? > > Yeah, I expected that problems like this could occur as we're poking at > some > rare corner cases of compiler implementations here. But if that leads to > fixes > in compilers, good for everyone I'd say. So I would try this, even if it becomes complicated. > Okay, I see the code is okay, but one thing to suggest: The problem already existed in kmalloc_node before the patch And we found it by adding BUILD_BUG_ON in kmalloc_index. So I suggest adding the condition in kmalloc_node. How about this? > --0000000000007aa16505c48693d1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Jun 12, 2021, 8:59 AM Vlastimil Babka <vbabka@suse.cz> wrote:
On 6/11/21 1:56 PM, Hyeonggon Yoo wrote:
> On Fri, Jun 11, 2021, 7:27 PM Vlastimil Babka <vbabka@suse.cz
> <mailto:vbabka@suse.cz>> wrote:
>=C2=A0 =C2=A0 =C2=A0I meant the the condition to use BUILD_BUG_ON inste= ad of BUG_ON would include
>=C2=A0 =C2=A0 =C2=A0!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES)
>
>
> You mean this? (This will make kmalloc_index return -1 without BUG())<= br> >
> if ((IS_ENABLED(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION >=3D 1100= 00) &&
> size_is_constant)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 BUILD_BUG_ON_MSG(!IS_ENABLED(CONFIG_PROFIL= E_ALL_BRANCHES), "unexpected
> size in kmalloc_index()");
> else
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 BUG();

No,

> Or This?
>
> if ((IS_ENABLED(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION >=3D 1100= 00) &&
> size_is_constant && !IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES))<= br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 BUILD_BUG_ON_MSG(1, "unexpected size = in kmalloc_index()");
> else
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 BUG();
>
> Maybe this version seems better

Yeah, meant that.

<= div dir=3D"auto">Ah, okay!


> But little bit worried :(
> The code is getting too complicated...
> How do you think?

Yeah, I expected that problems like this could occur as we're poking at= some
rare corner cases of compiler implementations here. But if that leads to fi= xes
in compilers, good for everyone I'd say.
So I = would try this, even if it becomes complicated.

Okay, I see the code is okay= , but one thing to suggest:
=C2=A0 =C2=A0 The proble= m already existed in kmalloc_node before the patch And we found it by addin= g BUILD_BUG_ON in kmalloc_index.

=C2=A0 =C2=A0 So I suggest adding the condition in kmalloc_node. = How about this?
--0000000000007aa16505c48693d1--