Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2789927ybi; Thu, 18 Jul 2019 14:30:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzuqmyoKDwgIvNctZ3j7F6SgcfqIYpWtWpy9v+NuimekG0bmlH3RC+yUa30jt+3y2tp9FK5 X-Received: by 2002:a63:3203:: with SMTP id y3mr50580930pgy.191.1563485442788; Thu, 18 Jul 2019 14:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563485442; cv=none; d=google.com; s=arc-20160816; b=Bn39d1XRVhcmgu1OVxryL3aPpuz04hr9wjL7xKs7bpSoHAkUPXEc2TlhvnGNAOAZ3E stiRr0632/HeS3h1eNPMR3kQ2G58+y58OnSdZ1OiqBeX1HVHtLAYyvG3wZGQvA0VSzpS u8ra4uZUhHhjzlfCAUwhYi1V4X7Lvcl2byTsQBGNnDIMuJ+l/3N1hEwhZfyhypeGoRMg gFEczdNK262wRjUiK61kTcS4tzhGKnG68mnPqQS4LE4kIPHd32qfVDSAW1sivdPToaBq y3OSpwSmxOJai9FhZnT5b57fpKqAaiOQG6LiwJEafQ7e0MuEEiUM/Fal7m7PzQx/DjWK Jx/A== 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:dkim-signature; bh=IyK1/KrXVcCjWB4+QnzI7G/fiGV+kyeRskwzWya7BVY=; b=azC2w17o3Q0s7O4S3kLBgPOBikKXetVLfkqjleF2MLichWmsFqxWhFOWOQrzlfaTtp i3OK5eiL3G5F0RCgLFPxN7iXu1koZxKO0KfE25n5hH9VhnhdV81gGf/coWjwKsQXoIzp vp8PEDxI5s/MJJi8XLIR46A6R0NsurKptXdQYV1YFn00CPtHk6jI6zk5w5sYr/VBQiPl Nv6NoS1VX7PCuINtYbOYevR1HgdvV5NO77KH1Su3YBdmh2f69Tr3yN756Bgcvel4DeDl P85J1O32L31MKJaDMf4hi75COTPWyrosAPMXTFe7mTWaIgGm1q8w9Quq8rsniwx9W5ei TOKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=J9Qur1k8; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v15si94762pfm.238.2019.07.18.14.30.27; Thu, 18 Jul 2019 14:30:42 -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=pass header.i=@google.com header.s=20161025 header.b=J9Qur1k8; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727921AbfGRV2w (ORCPT + 99 others); Thu, 18 Jul 2019 17:28:52 -0400 Received: from mail-vs1-f67.google.com ([209.85.217.67]:41305 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727767AbfGRV2v (ORCPT ); Thu, 18 Jul 2019 17:28:51 -0400 Received: by mail-vs1-f67.google.com with SMTP id 2so20151371vso.8 for ; Thu, 18 Jul 2019 14:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IyK1/KrXVcCjWB4+QnzI7G/fiGV+kyeRskwzWya7BVY=; b=J9Qur1k8uNZ28gr48EMeSZ5ZTadMyC+P0cOv8o6AarTthN35uwczlGRmvY8UZsH9at CtA9IoRohHkMgwB2ebkWUm7Nx+LFI4mYGXIkaRub7bqQKmxvFwPByme+wpvPG/Hr6rsz u/OWhQbIFBZ1PO2pfsVrrKzY4ev5fGAtvetHGXN3Cuta0dNkxiwqEr4V5/+Ce22z0bnO TRoTnfPnz0wCmcTiy9LhuQwbUwEZZI4u2q44Ekr5D7Wjnnz393BabKupdNWUO8keo5TF +EUpE6Romg+Pmp6jS2Q5FJGUR4FyQYcmq8xMpG2kVmn2APPnTZmHQx4DDwepa15Vkv5a 7mhQ== 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=IyK1/KrXVcCjWB4+QnzI7G/fiGV+kyeRskwzWya7BVY=; b=cdjyG1p2ZBp8KSdGoa77ieer2Jgt62KIRzbUPVWV1VQCCTESJ5YUOP1iss6AJ2/8iW Wm9Qyvve7epAPB7j3uFg+ecluGzx1xPMQ66txhsiCNsUfqXm3k04O4xs3SWylc3reQvb o+o6Vn8F4XcvjeoBgnhyU98pjgTLtEnuuPVLeQEbuX5Ojdt7KLKKH4Zj4SgdCmsPyzlg J2QNGZhKnPoeQBjpjJuPLvZBCZQjvKNj7Hl/HqfKo4ATV4GBO6AOfyqeS9qYH0RY5WCe 620BbtuGss4hwiRjNLn8K/LYsbnVsH4nXsjIhIPf9+8Mr1gjyxQTXdC34L0XLk0widQu 7yoQ== X-Gm-Message-State: APjAAAVvTuD+uzEFzSblEpm8tyEN+tk8BuFcChiS1bhvVpqc5y6Pjcrj 7RJIDo828Cs6FcNJLp9bCjJJayv5RtPEuZlvFT/o X-Received: by 2002:a67:d39e:: with SMTP id b30mr30406445vsj.212.1563485330475; Thu, 18 Jul 2019 14:28:50 -0700 (PDT) MIME-Version: 1.0 References: <1562959401-19815-1-git-send-email-cai@lca.pw> <20190712.154606.493382088615011132.davem@davemloft.net> <20190712.175038.755685144649934618.davem@davemloft.net> In-Reply-To: From: Bill Wendling Date: Thu, 18 Jul 2019 14:28:39 -0700 Message-ID: Subject: Re: [PATCH] be2net: fix adapter->big_page_size miscaculation To: Nick Desaulniers Cc: Qian Cai , James Y Knight , David Miller , sathya.perla@broadcom.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, Arnd Bergmann , David Howells , "H. Peter Anvin" , netdev@vger.kernel.org, linux-arch , LKML , Nathan Chancellor 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 Possibly. I'd need to ask him. :-) On Thu, Jul 18, 2019 at 2:22 PM Nick Desaulniers wrote: > > On Thu, Jul 18, 2019 at 2:18 PM Bill Wendling wrote: > > > > Top-of-tree clang says that it's const: > > > > $ gcc a.c -O2 && ./a.out > > a is a const. > > > > $ clang a.c -O2 && ./a.out > > a is a const. > > Right, so I know you (Bill) did a lot of work to refactor > __builtin_constant_p handling in Clang and LLVM in the > pre-llvm-9-release timeframe. I suspect Qian might not be using > clang-9 built from source (as clang-8 is the current release) and thus > observing differences. > > > > > On Thu, Jul 18, 2019 at 2:10 PM Nick Desaulniers wrote: > >> > >> On Thu, Jul 18, 2019 at 2:01 PM Qian Cai wrote: > >> > > >> > > >> > > >> > > On Jul 12, 2019, at 8:50 PM, David Miller wrote: > >> > > > >> > > From: Qian Cai > >> > > Date: Fri, 12 Jul 2019 20:27:09 -0400 > >> > > > >> > >> Actually, GCC would consider it a const with -O2 optimized level because it found that it was never modified and it does not understand it is a module parameter. Considering the following code. > >> > >> > >> > >> # cat const.c > >> > >> #include > >> > >> > >> > >> static int a = 1; > >> > >> > >> > >> int main(void) > >> > >> { > >> > >> if (__builtin_constant_p(a)) > >> > >> printf("a is a const.\n"); > >> > >> > >> > >> return 0; > >> > >> } > >> > >> > >> > >> # gcc -O2 const.c -o const > >> > > > >> > > That's not a complete test case, and with a proper test case that > >> > > shows the externalization of the address of &a done by the module > >> > > parameter macros, gcc should not make this optimization or we should > >> > > define the module parameter macros in a way that makes this properly > >> > > clear to the compiler. > >> > > > >> > > It makes no sense to hack around this locally in drivers and other > >> > > modules. > >> > > >> > If you see the warning in the original patch, > >> > > >> > https://lore.kernel.org/netdev/1562959401-19815-1-git-send-email-cai@lca.pw/ > >> > > >> > GCC definitely optimize rx_frag_size to be a constant while I just confirmed clang > >> > -O2 does not. The problem is that I have no clue about how to let GCC not to > >> > optimize a module parameter. > >> > > >> > Though, I have added a few people who might know more of compilers than myself. > >> > >> + Bill and James, who probably knows more than they'd like to about > >> __builtin_constant_p and more than other LLVM folks at this point. > >> > >> -- > >> Thanks, > >> ~Nick Desaulniers > > > > -- > Thanks, > ~Nick Desaulniers