qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Haibo Xu <haibo.xu@linaro.org>
To: Juan Quintela <quintela@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Andrew Jones" <drjones@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [RFC PATCH v2 3/5] Add APIs to get/set MTE tags
Date: Thu, 1 Apr 2021 21:12:55 +0800	[thread overview]
Message-ID: <CAJc+Z1EzD_5gXHMSbWBh0aEj-LC+yYT0acya8AvrQRmPcE4aFA@mail.gmail.com> (raw)
In-Reply-To: <87tuozo28v.fsf@secure.mitica>

On Thu, 25 Mar 2021 at 20:18, Juan Quintela <quintela@redhat.com> wrote:
>
> Haibo Xu <haibo.xu@linaro.org> wrote:
> > MTE spec provide instructions to retrieve the memory tags:
> > (1) LDG, at 16 bytes granularity, and available in both user
> >     and kernel space;
> > (2) LDGM, at 256 bytes granularity in maximum, and only
> >     available in kernel space
> >
> > To improve the performance, KVM has exposed the LDGM capability
> > to user space by providing a new APIs. This patch is just a
> > wrapper for the KVM APIs.
> >
> > Signed-off-by: Haibo Xu <haibo.xu@linaro.org>
> > ---
> >  target/arm/kvm64.c   | 24 ++++++++++++++++++++++++
> >  target/arm/kvm_arm.h |  2 ++
> >  2 files changed, 26 insertions(+)
> >
> > diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
> > index 73a191f8e1..3157025316 100644
> > --- a/target/arm/kvm64.c
> > +++ b/target/arm/kvm64.c
> > @@ -1606,3 +1606,27 @@ bool kvm_arm_verify_ext_dabt_pending(CPUState *cs)
> >      }
> >      return false;
> >  }
> > +
> > +int kvm_arm_mte_get_tags(uint64_t ipa, uint64_t len, uint8_t *buf)
> > +{
> > +    struct kvm_arm_copy_mte_tags args = {
> > +        .guest_ipa = ipa,
> > +        .length = len,
> > +        .addr = buf,
> > +        .flags = KVM_ARM_TAGS_FROM_GUEST,
> > +    };
> > +
> > +    return kvm_vm_ioctl(kvm_state, KVM_ARM_MTE_COPY_TAGS, &args);
>
> Just a question, how fast/slow are this calls?
>

There is no performance data for this API yet, but at least it's more
efficient than that
to only be able to access a single tag by the EL0 "LDG" instruction.
We will try to
collect some performance data for this KVM API later.

> My understanding is that we are making a kvm call for each page that we
> want to migrate, right?
>

Yes, currently I chose to append the tag values to the page data
during the migration.

> Each time that we want to send it.
>
> Later, Juan.
>
>
> > +}
> > +
> > +int kvm_arm_mte_set_tags(uint64_t ipa, uint64_t len, uint8_t *buf)
> > +{
> > +    struct kvm_arm_copy_mte_tags args = {
> > +        .guest_ipa = ipa,
> > +        .length = len,
> > +        .addr = buf,
> > +        .flags = KVM_ARM_TAGS_TO_GUEST,
> > +    };
> > +
> > +    return kvm_vm_ioctl(kvm_state, KVM_ARM_MTE_COPY_TAGS, &args);
> > +}
> > diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> > index 34f8daa377..bbb833d6c6 100644
> > --- a/target/arm/kvm_arm.h
> > +++ b/target/arm/kvm_arm.h
> > @@ -360,6 +360,8 @@ int kvm_arm_vgic_probe(void);
> >
> >  void kvm_arm_pmu_set_irq(CPUState *cs, int irq);
> >  void kvm_arm_pmu_init(CPUState *cs);
> > +int kvm_arm_mte_get_tags(uint64_t ipa, uint64_t len, uint8_t *buf);
> > +int kvm_arm_mte_set_tags(uint64_t ipa, uint64_t len, uint8_t *buf);
> >
> >  /**
> >   * kvm_arm_pvtime_init:
>


  reply	other threads:[~2021-04-01 13:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17  9:28 [RFC PATCH v2 0/5] target/arm: Add MTE support to KVM guest Haibo Xu
2021-03-17  9:28 ` [RFC PATCH v2 1/5] Update Linux headers with new MTE support Haibo Xu
2021-03-17  9:28 ` [RFC PATCH v2 2/5] Add basic MTE support to KVM guest Haibo Xu
2021-03-17  9:28 ` [RFC PATCH v2 3/5] Add APIs to get/set MTE tags Haibo Xu
2021-03-25 12:18   ` Juan Quintela
2021-04-01 13:12     ` Haibo Xu [this message]
2021-03-17  9:28 ` [RFC PATCH v2 4/5] Add migration support for KVM guest with MTE Haibo Xu
2021-03-17 20:11   ` Dr. David Alan Gilbert
2021-03-18  6:38     ` Haibo Xu
2021-03-25 19:37       ` Dr. David Alan Gilbert
2021-04-01 13:33         ` Haibo Xu
2021-03-25 15:37   ` Juan Quintela
2021-04-01 13:26     ` Haibo Xu
2021-03-17  9:28 ` [RFC PATCH v2 5/5] Enable the MTE support for KVM guest Haibo Xu
2021-03-25 12:40   ` Juan Quintela

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=CAJc+Z1EzD_5gXHMSbWBh0aEj-LC+yYT0acya8AvrQRmPcE4aFA@mail.gmail.com \
    --to=haibo.xu@linaro.org \
    --cc=dgilbert@redhat.com \
    --cc=drjones@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=richard.henderson@linaro.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).