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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 BA22CC7618F for ; Thu, 18 Jul 2019 21:28:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B1F3208C0 for ; Thu, 18 Jul 2019 21:28:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="J9Qur1k8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391249AbfGRV2w (ORCPT ); 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-Google-Smtp-Source: APXvYqzExSySUxynZMmwMGCuSd9ZHoeZd8IEzBzfN0Xzew4NVEGhby0MPyLAOWrGO4tC+scR8VOj/sF/JVKFOUiEUKk= 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