From patchwork Sun Apr 30 13:59:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9706103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 07E97601D2 for ; Sun, 30 Apr 2017 14:00:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDBEF26E46 for ; Sun, 30 Apr 2017 14:00:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2A6326E4D; Sun, 30 Apr 2017 14:00:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 910D526E4E for ; Sun, 30 Apr 2017 14:00:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756618AbdD3OAE (ORCPT ); Sun, 30 Apr 2017 10:00:04 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:50202 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755413AbdD3OAD (ORCPT ); Sun, 30 Apr 2017 10:00:03 -0400 Received: from mail-yb0-f171.google.com (mail-yb0-f171.google.com [209.85.213.171]) (authenticated) by conssluserg-03.nifty.com with ESMTP id v3UDxrnm001604; Sun, 30 Apr 2017 22:59:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com v3UDxrnm001604 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1493560794; bh=VMass4RnPQElDWICsbrPqbew62H39gKWP7tyBSCfmCg=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=dHH8RP/EGgwxieS8GX2WRmkTDRGwIAH3wjKWTLnM4teqG+x5trAUNNFKZ5avPGRLR Akn7fbJBrBnNq95+8MmHYgkw7HkpkQaVG0PUFmx865w6d5WLiaqPBuRZUPEDkEg9kt JWWdTtH4wh+KleR4dXt41wx8BSR3WYaOG3cL2e4f4TPBvM+D6Fb/5EgZScRrLbPya0 p6nn1lW7oLkvl3f5eZpK1XhIbHHweVAVKItNgx1mE7mV+7NcLPnx1a7W6IZfUzxTJ5 ypzc0yiMcQuWmIL/d4yedEQD61ssinpl4hn37xR13G+603C48AMHNuI3D0be/XrXHZ Ype/huu+EpXOw== X-Nifty-SrcIP: [209.85.213.171] Received: by mail-yb0-f171.google.com with SMTP id 8so24001073ybw.1; Sun, 30 Apr 2017 06:59:54 -0700 (PDT) X-Gm-Message-State: AN3rC/6WU/l001JkYENy21xRmOzHxw1CcrQ7QudZOGxhEzXNrxcs7aYC 4m74ZfrD39rIKUWnbzZPVZiRVg7Vcw== X-Received: by 10.37.68.87 with SMTP id r84mr6800216yba.34.1493560793071; Sun, 30 Apr 2017 06:59:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.88.68 with HTTP; Sun, 30 Apr 2017 06:59:52 -0700 (PDT) In-Reply-To: <20170421213931.155210-2-mka@chromium.org> References: <20170421213931.155210-1-mka@chromium.org> <20170421213931.155210-2-mka@chromium.org> From: Masahiro Yamada Date: Sun, 30 Apr 2017 22:59:52 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] kbuild: clang: Disable 'address-of-packed-member' warning To: Matthias Kaehlcke Cc: Michal Marek , Linux Kbuild mailing list , Linux Kernel Mailing List , Grant Grundler , Greg Hackmann , Michael Davidson Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Matthias, 2017-04-22 6:39 GMT+09:00 Matthias Kaehlcke : > clang generates plenty of these warnings in different parts of the code, > to an extent that the warnings are little more than noise. Disable the > 'address-of-packed-member' warning. > > Signed-off-by: Matthias Kaehlcke As far as I compiled arch/x86/configs/x86_64_defconfig, all address-of-packed-member warnings came from the single point: ./arch/x86/include/asm/processor.h:534:30: warning: taking address of packed member 'sp0' of class or structure 'x86_hw_tss' may result in an unaligned pointer value [-Waddress-of-packed-member] return this_cpu_read_stable(cpu_tss.x86_tss.sp0); ^~~~~~~~~~~~~~~~~~~ ./arch/x86/include/asm/percpu.h:391:59: note: expanded from macro 'this_cpu_read_stable' #define this_cpu_read_stable(var) percpu_stable_op("mov", var) ^~~ ./arch/x86/include/asm/percpu.h:228:16: note: expanded from macro 'percpu_stable_op' : "p" (&(var))); \ ^~~ For this case, I was able to fix it with the following patch: } \ I'd like to see as much effort as possible before we decide to hide this kind of warning. Is it OK with you ? diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 9fa0360..de25d1c 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -211,26 +211,27 @@ do { \ #define percpu_stable_op(op, var) \ ({ \ typeof(var) pfo_ret__; \ + void *__p = &(var); \ switch (sizeof(var)) { \ case 1: \ asm(op "b "__percpu_arg(P1)",%0" \ : "=q" (pfo_ret__) \ - : "p" (&(var))); \ + : "p" (__p)); \ break; \ case 2: \ asm(op "w "__percpu_arg(P1)",%0" \ : "=r" (pfo_ret__) \ - : "p" (&(var))); \ + : "p" (__p)); \ break; \ case 4: \ asm(op "l "__percpu_arg(P1)",%0" \ : "=r" (pfo_ret__) \ - : "p" (&(var))); \ + : "p" (__p)); \ break; \ case 8: \ asm(op "q "__percpu_arg(P1)",%0" \ : "=r" (pfo_ret__) \ - : "p" (&(var))); \ + : "p" (__p)); \ break; \ default: __bad_percpu_size(); \