From: Matias Ezequiel Vara Larsen <matiasevara@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Matias Ezequiel Vara Larsen" <matias.vara@vates.fr>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
"George Dunlap" <george.dunlap@citrix.com>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Dario Faggioli" <dfaggioli@suse.com>,
xen-devel@lists.xenproject.org
Subject: Re: [RFC PATCH v2 1/2] xen/memory : Add a stats_table resource type
Date: Mon, 20 Feb 2023 17:51:44 +0100 [thread overview]
Message-ID: <20230220165144.GA2653336@horizon> (raw)
In-Reply-To: <ba0c8c8f-894a-0ec7-4339-0537952f781a@suse.com>
On Thu, Feb 16, 2023 at 04:15:29PM +0100, Jan Beulich wrote:
> On 16.02.2023 16:07, Matias Ezequiel Vara Larsen wrote:
> > On Wed, Dec 14, 2022 at 08:29:53AM +0100, Jan Beulich wrote:
> >> On 07.10.2022 14:39, Matias Ezequiel Vara Larsen wrote:
> >>> @@ -287,6 +289,20 @@ static inline void vcpu_runstate_change(
> >>> }
> >>>
> >>> v->runstate.state = new_state;
> >>> +
> >>> + vcpustats_va = (shared_vcpustatspage_t*)d->vcpustats_page.va;
> >>> + if ( vcpustats_va )
> >>> + {
> >>> + vcpustats_va->vcpu_info[v->vcpu_id].version =
> >>> + version_update_begin(vcpustats_va->vcpu_info[v->vcpu_id].version);
> >>> + smp_wmb();
> >>> + memcpy(&vcpustats_va->vcpu_info[v->vcpu_id].runstate_running_time,
> >>> + &v->runstate.time[RUNSTATE_running],
> >>> + sizeof(v->runstate.time[RUNSTATE_running]));
> >>> + smp_wmb();
> >>> + vcpustats_va->vcpu_info[v->vcpu_id].version =
> >>> + version_update_end(vcpustats_va->vcpu_info[v->vcpu_id].version);
> >>> + }
> >>
> >> A further aspect to consider here is cache line ping-pong. I think the
> >> per-vCPU elements of the array want to be big enough to not share a
> >> cache line. The interface being generic this presents some challenge
> >> in determining what the supposed size is to be. However, taking into
> >> account the extensibility question, maybe the route to take is to
> >> simply settle on a power-of-2 value somewhere between x86'es and Arm's
> >> cache line sizes and the pretty common page size of 4k, e.g. 512 bytes
> >> or 1k?
> >>
> >
> > I do not now how to address this. I was thinking to align each vcpu_stats
> > instance to a multiple of the cache-line. I would pick up the first multiple
> > that is bigger to the size of the vcpu_stats structure. For example, currently
> > the structure is 16 bytes so I would align each instance in a frame to 64
> > bytes. Would it make sense?
>
> Well, 64 may be an option, but I gave higher numbers for a reason. One thing
> I don't know is what common cache line sizes are on Arm or e.g. RISC-V.
Thanks. I found that structures that require cache-aligment are defined with
"__cacheline_aligned" that uses L1_CACHE_BYTES. For example, in x86, this
aligns to 128 bytes. What is the reason to use a higher value like 512 bytes or
1k?.
Thanks, Matias.
next prev parent reply other threads:[~2023-02-20 16:52 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 12:39 [RFC PATCH v2 0/2] Add a new acquire resource to query vcpu statistics Matias Ezequiel Vara Larsen
2022-10-07 12:39 ` [RFC PATCH v2 1/2] xen/memory : Add a stats_table resource type Matias Ezequiel Vara Larsen
2022-12-13 17:02 ` Jan Beulich
2023-02-16 14:48 ` Matias Ezequiel Vara Larsen
2023-02-16 15:10 ` Jan Beulich
2022-12-14 7:29 ` Jan Beulich
2022-12-14 7:56 ` Jan Beulich
2023-02-17 8:50 ` Matias Ezequiel Vara Larsen
2023-02-17 8:57 ` Jan Beulich
2023-02-17 9:29 ` Matias Ezequiel Vara Larsen
2023-02-17 14:10 ` Jan Beulich
2023-02-23 12:16 ` Matias Ezequiel Vara Larsen
2023-02-23 12:42 ` Jan Beulich
2023-03-07 14:44 ` Matias Ezequiel Vara Larsen
2023-03-07 16:55 ` Jan Beulich
2023-03-09 9:22 ` Matias Ezequiel Vara Larsen
2023-02-16 15:07 ` Matias Ezequiel Vara Larsen
2023-02-16 15:15 ` Jan Beulich
2023-02-20 16:51 ` Matias Ezequiel Vara Larsen [this message]
2023-02-21 8:48 ` Jan Beulich
2022-10-07 12:39 ` [RFC PATCH v2 2/2] tools/misc: Add xen-vcpus-stats tool Matias Ezequiel Vara Larsen
2023-02-23 16:01 ` Andrew Cooper
2023-02-23 20:31 ` Julien Grall
2023-03-17 11:01 ` Matias Ezequiel Vara Larsen
2023-03-29 21:29 ` Julien Grall
2023-02-24 15:31 ` Matias Ezequiel Vara Larsen
2023-02-23 19:56 ` API/ABIs: Re: [RFC PATCH v2 0/2] Add a new acquire resource to query vcpu statistics Andrew Cooper
2023-03-06 14:23 ` Matias Ezequiel Vara Larsen
2023-03-07 10:12 ` Jan Beulich
2023-03-08 11:54 ` Matias Ezequiel Vara Larsen
2023-03-08 14:16 ` Jan Beulich
2023-03-09 10:38 ` Matias Ezequiel Vara Larsen
2023-03-09 11:50 ` Jan Beulich
2023-03-10 10:58 ` Matias Ezequiel Vara Larsen
2023-03-10 11:34 ` Jan Beulich
2023-03-14 10:28 ` Matias Ezequiel Vara Larsen
2023-03-14 10:34 ` Jan Beulich
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=20230220165144.GA2653336@horizon \
--to=matiasevara@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=dfaggioli@suse.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=matias.vara@vates.fr \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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.