Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1287812pxj; Sat, 12 Jun 2021 04:13:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEbkazUYvf/JaJMGugz9PVTkAzzZ4rCmBNSGZKVVwdKjfitB4idW6amLxK6H3WoqASoV0e X-Received: by 2002:aa7:d84e:: with SMTP id f14mr8104809eds.12.1623496438129; Sat, 12 Jun 2021 04:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623496438; cv=none; d=google.com; s=arc-20160816; b=ReV23JYQUBtOvbm2OMTQ3eIy+yoRkwX5mFjE4xcKhUIZLBBowB1pe3GBT8oQgNAkmN laj2+BJB0TySUH54fS9ui1C0CLIqnysPyBotb1OteT6ruvlcRD5f+Gnxa6f1WCRU0Fmt Zw+VqwJswSFAsT36vnUzH6CTQxlXS9oGlPOieMmwqyI/LEQM+0kdts77mUywmnjqcS7D 6Lp8YJTTFO/6nHkam6QVKTbB2WvdDFmCHJHhy7rFoxqopjtKRWb98VaX0AkuT/dpyj/D V+V2FCfZahweGVfcFY9KEEId05FbjEdb539eAHiU+Z2C+VEQbQuXMMg8OKdqWOs+zQIa gjFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=zzXUpGdYdQeQQt7QJZ+C99l8ordb3V30rK0t2rl0Vrw=; b=UDOF24nsTF1xhHXpVTsf03RnRXkMz5n6KVyol08j8EHqipSqB+SMk1KhFn3CD3zCXL wVqLGpXeZTbo9Kjkxby35G5+BJMu1sPyIPB5EWjjDOCwZg9ANU3CZdXHRYsKmS1zJRco aF+T2vLK2HszPCY9xzjXXE0Hyn+CIeB/DNP7FBL42k6dbe2K6ZLEM/+PPCjXbeN3ocvk nvibnyeHvLwg3eId0apiJtBKKOtgF4HYICeeQ3z3UqpjE5NiMD8YJ9ZZ0OyZsRWsZzCe bTwwu9XitEjdqoP5lLupDHZiQmXcaspLGJAiGuVcHfXzF/NbYWuvlhiBAGZYe2+6TeWP Smsg== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si6752198edt.290.2021.06.12.04.13.32; Sat, 12 Jun 2021 04:13:58 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231158AbhFLLMq (ORCPT + 99 others); Sat, 12 Jun 2021 07:12:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:37688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbhFLLMp (ORCPT ); Sat, 12 Jun 2021 07:12:45 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4BB3261376; Sat, 12 Jun 2021 11:10:46 +0000 (UTC) Received: from [185.219.108.64] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ls1XI-0079Gc-6h; Sat, 12 Jun 2021 12:10:44 +0100 Date: Sat, 12 Jun 2021 12:10:43 +0100 Message-ID: <87eed7tk24.wl-maz@kernel.org> From: Marc Zyngier To: Austin Kim Cc: james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, austin.kim@lge.com Subject: Re: [PATCH] KVM: arm64: vgic: declear local variable 'flags' before for loop starts In-Reply-To: <20210612110014.GA1211@raspberrypi> References: <20210612110014.GA1211@raspberrypi> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: austindh.kim@gmail.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, austin.kim@lge.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 12 Jun 2021 12:00:14 +0100, Austin Kim wrote: > > From: Austin Kim > > Normally local variable 'flags' is defined out of for loop, > when 'flags' is used as the second parameter in a call to > spinlock_irq[save/restore] function. > > So it had better declear local variable 'flags' ahead of for loop. Why better? Reducing the scope of a variable is in general good practice. Do you see any material advantage in moving this variable out of the loop? Does the compiler generate better code? Thanks, M. -- Without deviation from the norm, progress is not possible.