mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Brazdil <dbrazdil@google.com>
To: Andrew Scull <ascull@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Dennis Zhou <dennis@kernel.org>,
	Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@linux.com>,
	Arnd Bergmann <arnd@arndb.de>, James Morse <james.morse@arm.com>,
	Julien Thierry <julien.thierry.kdev@gmail.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	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 03/10] kvm: arm64: Remove __hyp_this_cpu_read
Date: Thu, 17 Sep 2020 09:34:30 +0100	[thread overview]
Message-ID: <20200917083430.sxe4rpwp2lrdu3hq@google.com> (raw)
In-Reply-To: <20200910111225.GC93664@google.com>

Hey Andrew,

> > +#ifdef __KVM_NVHE_HYPERVISOR__
> > +#define __my_cpu_offset __hyp_my_cpu_offset()
> 
> Is there a benefit to this being used for __KVM_VHE_HYPERVISOR__ too
> since that is "hyp" too and doesn't need the alternative since it will
> always pick EL2?

Minor time and space savings, but you're right, makes sense to treat them
equally. Updated in v3.

> > +/* Redefine macros for nVHE hyp under DEBUG_PREEMPT to avoid its dependencies. */
> > +#if defined(__KVM_NVHE_HYPERVISOR__) && defined(CONFIG_DEBUG_PREEMPT)
> > +#undef	this_cpu_ptr
> > +#define	this_cpu_ptr		raw_cpu_ptr
> > +#undef	__this_cpu_read
> > +#define	__this_cpu_read		raw_cpu_read
> > +#undef	__this_cpu_write
> > +#define	__this_cpu_write	raw_cpu_write
> > +#endif
> 
> This is an incomplete cherry-picked list of macros that are redefined to
> remove the call to __this_cpu_preempt_check that would result in a
> linker failure since that symbol is not defined for nVHE hyp.
> 
> I remember there being some dislike of truely defining that symbol with
> an nVHE hyp implementation but I can't see why. Yes, nVHE hyp is always
> has preemption disabled so the implementation is just an empty function
> but why is is preferrable to redefine some of these macros instead?

That was my initial implementation and we could probably sway others in that
direction, too. That said, I just tried it on 5.9-rc5 and there are two more
dependencies. No idea what changed sinced the last time I tried, maybe I simply
messed up back then.

Basically, this_cpu_ptr translates to:
  __this_cpu_preempt_check(); per_cpu_ptr(sym, debug_smp_processor_id())

__this_cpu_preempt_check: should be empty for hyp
per_cpu_ptr: needs mapping of the array of bases in hyp, otherwise easy
debug_smp_processor_id: needs a clone of 'cpu_number' percpu variable

Neither of these is particularly difficult to implement, and two will even be
useful going forward, but it still feels too fiddly for posting this late in
the 5.10 cycle. So I suggest we stick to the macro redefines for now and I'll
post those patches for 5.11. WDYT?

You can find the patches on branch 'topic/percpu-v3-debug-preempt' of
https://android-kvm.googlesource.com/linux.

David

  reply	other threads:[~2020-09-17  8:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  9:17 [PATCH v2 00/10] Independent per-CPU data section for nVHE David Brazdil
2020-09-03  9:17 ` [PATCH v2 01/10] Macros to override naming of percpu symbols and sections David Brazdil
2020-09-03  9:17 ` [PATCH v2 02/10] kvm: arm64: Partially link nVHE hyp code, simplify HYPCOPY David Brazdil
2020-09-10  9:54   ` Andrew Scull
2020-09-14 13:09   ` Will Deacon
2020-09-03  9:17 ` [PATCH v2 03/10] kvm: arm64: Remove __hyp_this_cpu_read David Brazdil
2020-09-10 11:12   ` Andrew Scull
2020-09-17  8:34     ` David Brazdil [this message]
2020-09-03  9:17 ` [PATCH v2 04/10] kvm: arm64: Remove hyp_adr/ldr_this_cpu David Brazdil
2020-09-10 12:34   ` Andrew Scull
2020-09-03  9:17 ` [PATCH v2 05/10] kvm: arm64: Add helpers for accessing nVHE hyp per-cpu vars David Brazdil
2020-09-03  9:17 ` [PATCH v2 06/10] kvm: arm64: Duplicate arm64_ssbd_callback_required for nVHE hyp David Brazdil
2020-09-03  9:17 ` [PATCH v2 07/10] kvm: arm64: Create separate instances of kvm_host_data for VHE/nVHE David Brazdil
2020-09-03  9:17 ` [PATCH v2 08/10] kvm: arm64: Mark hyp stack pages reserved David Brazdil
2020-09-03  9:17 ` [PATCH v2 09/10] kvm: arm64: Set up hyp percpu data for nVHE David Brazdil
2020-09-03  9:17 ` [PATCH v2 10/10] kvm: arm64: Remove unnecessary hyp mappings David Brazdil
2020-09-10 14:07   ` Andrew Scull
2020-09-16 13:35     ` David Brazdil
2020-09-14 17:40 ` [PATCH v2 00/10] Independent per-CPU data section for nVHE Will Deacon
2020-09-16 11:54   ` David Brazdil
2020-09-16 12:24     ` David Brazdil
2020-09-16 12:39       ` Will Deacon
2020-09-16 12:40         ` David Brazdil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200917083430.sxe4rpwp2lrdu3hq@google.com \
    --to=dbrazdil@google.com \
    --cc=arnd@arndb.de \
    --cc=ascull@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=cl@linux.com \
    --cc=dennis@kernel.org \
    --cc=james.morse@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tj@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®