[libvirt] [PATCH RFC 2/2] Resctrl: Add uitls functions to operate sysfs resctrl

Eli Qiao qiaoliyong at gmail.com
Thu Jun 22 09:32:12 UTC 2017

On Wednesday, 21 June 2017 at 10:44 PM, Martin Kletzander wrote:

> n 21, 2017 at 02:07:15PM +0800, Eli Qiao wrote:
> You don't need to pass the whole structure of all the data. Can't the
> qemu function just do something like:
> virResctrlLock()
> foreach cachetune:
> region = virResctrlGetFreeRegion(size, type)
> foreach cachetune.vcpu:
> virResctrlSetRegion(vcpu.pid, region)
> Or like with some other tuning, you can have a function that determines
> the region when given vcpu and just call it for all vcpus. You can
> save the regions in the status XML, so that not only users can see it,
> but you can also reference them from that aforementioned function. Or
> you could have saved pairs of id: region, but I think that's not needed.
> That reminds me, unless referred to from somewhere, the cachetune
> doesn't even need the id.
> But basically, you don't need to pass the whole cachetune or any other
> structure. The code is very messy, check your pointers and don't
> compare references to NULLs. Read the diffs after yourself. I know it
> works for you, but the code needs to be readable as well.

Forgive me to spam it again.  

I agree that not to pass whole cachetune , but it seems I need to define new
struct or passing more paramter while setting a cachetune.

1. It’s not just so simple we only get the Region, and setRegion.

We need to consume the llc cache from the “default” group on the host and
then write back it to /sys/fs/resctrl/ and it’s better that we need to compute all
the mask at same time because for multiple socket host, if user don’t specify
cache allocation on all sockets, we need to complete the mask by the min bits.

So I don’t think its a good solution to setcachetune in a look.

Better to pass all domain cache tune to virrresctrl and let it calculate it at a time
then write it back to /sys/fs/resctrl

2. for region = virResctrlGetFreeRegion(size, type)
if host has multiple sockets, we can not decide which region only be size, type.
Which is to say, we need the cache_id.

3. while doing cache allocation, we need to pass cache control information:

min, granularity, maxAlloc. beyond that , we need cache_id (we can find by vcups list)
type, size..

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170622/d928b5c1/attachment-0001.htm>

More information about the libvir-list mailing list