From patchwork Thu Mar 1 15:27:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 130313 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2954819edc; Thu, 1 Mar 2018 07:40:32 -0800 (PST) X-Google-Smtp-Source: AG47ELup6InZPpXXqkEsu1srcG/28CLJzG8Nq101+8JDUHz5HRT9/0eP2p/kLuV+0Fm2S0n8PKB0 X-Received: by 10.98.194.219 with SMTP id w88mr2389039pfk.26.1519918832434; Thu, 01 Mar 2018 07:40:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519918832; cv=none; d=google.com; s=arc-20160816; b=EU6EwPka8GaUw5bYFvAseLeUydJkJZ/0/kX7q376PAdleejPt49gaJsqPUwIP244b+ IXKiQ3yvGVbLm2cdguThD0oAnf5uYSZl4bOZx9WsMW41KiO+aAnTLPzMuoI649zIZUNb 7Nnmk7ykmyDJyovMxqhsO10uFK0BRdJDDyK9zUHqRBImNTPZcTbI+GOvZg3wMU9lGRnQ TRTpCA65iY9EXo8sSIjG2dVb89/9PSHZemCh6UUDmp1ZzkSEsn+1dH91jrVL3p48JMGt cfBlmeefAZEc32Upwz/6wfLexaPUxZVAyJBYG90GCRVKSBC+KmQB6hMXnej5PuqlUtOR Z44A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=gM1gHyEiG7LywIJMYJuxq96IDvABCXcEYTUTZktyrNw=; b=f5PFXplysjJjIwQ5fpxJ47cIBGh0M2rcx7nmoJSrH7TudzA388Dw0zHL18l6JDvLUX JxAIk6wRtoe4xeXSGH3r6Q4Qz1DljwQYKdiz2Q6Nw/FXGwXstSLjL66DV2OuF/5obPkf ypVuNXKDCegYKdr3JGa2gFtzKab7uGu1T9alipE+d/IgqumRb5PeUk9zs6ba/mXv/463 VEvF59LQMwMLJwkYkE189RtrS640AToNAx5kOFJDQkQvN4uT68chyxeBmS38ZAfErR3E rc8M0uOywvrC2yC7ATwRrYaDha5wOvwhKzY90J9yJO+G7tFppv1Peg3PIzdVGKynl7fP lWNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=EctmwQ/6; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9-v6si3262836plt.293.2018.03.01.07.40.32; Thu, 01 Mar 2018 07:40:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@microsoft.com header.s=selector1 header.b=EctmwQ/6; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032647AbeCAPkP (ORCPT + 10 others); Thu, 1 Mar 2018 10:40:15 -0500 Received: from mail-bl2nam02on0116.outbound.protection.outlook.com ([104.47.38.116]:50688 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032546AbeCAPkH (ORCPT ); Thu, 1 Mar 2018 10:40:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gM1gHyEiG7LywIJMYJuxq96IDvABCXcEYTUTZktyrNw=; b=EctmwQ/6b/64PBH9D3k7/DhypAm7kZiAFBXHSUTRAmfVtOmQl+QgPTQIFQddIwzXnsnJLOF9nAJtZA6XLQ3gyWjSK2CktR3bm9cgEDMcUouiqK3AfWvm82fXn5/UnmyBQnjZ8QH//6oOWYIQJFQ5Gr2JL1lyou2IkEwOxvaXYD0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1094.namprd21.prod.outlook.com (52.132.130.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Thu, 1 Mar 2018 15:40:04 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0567.006; Thu, 1 Mar 2018 15:40:04 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Arnd Bergmann , Ingo Molnar , Sasha Levin Subject: [added to the 4.1 stable tree] x86/oprofile: Fix bogus GCC-8 warning in nmi_setup() Thread-Topic: [added to the 4.1 stable tree] x86/oprofile: Fix bogus GCC-8 warning in nmi_setup() Thread-Index: AQHTsXHejCPfooelmUGNZ/aLfwONTg== Date: Thu, 1 Mar 2018 15:27:55 +0000 Message-ID: <20180301152116.1486-510-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1094; 7:XOuG/ezZdp6XMcgJ+eiiF2A16MHEmGFjAcLSp95El+Q/agFKwUL5JD37k60g+tp8jrd0NOaOu7sJR4pP3HOxc8Qw5G3OdWyse6PFYHNOBZVtvODGmx7Texy9b/wmIbGO5sWUn91/2AixNLzerYbhbk2Xh2XUqS2NeQmWedal5GIZVyw8IH4miPfrG4So9WNBgWWkRf0MOMv8fCI2buPJYIqLzLLpJQ3kLt4veAValhXseVambILG666xF4HG5a4S x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: e566d18f-b2e2-4866-54dc-08d57f8ab406 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020); SRVR:DM5PR2101MB1094; x-ms-traffictypediagnostic: DM5PR2101MB1094: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(22074186197030)(89211679590171)(9452136761055)(183786458502308)(42068640409301); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231220)(944501228)(52105095)(10201501046)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR2101MB1094; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1094; x-forefront-prvs: 05986C03E0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(39380400002)(346002)(366004)(376002)(189003)(199004)(81156014)(3660700001)(81166006)(107886003)(6436002)(6486002)(59450400001)(53936002)(6306002)(6512007)(97736004)(22452003)(305945005)(6506007)(14454004)(66066001)(8676002)(105586002)(68736007)(8936002)(2501003)(5250100002)(76176011)(4326008)(6666003)(2950100002)(72206003)(106356001)(110136005)(5660300001)(25786009)(54906003)(316002)(1076002)(26005)(3846002)(6116002)(966005)(2900100001)(6346003)(86612001)(99286004)(2906002)(102836004)(10290500003)(3280700002)(36756003)(478600001)(10090500001)(86362001)(7736002)(186003)(22906009); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1094; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: WzZ1dBIMIgTcSh7VUt+S2JCSSUyl3PqXbK5oHuJhSn8PmrF1uhxdlsZEcx+C03z2Xc7sNpseenaF4z0Vk/SNuUtyA9jw2+nBu6/ufhJzHzOID02NrUTwQWR5Jjg9I5rRkI4u6wVucRjYrB6m5wLclw6oJCLV6IXYL1s1LSJjT7s= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: e566d18f-b2e2-4866-54dc-08d57f8ab406 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2018 15:27:55.5131 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1094 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. -- 2.14.1 =============== [ Upstream commit 85c615eb52222bc5fab6c7190d146bc59fac289e ] GCC-8 shows a warning for the x86 oprofile code that copies per-CPU data from CPU 0 to all other CPUs, which when building a non-SMP kernel turns into a memcpy() with identical source and destination pointers: arch/x86/oprofile/nmi_int.c: In function 'mux_clone': arch/x86/oprofile/nmi_int.c:285:2: error: 'memcpy' source argument is the same as destination [-Werror=restrict] memcpy(per_cpu(cpu_msrs, cpu).multiplex, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ per_cpu(cpu_msrs, 0).multiplex, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sizeof(struct op_msr) * model->num_virt_counters); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/x86/oprofile/nmi_int.c: In function 'nmi_setup': arch/x86/oprofile/nmi_int.c:466:3: error: 'memcpy' source argument is the same as destination [-Werror=restrict] arch/x86/oprofile/nmi_int.c:470:3: error: 'memcpy' source argument is the same as destination [-Werror=restrict] I have analyzed a number of such warnings now: some are valid and the GCC warning is welcome. Others turned out to be false-positives, and GCC was changed to not warn about those any more. This is a corner case that is a false-positive but the GCC developers feel it's better to keep warning about it. In this case, it seems best to work around it by telling GCC a little more clearly that this code path is never hit with an IS_ENABLED() configuration check. Cc:stable as we also want old kernels to build cleanly with GCC-8. Signed-off-by: Arnd Bergmann Cc: Jessica Yu Cc: Kees Cook Cc: Linus Torvalds Cc: Martin Sebor Cc: Peter Zijlstra Cc: Robert Richter Cc: Thomas Gleixner Cc: oprofile-list@lists.sf.net Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20180220205826.2008875-1-arnd@arndb.de Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84095 Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- arch/x86/oprofile/nmi_int.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 1d2e6392f5fa..f24bd7249536 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c @@ -471,7 +471,7 @@ static int nmi_setup(void) goto fail; for_each_possible_cpu(cpu) { - if (!cpu) + if (!IS_ENABLED(CONFIG_SMP) || !cpu) continue; memcpy(per_cpu(cpu_msrs, cpu).counters,