From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A800C388F9 for ; Wed, 11 Nov 2020 13:46:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F9E52072C for ; Wed, 11 Nov 2020 13:46:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NvyiT2+Z"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="n6ILGBo/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F9E52072C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ul3S0F1UMiYpFx15g80fd4BPUYJqu7zq5Ih2WgmVYa4=; b=NvyiT2+Z4ha/RwFp/swfFU2fI i4MxW1xA1qyzS1wt/RrcfFDoTzZQxmAxDdMpRN31LV+MlnCN6Ma8nBcOSz2HPNG8yK8EoDZIgQx7r +4aVWuK/NoELrW+9bCmDwTQhzquxTH61edGFsykBgUhuBACJuUC2iCOC/G9QlzzwcsPfGMSDU4Zsa UrMIjuH8meHqnq4skf2M/nY1ZkEu/hRgZtq2xTWnlNh7JBJPBjgh4vMT/gvNyLxSy1wzxxkUXCtaA LhTZV7kJ3lU7/ATf37pNtplLr03o0KfdiSivGM0cO3Fpd4EigTC2wtQig8AOHIn/wvQJlOrEdYLem wvCsBQoIw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcqRK-0008Rr-5w; Wed, 11 Nov 2020 13:45:34 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcqRG-0008RU-HZ for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2020 13:45:31 +0000 Received: by mail-wr1-x443.google.com with SMTP id 33so2580213wrl.7 for ; Wed, 11 Nov 2020 05:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=aN9UhE4DLqxeGNvPkzfZsJS2+DLJT4pT+KyGFIkUBxM=; b=n6ILGBo/Vse8JvnguXnl3tQYuKcQPOHhQNVXLdZ4gvmWMzEEBVmfuLXBmmzVAt+SGg +QMI3ZLjDTF/wfhpjLJfsVSNgTmmQTsOGzhYpn9Ws4AljBWYwc/IsR4l5Gcq3jaQDw+e iRMgY2QF6TIkJqwhqwBToAbDeBVpTZ/2lZDjpLLUjmKdtfG0mnuTIeLCCQQ3jTsmrG6R n8JolcURVbOgUM4scyPuTbf25B7l0b/AaaNVYfMVXoVu/tzv2XU3i8iAIXzOGTrCgdP1 QLfIxzUzm0a0P43i4ha4vQqOO3zjnKRLeQJrbA4Jo3LcpMmnu6ZdpYb9Awa0jOdXolG8 fqPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aN9UhE4DLqxeGNvPkzfZsJS2+DLJT4pT+KyGFIkUBxM=; b=hQYXNtNqXOzXlJetjy+sam8AUwO5etG5wti4hi25E1bGPrYzOOS4ouigWOCeP5Gd78 mDwKpo16Wyr3nN7MTZAPzwg1BVSAuWl7RApHDaH3qOzOeTywD3AHRrHU1IBE0/IhLYZt hGNhqAFojA78z5B5Mxlm+daEtRUNL5TtWswCzrDb5Df+8Ne8SFTyXkB4Bo6vkkZPXJlt cHfrZk+Qc2mJxRfRnOqL75w5jWogKctABR7vCczRQY9s5+oNurqOGxGYIS2A91PG+aVx zaslY7tcskFjzSgrGwCUFMITHE0iYzP2z0K5IMKOvteVsMw/DdkvNacgKGE02xaPlPWT 2/zA== X-Gm-Message-State: AOAM533sN9idAHd0bNbGBrAbn+1FV58v01gpYKLfe21d3zZeOlJKz1P7 onIQ0TuwTgl8MfGI9Dy7qJrsYw== X-Google-Smtp-Source: ABdhPJxNfMSdJg/5S43HS/VH+jA7JrZoyOTCCBu3ZeYuIkATnnLfgh3FcQjEebsSYbjXIRr8KwAMdw== X-Received: by 2002:a5d:4ec2:: with SMTP id s2mr30003335wrv.258.1605102329039; Wed, 11 Nov 2020 05:45:29 -0800 (PST) Received: from google.com ([2a01:4b00:8523:2d03:2595:ed05:1717:fe6e]) by smtp.gmail.com with ESMTPSA id y63sm2575014wmg.28.2020.11.11.05.45.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 05:45:28 -0800 (PST) Date: Wed, 11 Nov 2020 13:45:27 +0000 From: David Brazdil To: Marc Zyngier Subject: Re: [PATCH v1 07/24] kvm: arm64: Create nVHE copy of cpu_logical_map Message-ID: <20201111134527.ygzf5cm6qpdpcroo@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> <20201109113233.9012-8-dbrazdil@google.com> <20201111130321.qalrzfabdonrwvsz@google.com> <15a580e6ac06294ead8859fba8f51deb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <15a580e6ac06294ead8859fba8f51deb@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201111_084531_013162_019C7BCE X-CRM114-Status: GOOD ( 29.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kernel-team@android.com, Lorenzo Pieralisi , Andrew Walbran , Suzuki K Poulose , Catalin Marinas , Quentin Perret , linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Tejun Heo , Dennis Zhou , Christoph Lameter , Will Deacon , kvmarm@lists.cs.columbia.edu, Julien Thierry , Andrew Scull Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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). Does this annotation have stronger guarantees in EL1? AFAICT, those variables are made PAGE_KERNEL_RO in mark_rodata_ro(). > > > One thing we might change in the future is marking it RW for some > > initial > > setup in a HVC handler, then marking it RO for the rest of uptime. > > That'd be a desirable outcome, and it would be consistent with the rest > of the kernel. > > > > > > > > > > + > > > > +u64 cpu_logical_map(int cpu) > > > > > > nit: is there any reason why "cpu" cannot be unsigned? The thought > > > of a negative CPU number makes me shiver... > > > > Same here. That's how it's defined in kernel proper, so I went with > > that. > > I'm happy to deviate from the kernel (give the function a different name > if this clashes with existing include files). > > We can also fix the rest of the kernel (I've just written the trivial > patch). 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel