Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp755748pxx; Thu, 29 Oct 2020 13:44:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQJeAEOzI56NdhViTGJspx0IKMKGFVGOfgEk83FOmW7acetGPM9NxhjoI0b/KdHO6wGz2B X-Received: by 2002:a17:907:447e:: with SMTP id oo22mr2910538ejb.106.1604004283483; Thu, 29 Oct 2020 13:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604004283; cv=none; d=google.com; s=arc-20160816; b=kBoGAuQ9Glo9nOEDl5cxbX+wMOoWsU2Klt8eKQ2Y41QX3cQOu/nzCYj7vY4ucrEetW rFmJXTeAMMTkwKLonv7QQMg2syZN/yTigQXAfNzuKUzAc4lelpAdrpSbW04WxvxkCMhO vgWI8mrvUKPVDMxpbDKp4RPeGueOS5LflWsMBAE8xnWVZrmGEjS/+P/Wn0jsyxJOr2m0 iaWouj5rqbpSizHIqCx4Naklp2/JL8d9wSW61xsdBB9Jwi8jm5eD1kgayi2pUwsJ1Hvo rtSZHQnKEjLAT3QZOgPz8YftJcDwwtIAT5X7m60eT38vtj62kzxnBon6wkXpnhz9LxFM 0QTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=atBWSsg54EdElpQmxIGprMythfayvCfZuL6C0LobpJM=; b=LtYHU4ce6HCE/utUWldr4eqhwGlxM/2cEvn39DnZlX9L9Z3iN14CB0gFXpb5NmbsOw X9zz5Ic7mQuDwGZCfeL2WjLRFuRGat80Cseqe37SHIpZR0md4uhLA6Jf9KoogXhPctmT b5oltesglD+6Qg4kOB4DzZa+5tm4tTBSORjXOWYPqf6E0+mCis+WIcwm0+/jrPIqaObF DN/2a58BnSVemZccWghXBU/x2r6MT/J3i4i0gufjzm2ba1HQtClueDfdhBbs/uqwzhgW wxTr5BoWmkcS9mnTWvDKuHNXI62b84U48ShW8qFx+/I2NGIJGpA67H/+CI2KDuFlFtxb 8fgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zq8OmPxE; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si3207675ejs.599.2020.10.29.13.44.20; Thu, 29 Oct 2020 13:44:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=zq8OmPxE; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726740AbgJ2Um4 (ORCPT + 99 others); Thu, 29 Oct 2020 16:42:56 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:36016 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726796AbgJ2UlQ (ORCPT ); Thu, 29 Oct 2020 16:41:16 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1604004074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=atBWSsg54EdElpQmxIGprMythfayvCfZuL6C0LobpJM=; b=zq8OmPxEES1sHwpepW8vzEe0jYTTlYtXV12+hxY9jzb3tYWHhm/ZdTBMeg3suW0uXnI22o QRfyl9qohhkGLsu5YphvfKNBGVVDQawQCEUKIkYyS9kHIx+egw2JhKwPfjRd0CQcLbf0Ma 0+PC2RmqmSccZCm0+EePmF3HtanM8DIlixTveKLP2V0Ksru8Qhe9ajxfSPkPPl0uWvBwkU CZwbIAvCZIttVS0GI97ynyZTPYQQIOv8hYusYoSjZ4dO50yoSQ3YCiIbnrq6RPIo7I7h9P itJ4XgJrsTvo9TskPmCZoEXzffgEzSJ6VbIxGy8NcIttwKKxU5XG9VypabrK6g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1604004074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=atBWSsg54EdElpQmxIGprMythfayvCfZuL6C0LobpJM=; b=0iX007DAMCgsp9VjWAMG/D89r7Kujao6BFenyKLGjjTNx6nxedksxtcAkjsrsCDNJr2Ram K5nPYTQvIUbyR9CA== To: Paolo Bonzini , Arvind Sankar , David Laight Cc: 'Arnd Bergmann' , Ingo Molnar , Borislav Petkov , "x86\@kernel.org" , Arnd Bergmann , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "H. Peter Anvin" , "Rafael J. Wysocki" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , "linux-hyperv\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" , "kvm\@vger.kernel.org" , "platform-driver-x86\@vger.kernel.org" , "xen-devel\@lists.xenproject.org" , "iommu\@lists.linux-foundation.org" Subject: Re: [PATCH] [v2] x86: apic: avoid -Wshadow warning in header In-Reply-To: <93180c2d-268c-3c33-7c54-4221dfe0d7ad@redhat.com> References: <20201028212417.3715575-1-arnd@kernel.org> <38b11ed3fec64ebd82d6a92834a4bebe@AcuMS.aculab.com> <20201029165611.GA2557691@rani.riverdale.lan> <93180c2d-268c-3c33-7c54-4221dfe0d7ad@redhat.com> Date: Thu, 29 Oct 2020 21:41:13 +0100 Message-ID: <87v9esojdi.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29 2020 at 17:59, Paolo Bonzini wrote: > On 29/10/20 17:56, Arvind Sankar wrote: >>> For those two just add: >>> struct apic *apic = x86_system_apic; >>> before all the assignments. >>> Less churn and much better code. >>> >> Why would it be better code? >> > > I think he means the compiler produces better code, because it won't > read the global variable repeatedly. Not sure if that's true,(*) but I > think I do prefer that version if Arnd wants to do that tweak. It's not true. foo *p = bar; p->a = 1; p->b = 2; The compiler is free to reload bar after accessing p->a and with bar->a = 1; bar->b = 1; it can either cache bar in a register or reread it after bar->a The generated code is the same as long as there is no reason to reload, e.g. register pressure. Thanks, tglx