kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
From: David Brazdil <dbrazdil@google.com>
To: Qian Cai <qcai@redhat.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Will Deacon <will@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	Marc Zyngier <maz@kernel.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sudeep Holla <sudeep.holla@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Tejun Heo <tj@kernel.org>, Dennis Zhou <dennis@kernel.org>,
	Christoph Lameter <cl@linux.com>,
	kernel-team@android.com, kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 17/26] kvm: arm64: Add offset for hyp VA <-> PA conversion
Date: Tue, 8 Dec 2020 10:08:30 +0000	[thread overview]
Message-ID: <20201208100830.dhkkhzsqiy46euod@google.com> (raw)
In-Reply-To: <1835d0c3d0f6024b7c6778d9d84f1120291eacad.camel@redhat.com>

Hi Qian,

> > +/*
> > + * Store a hyp VA <-> PA offset into a hyp-owned variable.
> > + */
> > +static void init_hyp_physvirt_offset(void)
> > +{
> > +	extern s64 kvm_nvhe_sym(hyp_physvirt_offset);
> > +	u64 kern_va, hyp_va;
> > +
> > +	/* Compute the offset from the hyp VA and PA of a random symbol. */
> > +	kern_va = (u64)kvm_ksym_ref(__hyp_text_start);
> > +	hyp_va = __early_kern_hyp_va(kern_va);
> > +	CHOOSE_NVHE_SYM(hyp_physvirt_offset) = (s64)__pa(kern_va) - (s64)hyp_va;
> 
> The code here introduced a warning on TX2 from today's linux-next.
> 
> .config: https://cailca.coding.net/public/linux/mm/git/files/master/arm64.config
> 
> [   29.356963] CPU255: Booted secondary processor 0x0000011f03 [0x431f0af1]
> [   29.358301] smp: Brought up 2 nodes, 256 CPUs
> [   29.364962] SMP: Total of 256 processors activated.
> [   29.364985] CPU features: detected: Privileged Access Never
> [   29.365003] CPU features: detected: LSE atomic instructions
> [   29.365023] CPU features: detected: CRC32 instructions
> [   29.431660] CPU: All CPU(s) started at EL2
> [   29.431685] ------------[ cut here ]------------
> [   29.431713] virt_to_phys used for non-linear address: (____ptrval____) (__hyp_idmap_text_end+0x0/0x534)
> [   29.431744] WARNING: CPU: 0 PID: 1 at arch/arm64/mm/physaddr.c:15 __virt_to_phys+0x80/0xc0
> [   29.431759] Modules linked in:
> [   29.431787] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-rc6-next-20201207+ #2
> [   29.431804] pstate: 10400009 (nzcV daif +PAN -UAO -TCO BTYPE=--)
> [   29.431819] pc : __virt_to_phys+0x80/0xc0
> [   29.431834] lr : __virt_to_phys+0x80/0xc0
> [   29.431848] sp : ffff000005fefc90
> [   29.431862] x29: ffff000005fefc90 x28: ffff8000191c9010 
> [   29.431891] x27: ffff000005f21228 x26: b14e19fe279ae3eb 
> [   29.431920] x25: ffff8000191c9010 x24: ffff8000191c9000 
> [   29.431948] x23: ffff8000191c9000 x22: 000f800011235acc 
> [   29.431975] x21: 0000000000000001 x20: 000f800000000000 
> [   29.432003] x19: ffff800011235acc x18: ffff6001cedcc336 
> [   29.432031] x17: 0000000000001308 x16: 0000000000000002 
> [   29.432058] x15: 0000000000000000 x14: 7261656e696c2d6e 
> [   29.432086] x13: ffff600000bfdee7 x12: 1fffe00000bfdee6 
> [   29.432113] x11: 1fffe00000bfdee6 x10: ffff600000bfdee6 
> [   29.432141] x9 : ffff80001020a928 x8 : ffff000005fef737 
> [   29.432169] x7 : 0000000000000001 x6 : ffff600000bfdee7 
> [   29.432196] x5 : ffff600000bfdee7 x4 : 1fffe00000bfdedc 
> [   29.432223] x3 : 1fffe00000be4009 x2 : ffff600000bfdf5c 
> [   29.432251] x1 : 8fd448c3d76ca800 x0 : 0000000000000000 
> [   29.432279] Call trace:
> [   29.432294]  __virt_to_phys+0x80/0xc0
> [   29.432312]  kvm_compute_layout+0x21c/0x264
> init_hyp_physvirt_offset at arch/arm64/kvm/va_layout.c:47
> (inlined by) kvm_compute_layout at arch/arm64/kvm/va_layout.c:82
> [   29.432327]  smp_cpus_done+0x164/0x17c
> [   29.432342]  smp_init+0xc4/0xd8
> [   29.432358]  kernel_init_freeable+0x4ec/0x734
> [   29.432375]  kernel_init+0x18/0x12c
> [   29.432391]  ret_from_fork+0x10/0x1c
> [   29.432405] irq event stamp: 490612
> [   29.432424] hardirqs last  enabled at (490611): [<ffff800010207f60>] console_unlock+0x8e0/0xca0
> [   29.432440] hardirqs last disabled at (490612): [<ffff800011212f44>] el1_dbg+0x24/0x50
> [   29.432455] softirqs last  enabled at (487946): [<ffff800010010a98>] _stext+0xa98/0x113c
> [   29.432473] softirqs last disabled at (487939): [<ffff8000100ec5e8>] irq_exit+0x500/0x5e0
> [   29.432492] ---[ end trace 96247b4cbbdf9333 ]---
> 

Thanks for the report, I've been able to reproduce with CONFIG_DEBUG_VIRTUAL=y
and the kernel running in EL2. Doesn't pose any functional issues as the results
of this are never used. I'll post a fix later today.

David


_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  reply	other threads:[~2020-12-08 10:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 18:40 [PATCH v4 00/26] Opt-in always-on nVHE hypervisor David Brazdil
2020-12-02 18:40 ` [PATCH v4 01/26] kvm: arm64: Add kvm-arm.mode early kernel parameter David Brazdil
2020-12-02 18:40 ` [PATCH v4 02/26] kvm: arm64: Add ARM64_KVM_PROTECTED_MODE CPU capability David Brazdil
2020-12-02 18:40 ` [PATCH v4 03/26] psci: Support psci_ops.get_version for v0.1 David Brazdil
2020-12-02 18:41 ` [PATCH v4 04/26] psci: Split functions to v0.1 and v0.2+ variants David Brazdil
2020-12-03 10:42   ` Mark Rutland
2020-12-02 18:41 ` [PATCH v4 05/26] psci: Replace psci_function_id array with a struct David Brazdil
2020-12-03 10:43   ` Mark Rutland
2020-12-02 18:41 ` [PATCH v4 06/26] psci: Add accessor for psci_0_1_function_ids David Brazdil
2020-12-03 10:47   ` Mark Rutland
2020-12-03 10:51     ` David Brazdil
2020-12-02 18:41 ` [PATCH v4 07/26] arm64: Make cpu_logical_map() take unsigned int David Brazdil
2020-12-02 18:41 ` [PATCH v4 08/26] arm64: Extract parts of el2_setup into a macro David Brazdil
2020-12-02 18:41 ` [PATCH v4 09/26] kvm: arm64: Remove vector_ptr param of hyp-init David Brazdil
2020-12-02 18:41 ` [PATCH v4 10/26] kvm: arm64: Move hyp-init params to a per-CPU struct David Brazdil
2020-12-02 18:41 ` [PATCH v4 11/26] kvm: arm64: Init MAIR/TCR_EL2 from params struct David Brazdil
2020-12-02 18:41 ` [PATCH v4 12/26] kvm: arm64: Add .hyp.data..ro_after_init ELF section David Brazdil
2020-12-02 18:41 ` [PATCH v4 13/26] kvm: arm64: Support per_cpu_ptr in nVHE hyp code David Brazdil
2020-12-02 18:41 ` [PATCH v4 14/26] kvm: arm64: Create nVHE copy of cpu_logical_map David Brazdil
2020-12-02 18:41 ` [PATCH v4 15/26] kvm: arm64: Add SMC handler in nVHE EL2 David Brazdil
2020-12-03 13:31   ` Marc Zyngier
2020-12-02 18:41 ` [PATCH v4 16/26] kvm: arm64: Bootstrap PSCI " David Brazdil
2020-12-03 10:55   ` Mark Rutland
2020-12-03 13:46   ` Marc Zyngier
2020-12-02 18:41 ` [PATCH v4 17/26] kvm: arm64: Add offset for hyp VA <-> PA conversion David Brazdil
2020-12-07 22:29   ` Qian Cai
2020-12-08 10:08     ` David Brazdil [this message]
2020-12-02 18:41 ` [PATCH v4 18/26] kvm: arm64: Forward safe PSCI SMCs coming from host David Brazdil
2020-12-02 18:41 ` [PATCH v4 19/26] kvm: arm64: Extract __do_hyp_init into a helper function David Brazdil
2020-12-02 18:41 ` [PATCH v4 20/26] kvm: arm64: Add function to enter host from KVM nVHE hyp code David Brazdil
2020-12-02 18:41 ` [PATCH v4 21/26] kvm: arm64: Intercept host's CPU_ON SMCs David Brazdil
2020-12-02 18:41 ` [PATCH v4 22/26] kvm: arm64: Intercept host's CPU_SUSPEND PSCI SMCs David Brazdil
2020-12-02 18:41 ` [PATCH v4 23/26] kvm: arm64: Intercept host's SYSTEM_SUSPEND " David Brazdil
2020-12-02 18:41 ` [PATCH v4 24/26] kvm: arm64: Keep nVHE EL2 vector installed David Brazdil
2020-12-02 18:41 ` [PATCH v4 25/26] kvm: arm64: Trap host SMCs in protected mode David Brazdil
2020-12-02 18:41 ` [PATCH v4 26/26] kvm: arm64: Fix EL2 mode availability checks David Brazdil
2020-12-03 19:23 ` [PATCH v4 00/26] Opt-in always-on nVHE hypervisor Marc Zyngier
2020-12-08 19:14   ` David Brazdil
2020-12-08 20:12     ` Marc Zyngier

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=20201208100830.dhkkhzsqiy46euod@google.com \
    --to=dbrazdil@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=cl@linux.com \
    --cc=corbet@lwn.net \
    --cc=dennis@kernel.org \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=maz@kernel.org \
    --cc=qcai@redhat.com \
    --cc=sudeep.holla@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;
as well as URLs for NNTP newsgroup(s).