Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp337098pxb; Wed, 11 Nov 2020 05:07:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYR3VQ7G3Olm9ZJPMvRyh180HsfeZYqdmQfbON2GmXCx4lN6o0N0u0jgvhE7OjrcEzrfQ7 X-Received: by 2002:a05:600c:21cc:: with SMTP id x12mr4007305wmj.8.1605100071853; Wed, 11 Nov 2020 05:07:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605100071; cv=none; d=google.com; s=arc-20160816; b=e7f1Athm42QVVstjTGh7Xvu3ZinO4FxzTo+oVC/scNxMoCK3jEs9cY03DdFswEaJdf 1VQDzEKIEu+Dr89dbU9fD0oEKcFMZIyJttEKFeb55sBgldoR8MSRexmFSyGXY7s362eX etVw8dN87wtoL+C9y5walNJbu7f+thwszD39gzaI9VrFZI4DyMlJVGauS5r3gpXqZn8n +cNlYLrMmNyX3JazYyahm+mjVuueAM/Abs+IpKhtMPvwR69wofZ4VZawvXeS6ODy+Czf ZVSmy0/p/oHRKDvk0ivA3AYsKWoEUTicBfCfO7Lk4EwiVK52avedQeLDHrke3NrhW3tG Du6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XdgP6+ZmS9XKah/BF5cKI8FqYLe6KBfyjX/IEuvicQk=; b=kC+yfB+TFU3E4mjHS+4Oq+sKSXOK0JA5sso1E4O52rXTVtakN2CIvcMexSQV6RYGnB r2B8dJT2ML2vuty4cuknu1lUkWNAQZ4rEaDRKVJUBXKqtknT7t/uO1n20XkYoNzCFxnv PxCeSL6JRPymRAkxd2LGfE4L/tyygYJTxkWrGLOvn38AFksCoGTed44blQDFMk5qLJ2G qaoPWcoLt/rSydWmCJxvAPJPihkYznuoHy/50aWWCsHd45w1OyjUUxs3DVFi9lyLURlw SFysnIdQrRhjc28xwtHKGhn8KRVRmCjOIlB2uXXJuNbUO2bNzGwwnE5hscji6eKpQM6Y 443g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Sd1vuoKU; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk6si1213686ejb.716.2020.11.11.05.07.21; Wed, 11 Nov 2020 05:07:51 -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=@google.com header.s=20161025 header.b=Sd1vuoKU; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726104AbgKKND1 (ORCPT + 99 others); Wed, 11 Nov 2020 08:03:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgKKND1 (ORCPT ); Wed, 11 Nov 2020 08:03:27 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84433C0613D1 for ; Wed, 11 Nov 2020 05:03:26 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id s13so2247799wmh.4 for ; Wed, 11 Nov 2020 05:03:26 -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=XdgP6+ZmS9XKah/BF5cKI8FqYLe6KBfyjX/IEuvicQk=; b=Sd1vuoKU1AAoYkRoYQHxPEIrxpuhnPYf6Jliv3HEtBhI373IsM55sSjF/1PlobkLkW SxhGOo+oyAGlcN0kEMK14apG+X1On5FFrOy26nZhrqCtJNnnHhs+zNwpB1QjAr9fxQ60 ulwdOIk3Cg6pW/Z5fHxdnoAEddVYu7JHHMCEAoqBTZugKX/R+QpchiECxxBoGjH1oyCX BD50o7vNtJFgFReaBuCHNnGAbz8EXlNJ5P6fFLhjeJFRPJlGMjBO7eI8UcPbUj45Nt51 s3yJhAm0LM8vaTZmzbaz654XgbC7HJOzzwOJQbnR/Pr73PQiiqVUjmE2rEppd6OAtCOc GVug== 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=XdgP6+ZmS9XKah/BF5cKI8FqYLe6KBfyjX/IEuvicQk=; b=U2Jav5CIyEdMiyHk0kxKczKjG0aQE5yhu+HshtNvYnV4WDT0Gb4b/LrCZu5Fmhi68u DLrr94Oe8xhO3czTevgoGEHoN2+03rN9NRe/RGefQHD97ygwlhHCSQd8gTxP8+6QEgtx 9JGW/ytXs8AnX6IVqZbMj/BUpA+emH3GEE7qMBqpfZpyUOt5dI3m0fLtIFjMpA2PdBIS I97p9hTOIv/OwjShHDBfRJobF2/nnxZNeTX50nAGVMusFmBW5MPUZfjCFwl4QVgUmd01 D9XkbotP3SAIU+Q8QgFiENWkY5vHws1g4a3G638b8HqnfohiO/zI50UMLR/KCQY38Wea 0/Uw== X-Gm-Message-State: AOAM532jCiejyYYVcZLLA7qbvyOKISipCtRgbLA9u0cOk3NGR8HY5YvJ 3WE0iCHIl+a4CMtEERe44tLiuw== X-Received: by 2002:a1c:bd08:: with SMTP id n8mr4008787wmf.136.1605099804930; Wed, 11 Nov 2020 05:03:24 -0800 (PST) Received: from google.com ([2a01:4b00:8523:2d03:2595:ed05:1717:fe6e]) by smtp.gmail.com with ESMTPSA id g138sm2508752wme.39.2020.11.11.05.03.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 05:03:23 -0800 (PST) Date: Wed, 11 Nov 2020 13:03:21 +0000 From: David Brazdil To: Marc Zyngier 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 Message-ID: <20201111130321.qalrzfabdonrwvsz@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> <20201109113233.9012-8-dbrazdil@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +/* > > + * 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. 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. > > > + > > +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. > > > +{ > > + if (cpu < 0 || cpu >= ARRAY_SIZE(__cpu_logical_map)) > > + hyp_panic(); > > + > > + return __cpu_logical_map[cpu]; > > +} > > + > > unsigned long __hyp_per_cpu_offset(unsigned int cpu) > > { > > unsigned long *cpu_base_array; > > Overall, this patch would make more sense closer it its use case > (in patch 19). I also don't understand why this lives in percpu.c... I didn't think it called for adding another C file for this. How about we rename this file to smp.c? Would that make sense for both?