All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Hendrik Wuethrich <whendrik@google.com>
Cc: <qemu-devel@nongnu.org>, <eduardo@habkost.net>,
	<richard.henderson@linaro.org>, <marcel.apfelbaum@gmail.com>,
	<mst@redhat.com>, <pbonzini@redhat.com>, <peternewman@google.com>
Subject: Re: [PATCH v1 2/9] Add state for RDT device.
Date: Fri, 26 Jul 2024 11:33:40 +0100	[thread overview]
Message-ID: <20240726113340.00005d4d@Huawei.com> (raw)
In-Reply-To: <20240719162929.1197154-3-whendrik@google.com>

On Fri, 19 Jul 2024 16:29:22 +0000
Hendrik Wuethrich <whendrik@google.com> wrote:

> From: ‪Hendrik Wüthrich <whendrik@google.com>
> 
> Add structures and variables needed to emulate Intel RDT, including
> module-internal sturctures and state in ArchCPU. No functionality yet.
> 
> Signed-off-by: Hendrik Wüthrich <whendrik@google.com>
A few general comments inline.

J
> ---
>  hw/i386/rdt.c     | 33 +++++++++++++++++++++++++++++++++
>  target/i386/cpu.h |  5 +++++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/hw/i386/rdt.c b/hw/i386/rdt.c
> index 0a5e95606b..cf246ab835 100644
> --- a/hw/i386/rdt.c
> +++ b/hw/i386/rdt.c
> @@ -7,12 +7,44 @@
>  #include "target/i386/cpu.h"
>  #include "hw/isa/isa.h"
>  
> +/* Max counts for allocation masks or CBMs. In other words, the size of respective MSRs*/
> +#define MAX_L3_MASK_COUNT      128

If these are an architectural limitation rather than a qemu one good
to have a reference. If it's an RDT requirement namespace them with
RDT_*

> +#define MAX_L2_MASK_COUNT      48
> +#define MAX_MBA_THRTL_COUNT    31
> +
>  #define TYPE_RDT "rdt"
> +#define RDT_NUM_RMID_PROP "rmids"
>  
>  OBJECT_DECLARE_TYPE(RDTState, RDTStateClass, RDT);
>  
> +struct RDTMonitor {
> +    uint64_t count_local;
> +    uint64_t count_remote;
> +    uint64_t count_l3;
> +};
> +
> +struct RDTAllocation {
> +    uint32_t active_cos;
> +};
> +
> +struct RDTStateInstance {

I'd add some docs for this and RDTState to make it obvious
what the scope of each is.  What do they represent and how
is it different?
This seems like it might be the per core part.  If so can
you name it to make that obvious?  RDTPerCoreState or
something like that?

> +    uint32_t active_rmid;
> +    GArray *monitors;
> +
> +    RDTState *rdtstate;
> +};
> +
>  struct RDTState {
>      ISADevice parent;
> +
> +    uint32_t rmids;
> +
> +    GArray *rdtInstances;

Whilst naming makes it likely I'd add a comment to say this
an array of RDTStateInstance with (I think) one per core?

> +    GArray *allocations;
> +
> +    uint32_t msr_L3_ia32_mask_n[MAX_L3_MASK_COUNT];
> +    uint32_t msr_L2_ia32_mask_n[MAX_L2_MASK_COUNT];
> +    uint32_t ia32_L2_qos_ext_bw_thrtl_n[MAX_MBA_THRTL_COUNT];
>  };
>  
>  struct RDTStateClass { };
> @@ -20,6 +52,7 @@ struct RDTStateClass { };
>  OBJECT_DEFINE_TYPE(RDTState, rdt, RDT, ISA_DEVICE);
>  
>  static Property rdt_properties[] = {
> +    DEFINE_PROP_UINT32(RDT_NUM_RMID_PROP, RDTState, rmids, 256),
>      DEFINE_PROP_END_OF_LIST(),
>  };
>  
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index 1e121acef5..bd0bbb75f2 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -1987,6 +1987,8 @@ typedef struct CPUArchState {
>  
>  struct kvm_msrs;
>  
> +struct RDTState;

Not used?

> +struct rdtStateInstance;
>  /**
>   * X86CPU:
>   * @env: #CPUX86State
> @@ -2143,6 +2145,9 @@ struct ArchCPU {
>      struct MemoryRegion *cpu_as_root, *cpu_as_mem, *smram;
>      Notifier machine_done;
>  
> +    /* Help the RDT MSRs find the RDT device */
> +    struct RDTStateInstance *rdt;
> +
>      struct kvm_msrs *kvm_msr_buf;
>  
>      int32_t node_id; /* NUMA node this CPU belongs to */



  reply	other threads:[~2024-07-26 10:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19 16:29 [PATCH v1 0/9] target:386/ Emulate Intel RDT features needed to mount ResCtrl in Linux Hendrik Wuethrich
2024-07-19 16:29 ` [PATCH v1 1/9] Add Intel RDT device to config Hendrik Wuethrich
2024-07-26 10:24   ` Jonathan Cameron via
2024-09-04 14:14     ` Hendrik Wüthrich
2024-07-19 16:29 ` [PATCH v1 2/9] Add state for RDT device Hendrik Wuethrich
2024-07-26 10:33   ` Jonathan Cameron via [this message]
2024-07-19 16:29 ` [PATCH v1 3/9] Add init and realize funciontality " Hendrik Wuethrich
2024-07-26 10:41   ` Jonathan Cameron via
2024-07-26 10:42   ` Jonathan Cameron via
2024-07-19 16:29 ` [PATCH v1 4/9] Add RDT functionality Hendrik Wuethrich
2024-07-26 10:51   ` Jonathan Cameron via
2024-07-19 16:29 ` [PATCH v1 5/9] Add RDT device interface through MSRs Hendrik Wuethrich
2024-07-26 10:57   ` Jonathan Cameron via
2024-07-19 16:29 ` [PATCH v1 6/9] Add CPUID enumeration for RDT Hendrik Wuethrich
2024-07-26 12:09   ` Jonathan Cameron via
2024-07-19 16:29 ` [PATCH v1 7/9] Add RDT feature flags Hendrik Wuethrich
2024-07-19 16:29 ` [PATCH v1 8/9] Adjust CPUID level for RDT features Hendrik Wuethrich
2024-07-19 16:29 ` [PATCH v1 9/9] Adjust level for RDT on full_cpuid_auto_level Hendrik Wuethrich

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=20240726113340.00005d4d@Huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peternewman@google.com \
    --cc=richard.henderson@linaro.org \
    --cc=whendrik@google.com \
    /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.