From: Marco Elver <elver@google.com>
To: Quentin Perret <qperret@google.com>
Cc: "jean-philippe@linaro.org" <jean-philippe@linaro.org>,
"maz@kernel.org" <maz@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linuxarm <linuxarm@huawei.com>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 3/3] kvm/arm: Align the VMID allocation with the arm64 ASID one
Date: Thu, 22 Jul 2021 21:33:52 +0200 [thread overview]
Message-ID: <YPnIIAARHNhx9npt@elver.google.com> (raw)
In-Reply-To: <YPk2XqrOeP6dEtPL@google.com>
On Thu, Jul 22, 2021 at 10:11AM +0100, Quentin Perret wrote:
> On Thursday 22 Jul 2021 at 06:45:14 (+0000), Shameerali Kolothum Thodi wrote:
> > > From: Will Deacon [mailto:will@kernel.org]
> > > > diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > index 4b60c0056c04..a02c4877a055 100644
> > > > --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > @@ -106,8 +106,7 @@ int kvm_host_prepare_stage2(void *mem_pgt_pool,
> > > void *dev_pgt_pool)
> > > > mmu->pgd_phys = __hyp_pa(host_kvm.pgt.pgd);
> > > > mmu->arch = &host_kvm.arch;
> > > > mmu->pgt = &host_kvm.pgt;
> > > > - mmu->vmid.vmid_gen = 0;
> > > > - mmu->vmid.vmid = 0;
> > > > + atomic64_set(&mmu->vmid.id, 0);
> > >
> > > I think this is the first atomic64 use in the EL2 object, which may pull in
> > > some fatal KCSAN instrumentation. Quentin, have you run into this before?
> > >
> > > Might be simple just to zero-initialise mmu for now, if it isn't already.
> >
> > I will check that.
>
> Yes I think what saves us here is that, AFAICT. arm64 doesn't support
> KCSAN yet. But the day it does, this should fail to link (hopefully)
> because of out-of-line calls into e.g. __kasan_check_write().
>
> So yes, a simple zeroing here is probably preferable.
Note: Do not worry about hypothetically breaking with sanitizers here --
whether it's KASAN or KCSAN, they both instrument atomics. In files that
enable instrumentation but the atomic instrumentation should not be
pulled in, use the arch_ variants, but this doesn't apply here because
instrumentation shouldn't even be on.
The indicator that when KCSAN is supported on arm64, the Makefile here
just needs KCSAN_SANITIZE := n, is that all other instrumentation is
also killed entirely:
$ grep -E "(PROFILE|SANITIZE|INSTRUMENT)" arch/arm64/kvm/hyp/nvhe/Makefile
GCOV_PROFILE := n
KASAN_SANITIZE := n
UBSAN_SANITIZE := n
KCOV_INSTRUMENT := n
KCSAN isn't supported on arm64 yet, and when it does, I believe Mark's
arm64 KCSAN series should take care of things like this.
Thanks,
-- Marco
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
WARNING: multiple messages have this Message-ID (diff)
From: Marco Elver <elver@google.com>
To: Quentin Perret <qperret@google.com>
Cc: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>,
Will Deacon <will@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"maz@kernel.org" <maz@kernel.org>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
"james.morse@arm.com" <james.morse@arm.com>,
"julien.thierry.kdev@gmail.com" <julien.thierry.kdev@gmail.com>,
"suzuki.poulose@arm.com" <suzuki.poulose@arm.com>,
"jean-philippe@linaro.org" <jean-philippe@linaro.org>,
"Alexandru.Elisei@arm.com" <Alexandru.Elisei@arm.com>,
Linuxarm <linuxarm@huawei.com>,
mark.rutland@arm.com
Subject: Re: [PATCH v2 3/3] kvm/arm: Align the VMID allocation with the arm64 ASID one
Date: Thu, 22 Jul 2021 21:33:52 +0200 [thread overview]
Message-ID: <YPnIIAARHNhx9npt@elver.google.com> (raw)
In-Reply-To: <YPk2XqrOeP6dEtPL@google.com>
On Thu, Jul 22, 2021 at 10:11AM +0100, Quentin Perret wrote:
> On Thursday 22 Jul 2021 at 06:45:14 (+0000), Shameerali Kolothum Thodi wrote:
> > > From: Will Deacon [mailto:will@kernel.org]
> > > > diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > index 4b60c0056c04..a02c4877a055 100644
> > > > --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > @@ -106,8 +106,7 @@ int kvm_host_prepare_stage2(void *mem_pgt_pool,
> > > void *dev_pgt_pool)
> > > > mmu->pgd_phys = __hyp_pa(host_kvm.pgt.pgd);
> > > > mmu->arch = &host_kvm.arch;
> > > > mmu->pgt = &host_kvm.pgt;
> > > > - mmu->vmid.vmid_gen = 0;
> > > > - mmu->vmid.vmid = 0;
> > > > + atomic64_set(&mmu->vmid.id, 0);
> > >
> > > I think this is the first atomic64 use in the EL2 object, which may pull in
> > > some fatal KCSAN instrumentation. Quentin, have you run into this before?
> > >
> > > Might be simple just to zero-initialise mmu for now, if it isn't already.
> >
> > I will check that.
>
> Yes I think what saves us here is that, AFAICT. arm64 doesn't support
> KCSAN yet. But the day it does, this should fail to link (hopefully)
> because of out-of-line calls into e.g. __kasan_check_write().
>
> So yes, a simple zeroing here is probably preferable.
Note: Do not worry about hypothetically breaking with sanitizers here --
whether it's KASAN or KCSAN, they both instrument atomics. In files that
enable instrumentation but the atomic instrumentation should not be
pulled in, use the arch_ variants, but this doesn't apply here because
instrumentation shouldn't even be on.
The indicator that when KCSAN is supported on arm64, the Makefile here
just needs KCSAN_SANITIZE := n, is that all other instrumentation is
also killed entirely:
$ grep -E "(PROFILE|SANITIZE|INSTRUMENT)" arch/arm64/kvm/hyp/nvhe/Makefile
GCOV_PROFILE := n
KASAN_SANITIZE := n
UBSAN_SANITIZE := n
KCOV_INSTRUMENT := n
KCSAN isn't supported on arm64 yet, and when it does, I believe Mark's
arm64 KCSAN series should take care of things like this.
Thanks,
-- Marco
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Marco Elver <elver@google.com>
To: Quentin Perret <qperret@google.com>
Cc: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>,
Will Deacon <will@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"maz@kernel.org" <maz@kernel.org>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
"james.morse@arm.com" <james.morse@arm.com>,
"julien.thierry.kdev@gmail.com" <julien.thierry.kdev@gmail.com>,
"suzuki.poulose@arm.com" <suzuki.poulose@arm.com>,
"jean-philippe@linaro.org" <jean-philippe@linaro.org>,
"Alexandru.Elisei@arm.com" <Alexandru.Elisei@arm.com>,
Linuxarm <linuxarm@huawei.com>,
mark.rutland@arm.com
Subject: Re: [PATCH v2 3/3] kvm/arm: Align the VMID allocation with the arm64 ASID one
Date: Thu, 22 Jul 2021 21:33:52 +0200 [thread overview]
Message-ID: <YPnIIAARHNhx9npt@elver.google.com> (raw)
In-Reply-To: <YPk2XqrOeP6dEtPL@google.com>
On Thu, Jul 22, 2021 at 10:11AM +0100, Quentin Perret wrote:
> On Thursday 22 Jul 2021 at 06:45:14 (+0000), Shameerali Kolothum Thodi wrote:
> > > From: Will Deacon [mailto:will@kernel.org]
> > > > diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > index 4b60c0056c04..a02c4877a055 100644
> > > > --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> > > > @@ -106,8 +106,7 @@ int kvm_host_prepare_stage2(void *mem_pgt_pool,
> > > void *dev_pgt_pool)
> > > > mmu->pgd_phys = __hyp_pa(host_kvm.pgt.pgd);
> > > > mmu->arch = &host_kvm.arch;
> > > > mmu->pgt = &host_kvm.pgt;
> > > > - mmu->vmid.vmid_gen = 0;
> > > > - mmu->vmid.vmid = 0;
> > > > + atomic64_set(&mmu->vmid.id, 0);
> > >
> > > I think this is the first atomic64 use in the EL2 object, which may pull in
> > > some fatal KCSAN instrumentation. Quentin, have you run into this before?
> > >
> > > Might be simple just to zero-initialise mmu for now, if it isn't already.
> >
> > I will check that.
>
> Yes I think what saves us here is that, AFAICT. arm64 doesn't support
> KCSAN yet. But the day it does, this should fail to link (hopefully)
> because of out-of-line calls into e.g. __kasan_check_write().
>
> So yes, a simple zeroing here is probably preferable.
Note: Do not worry about hypothetically breaking with sanitizers here --
whether it's KASAN or KCSAN, they both instrument atomics. In files that
enable instrumentation but the atomic instrumentation should not be
pulled in, use the arch_ variants, but this doesn't apply here because
instrumentation shouldn't even be on.
The indicator that when KCSAN is supported on arm64, the Makefile here
just needs KCSAN_SANITIZE := n, is that all other instrumentation is
also killed entirely:
$ grep -E "(PROFILE|SANITIZE|INSTRUMENT)" arch/arm64/kvm/hyp/nvhe/Makefile
GCOV_PROFILE := n
KASAN_SANITIZE := n
UBSAN_SANITIZE := n
KCOV_INSTRUMENT := n
KCSAN isn't supported on arm64 yet, and when it does, I believe Mark's
arm64 KCSAN series should take care of things like this.
Thanks,
-- Marco
next prev parent reply other threads:[~2021-07-23 8:08 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 15:56 [PATCH v2 0/3] kvm/arm: New VMID allocator based on asid Shameer Kolothum
2021-06-16 15:56 ` Shameer Kolothum
2021-06-16 15:56 ` Shameer Kolothum
2021-06-16 15:56 ` [PATCH v2 1/3] arch/arm64: Introduce a capability to tell whether 16-bit VMID is available Shameer Kolothum
2021-06-16 15:56 ` Shameer Kolothum
2021-06-16 15:56 ` Shameer Kolothum
2021-07-21 15:23 ` Will Deacon
2021-07-21 15:23 ` Will Deacon
2021-07-21 15:23 ` Will Deacon
2021-07-22 6:24 ` Shameerali Kolothum Thodi
2021-07-22 6:24 ` Shameerali Kolothum Thodi
2021-07-22 6:24 ` Shameerali Kolothum Thodi
2021-06-16 15:56 ` [PATCH v2 2/3] kvm/arm: Introduce a new vmid allocator for KVM Shameer Kolothum
2021-06-16 15:56 ` Shameer Kolothum
2021-06-16 15:56 ` Shameer Kolothum
2021-07-21 16:06 ` Will Deacon
2021-07-21 16:06 ` Will Deacon
2021-07-21 16:06 ` Will Deacon
2021-07-22 6:34 ` Shameerali Kolothum Thodi
2021-07-22 6:34 ` Shameerali Kolothum Thodi
2021-07-22 6:34 ` Shameerali Kolothum Thodi
2021-06-16 15:56 ` [PATCH v2 3/3] kvm/arm: Align the VMID allocation with the arm64 ASID one Shameer Kolothum
2021-06-16 15:56 ` Shameer Kolothum
2021-06-16 15:56 ` Shameer Kolothum
2021-07-21 16:31 ` Will Deacon
2021-07-21 16:31 ` Will Deacon
2021-07-21 16:31 ` Will Deacon
2021-07-22 6:45 ` Shameerali Kolothum Thodi
2021-07-22 6:45 ` Shameerali Kolothum Thodi
2021-07-22 6:45 ` Shameerali Kolothum Thodi
2021-07-22 9:11 ` Quentin Perret
2021-07-22 9:11 ` Quentin Perret
2021-07-22 9:11 ` Quentin Perret
2021-07-22 19:33 ` Marco Elver [this message]
2021-07-22 19:33 ` Marco Elver
2021-07-22 19:33 ` Marco Elver
2021-07-22 9:50 ` Will Deacon
2021-07-22 9:50 ` Will Deacon
2021-07-22 9:50 ` Will Deacon
2021-07-22 15:22 ` Vladimir Murzin
2021-07-22 15:22 ` Vladimir Murzin
2021-07-22 15:22 ` Vladimir Murzin
2021-07-22 15:38 ` Will Deacon
2021-07-22 15:38 ` Will Deacon
2021-07-22 15:38 ` Will Deacon
2021-07-23 15:49 ` Vladimir Murzin
2021-07-23 15:49 ` Vladimir Murzin
2021-07-23 15:49 ` Vladimir Murzin
2021-07-13 7:07 ` [PATCH v2 0/3] kvm/arm: New VMID allocator based on asid Shameerali Kolothum Thodi
2021-07-13 7:07 ` Shameerali Kolothum Thodi
2021-07-13 7:07 ` Shameerali Kolothum Thodi
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=YPnIIAARHNhx9npt@elver.google.com \
--to=elver@google.com \
--cc=catalin.marinas@arm.com \
--cc=jean-philippe@linaro.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=maz@kernel.org \
--cc=qperret@google.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.