Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp677032pxk; Wed, 16 Sep 2020 14:10:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgRVWeP7DqNYCQAPpme1PMDtJTBEBf7lktkTWcLpz7nQ3rUL6EIMglgilDQfkrjfn+qgMC X-Received: by 2002:a17:906:d11a:: with SMTP id b26mr26534170ejz.191.1600290617238; Wed, 16 Sep 2020 14:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600290617; cv=none; d=google.com; s=arc-20160816; b=fnGrD3aaBC0pwyCibGh3fiTcgOlgbmCOGETHbMvnhK6oAcvmnesLV2tTmwWN6mSXiv kYvosMcNtmlNEZMRhCp9xAmjfcv1tIqKcTiXN1gzxIWsNQsEnK/yGuvEodKqCni7caTV vIt0qDoQTq7AKOoA1Mm7SCKA8vt38VmxLiVRjbGxKcdYdNGDd63BfIfwJr+BTYIYu2Np O4oM6g0xG/b5tM+W6fYQ4yghCqVawQTyYgPwFaf2VJPgYEurgSGcZqw/mgezozw0hbsa q3AmWwEMlt5WpFE5JVs47si2mWa0fTBOPWnns9rfFNtVmdl/tULrtnuK0ITgjNr1dM/a yd0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Yh0igFnXFGH3K7pZzQhRNs7ViU5/hMjpnGkORzHpipk=; b=D5VKDQx2Hx6f+uadUi8yVVQYDslW5Wa+Tw8WAKRIvjuRBCYDJIEEblhgIcF6kSEu3Z LhvQp+niul165GMDVAQEwaCYvTMZtisn242bYLmd6A1/EThwQd3GHQfhu+otExSQ8aYw pC5umWgUC6TuR0yibw//66ficxoeiIIVzsxK8Xl2Lcjnttkd/S6fkiywfSOtwiDFqC+p GxccjMovSFylNUlkRRpsht3TkXoa78uWRbhGeYQfgZu4YgZ1WySI917KPT83PS3U15rJ wf03IDwvh2U2qjTeRiB6nCezad/i3gYEib6ZQryebekvOiqHmssEGJ0smRlY6ed8hFQC TElg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="JyQsV3C/"; 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 z1si11920511edx.584.2020.09.16.14.09.53; Wed, 16 Sep 2020 14:10:17 -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=@google.com header.s=20161025 header.b="JyQsV3C/"; 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 S1726609AbgIPVI4 (ORCPT + 99 others); Wed, 16 Sep 2020 17:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726468AbgIPQDj (ORCPT ); Wed, 16 Sep 2020 12:03:39 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06C5BC0698E3 for ; Wed, 16 Sep 2020 04:54:07 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id b79so2692054wmb.4 for ; Wed, 16 Sep 2020 04:54:07 -0700 (PDT) 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=Yh0igFnXFGH3K7pZzQhRNs7ViU5/hMjpnGkORzHpipk=; b=JyQsV3C/yV+HMhjcrBeo4b6vbtbXN/7M7NJbIgBea1ZCl6bB/Wv56zT6tM39MhZYIz 1ePZsPTW5M75mT5wRpRoNtZy/x1FJ8O69Jo5IFaxDlzHdWeRiNrB4GKbyft7T7Rf3m7c aWwz5PsssRQJClQFnacWnvlS5MQg4yUM9L2jw8VuALu4NTPRUxNv67kIW5FUWGPCDVP9 yMm7HzrgXsD04qEeBHOQTjc1spMBk+h1ObSRut8UsG0poo7gRH4ptNx9EujbEMj5Cb7U w4FXV2249ahLD5jNOQ2ov9+67BvirUZC0p0CE4a+dXdPSDP2nJyRXQPZXP6lPs90vfLk zTZQ== 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=Yh0igFnXFGH3K7pZzQhRNs7ViU5/hMjpnGkORzHpipk=; b=gvprVuGAty5nv5i7G54T0mkqc4Zu7xNPnoPGBKGC4sMkREKIHWWH/hvlFk0VBvNsVL 8p9QjIPoGvJWyDy7J695qRrnxynyyqMzgGpvv+2xq1SXUAblsYjLrpH/fMgF/Ascjcz2 RG+gGh/jOn+nIOeVmNhvGuggedGyIVmc0Q0a1gV0uQPuJHWRTcSZY+tjLylR0D0/raYX Yh0ozOUM6VP2UBz75W3GqNzBc4kPruRTYRXGb0jciBYSFOoS3TJuhxed9vsqfrm4HFmG lKA+lulA4KfKenW8Sa6PL61dIOctMeSqe7F+dfzbsOFUhxfkjBrlw7KzE26O6GGwqyYZ TgKw== X-Gm-Message-State: AOAM531uBzNgsc8ooSnKh56e9nwRMLNPH3QqO7Z8tPtsJrq6F+2stCri MQ0ME5Kk8OUPKr++BUJEZ5gosw== X-Received: by 2002:a05:600c:2118:: with SMTP id u24mr4258846wml.59.1600257246355; Wed, 16 Sep 2020 04:54:06 -0700 (PDT) Received: from google.com ([2a01:4b00:8523:2d03:e49d:f6be:d31b:ad3c]) by smtp.gmail.com with ESMTPSA id u66sm5088416wmg.44.2020.09.16.04.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 04:54:05 -0700 (PDT) Date: Wed, 16 Sep 2020 12:54:04 +0100 From: David Brazdil To: Will Deacon Cc: Marc Zyngier , Catalin Marinas , Dennis Zhou , Tejun Heo , Christoph Lameter , Arnd Bergmann , James Morse , Julien Thierry , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 00/10] Independent per-CPU data section for nVHE Message-ID: <20200916115404.rhv4dkyjz35e4x25@google.com> References: <20200903091712.46456-1-dbrazdil@google.com> <20200914174008.GA25238@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200914174008.GA25238@willie-the-truck> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will, On Mon, Sep 14, 2020 at 06:40:09PM +0100, Will Deacon wrote: > Hi David, > > On Thu, Sep 03, 2020 at 11:17:02AM +0200, David Brazdil wrote: > > Introduce '.hyp.data..percpu' as part of ongoing effort to make nVHE > > hyp code self-contained and independent of the rest of the kernel. > > > > The series builds on top of the "Split off nVHE hyp code" series which > > used objcopy to rename '.text' to '.hyp.text' and prefix all ELF > > symbols with '__kvm_nvhe' for all object files under kvm/hyp/nvhe. > > I've been playing around with this series this afternoon, trying to see > if we can reduce the coupling between the nVHE code and the core code. I've > ended up with the diff below on top of your series, but I think it actually > removes the need to change the core code at all. The idea is to collapse > the percpu sections during prelink, and then we can just deal with the > resulting data section a bit like we do for .hyp.text already. > > Have I missed something critical? I was wondering whether this approach would be sufficient as well because of the simplicity. We'd just need to be careful about correctly preserving the semantics of the different .data..percpu..* sections. For instance, I've noticed you make .hyp..data..percpu page-aligned rather than cacheline-aligned. We need that for stage-2 unmapping but it also happens to correctly align DEFINE_PER_CPU_PAGE_ALIGNED variables when collapsed into the single hyp section. The reason why I ended up reusing the global macro was to avoid introducing subtleties like that into the arm64 linker script. Do you think it's a worthwhile trade off? One place where this approach doesn't work is DEFINE_PER_CPU_FIRST. But I'm guessing that's something we can live without. I was also wondering about another approach - using the PERCPU_SECTION macro unchanged in the hyp linker script. It would lay out a single .data..percpu and we would then prefix it with .hyp and the symbols with __kvm_nvhe_ as with everything else. WDYT? Haven't tried that yet, could be a naive idea. Thanks for reviewing, David