Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp368424pxb; Wed, 11 Nov 2020 05:54:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHPNl4ZPavXfQGAIOqUJhmhd1cwsaCX7/011p7glL3S7qvjQ+kbFAlbPVXdjIbtgJ7zKwQ X-Received: by 2002:a05:6402:14cf:: with SMTP id f15mr5017475edx.18.1605102848703; Wed, 11 Nov 2020 05:54:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605102848; cv=none; d=google.com; s=arc-20160816; b=KiVHlHy02dfUay0JlUKIS0ducs7fgrHdppOBHSow2k7YiPKnulwR8Cy7WaNAzpSCbe fiFrFO8axbhoijK0aI50sLVp4Q2nnfc2kkJFKMeFiQZ8Z9s8s7JuEFkhDFKjUy/6nneH yT9rp9bfKUkhVX9aE9cCG1wTr2CwEt2AZiqouPD1LtGqlv4vHG854fvIzqg9TUrJavK+ FTSp5QjSyM9yY8W8O2zAtNvdoMgbEd7gnI/XUFy0NNLTTVlLUS3350/QbBhz21tMofES rw67JvHW/I4WVQDw6fxSjh+TkELnhbs1Ra0WynVYnPkSGhM23LBUi1GHpuMOHSut1YDC 56bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=fNjZsE2XCU1Oji7d/9CTPbDfXVPEtwJSNnjC4GIabUM=; b=FZnTF0cJTXmh3URjRm8rw4pcwYxCkq6i3Esdnyeq8rEVonQkInNjeer1NgZ+jji+gM Y/+oBWuRDJ4rxjz8k2zfkgyClU5iGFts5ZoLV9AkWxAAGFYPbh+SyzMs+VqXoW91CCyy BbX197aN+wlNeuYwq8+9wGKdFp3zA4suRYRg8e/3iunrmnHEZtb0hs1gc3gVwz5n0Ts6 9SflQ1WiFomFd6i0JDoxej4VkLyKu8KBoudolDdxSqRyMF2fiO6FC9Ohx5L1yKfshGdF ievSX9yhqzlSrcQJYYkEoIGta+RiDjmf4zbIKad+rt7KxeTLUxQExF219epcSRCwap6a 1pNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WvD1Kt0r; 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 qk1si1275347ejb.260.2020.11.11.05.53.43; Wed, 11 Nov 2020 05:54:08 -0800 (PST) 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=@kernel.org header.s=default header.b=WvD1Kt0r; 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 S1727017AbgKKNwO (ORCPT + 99 others); Wed, 11 Nov 2020 08:52:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:42122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgKKNwJ (ORCPT ); Wed, 11 Nov 2020 08:52:09 -0500 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 B6D702072C; Wed, 11 Nov 2020 13:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605102728; bh=vpzQhD31kZiz0Ds3ndWnHcNtFHrzT9rX+xjSS3L2qxs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WvD1Kt0rYFg9LPKQES5pJcwfYvw83ZpPUhh0NWExD5onFN9DyY3DuF/q61lUKfdpD CIoap2gAK2Q2fSkijiMy5U01a8voRmPb8f4kaqvbDtPWP8k/1FphdUqx4VNzfHAkiK WxDnceLo/UM3VrVCveroTBou4ju2eMynmawPEs5E= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kcqXe-009mGl-JM; Wed, 11 Nov 2020 13:52:06 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 11 Nov 2020 13:52:06 +0000 From: Marc Zyngier To: David Brazdil Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, James Morse , Julien Thierry , Suzuki K Poulose , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , Quentin Perret , Andrew Scull , Andrew Walbran , kernel-team@android.com Subject: Re: [PATCH v1 07/24] kvm: arm64: Create nVHE copy of cpu_logical_map In-Reply-To: <20201111134527.ygzf5cm6qpdpcroo@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> <20201109113233.9012-8-dbrazdil@google.com> <20201111130321.qalrzfabdonrwvsz@google.com> <15a580e6ac06294ead8859fba8f51deb@kernel.org> <20201111134527.ygzf5cm6qpdpcroo@google.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <3ed604d7837fa64ec7c4fe5920c57382@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, dennis@kernel.org, tj@kernel.org, cl@linux.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, qperret@google.com, ascull@google.com, qwandor@google.com, kernel-team@android.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 2020-11-11 13:45, David Brazdil wrote: > On Wed, Nov 11, 2020 at 01:29:29PM +0000, Marc Zyngier wrote: >> On 2020-11-11 13:03, David Brazdil wrote: >> > > > +/* >> > > > + * nVHE copy of data structures tracking available CPU cores. >> > > > + * Only entries for CPUs that were online at KVM init are populated. >> > > > + * Other CPUs should not be allowed to boot because their features were >> > > > + * not checked against the finalized system capabilities. >> > > > + */ >> > > > +u64 __ro_after_init __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] >> > > > = INVALID_HWID }; >> > > >> > > I'm not sure what __ro_after_init means once we get S2 isolation. >> > >> > It is stretching the definition of 'init' a bit, I know, but I don't see >> > what >> > your worry is about S2? The intention is to mark this read-only for >> > .hyp.text >> > at runtime. With S2, the host won't be able to write to it after KVM >> > init. >> > Obviously that's currently not the case. >> >> More importantly, EL2 can write to it at any time, which is the bit >> I'm >> worried >> about, as it makes the annotation misleading. > > EL2 can't, at least not accidentally. The hyp memory mapping is > PAGE_HYP_RO > (see patch 05). Ah, I obviously overlooked that. Thanks for setting me straight. > Shouldn't clash with include files. Where fixing the kernel might clash > is > all the users of for_each_*_cpu that use an int for the iterator var. I don't think that's a problem (nobody expects that many CPUs). But if you are confident that we don't have a problem, no need to change the kernel itself. M. -- Jazz is not dead. It just smells funny...