Re: [PATCH] configurator does not consider L3 CAT config when opening an exiting configuration


Chuang Ke
 

Maybe you are right, allow me to check again for the issue 2 another time.
But normally If all the function style like below , we should follow the style, put CACHE ID first
getCLOSMask(CACHE_ID, CACHE_LEVEL, vmID, vmName, VCPU, TYPE: PolicyType, maxLength: number)
This is the only one style like this (put CACHE LEVEL first), I'm not saying it's a mistake, but if bugs comes out, we have to spend a lot time to analysis just because style...
newPolicy(CACHE_LEVEL, CACHE_ID, vmConfig, VCPU, TYPE: PolicyType, maxLength): Policy

Best Regards,
Chuang Ke

-----Original Message-----
From: Mao, Junjie <junjie.mao@...>
Sent: 2022年7月29日 23:56
To: Ke, ChuangX <chuangx.ke@...>
Cc: Xie, Nanlin <nanlin.xie@...>; acrn-dev@...
Subject: Re: [acrn-dev] [PATCH] configurator does not consider L3 CAT config when opening an exiting configuration

"Ke, ChuangX" <chuangx.ke@...> writes:

When I try to fix the bug from bug report description, I find two issue cause the problem:
1. part of code in the translate function not match xml file(user
offered) anymore, I have to rewrite the function to trans xml data so
that xml data could import in correctly 2. when I fix issue 1, the
import still not working, All non-rt VMs have set way mask to 0x0ff,
because some mask function can't get data. Then I find out after
translate xml file, regionData structure have issue, regionData.level and regionData.id are in the reverse order.
I'm still confused. Why does ordering of fields in an object affects the correctness of the logic? Even that's the case, why changing the order of the initializer parameters helps here?

--
Best Regards
Junjie Mao

In fact, it means config tools can't read any xml regionData, that's why it set All non-rt VMs mask to default value 0x0ff when it can't get data.
Because level and id is in reverse order, I also believe it export error data.
Right now , I think I fixed the two problem. maybe someone need to check and test on it.

Best Regards,
Chuang Ke

-----Original Message-----
From: acrn-dev@... <acrn-dev@...>
On Behalf Of Junjie Mao
Sent: 2022年7月27日 23:46
To: Ke, ChuangX <chuangx.ke@...>
Cc: acrn-dev@...; Xie, Nanlin <nanlin.xie@...>
Subject: Re: [acrn-dev] [PATCH] configurator does not consider L3 CAT
config when opening an exiting configuration

Chuang Ke <chuangx.ke@...> writes:

Found errors when import xml file through this bug report, after fix the clos mask could import correctly, and show the clos mask bar in the view correctly, and also save clos mask data correctly.
From your description above, I do not quite get either your intention or the actual changes you have made in this patch ...


Signed-off-by: Chuang-Ke <chuangx.ke@...>
Tracked-On: #7927
---
.../packages/configurator/src/lib/acrn.ts | 86 +++++++++++--------
1 file changed, 49 insertions(+), 37 deletions(-)

diff --git
a/misc/config_tools/configurator/packages/configurator/src/lib/acrn.t
s
b/misc/config_tools/configurator/packages/configurator/src/lib/acrn.t
s
index 218f350b7..0467dd0ee 100644
---
a/misc/config_tools/configurator/packages/configurator/src/lib/acrn.t
s
+++ b/misc/config_tools/configurator/packages/configurator/src/lib/ac
+++ r
+++ n.ts
@@ -242,6 +242,8 @@ class CAT {
// get CAT schema && scenario && board basic data
this.schemaData = window.getSchemaData();
this.scenario = window.getCurrentScenarioData();
+ console.log('this.scenario...')
+ console.log(this.scenario)
this.CAT_REGION_INFO = window.getBoardData().CAT_INFO;

// check scenario data is empty @@ -392,7 +394,7 @@ class
CAT {
return preLaunchedVMCPUs;
}

- newPolicy(CACHE_LEVEL, CACHE_ID, vmConfig, VCPU, TYPE: PolicyType, maxLength): Policy {
+ newPolicy(CACHE_ID, CACHE_LEVEL, vmConfig, VCPU, TYPE:
+ PolicyType, maxLength): Policy {
Why do we need to change the order of the parameters?

let originPolicy = {
VM: vmConfig.name,
VCPU, TYPE,
@@ -418,6 +420,8 @@ class CAT {
CATData.META.vmid === vmID && CATData.VCPU === VCPU && CATData.TYPE === TYPE
) {
return CATData
+ console.log("catDB")
+ console.log(this.CATDB)
}
}
return false;
@@ -441,13 +445,14 @@ class CAT {

getCLOSMask(CACHE_ID, CACHE_LEVEL, vmID, vmName, VCPU, TYPE: PolicyType, maxLength: number) {
let CATData = this.selectCATData(CACHE_ID, CACHE_LEVEL,
vmID, vmName, VCPU, TYPE);
+ // console.log(CATData)
+ let CLOS_MASK
if (CATData !== false) {
let CLOS_MASK = CATData.CLOS_MASK;
// ensure CLOS_MASK length is shorter or equal to maxLength
CLOS_MASK = this.rangeToHex(this.hexToRange(CLOS_MASK, maxLength), maxLength);
return CLOS_MASK;
- }
- let CLOS_MASK = "0x" + parseInt('1'.repeat(maxLength), 2).toString(16)
+ } else CLOS_MASK = "0x" + parseInt('1'.repeat(maxLength),
+ 2).toString(16)
Please, write the body of the else-branch on a separate row.

this.CATDB.push({
META: {vmid: vmID},
CACHE_ID, CACHE_LEVEL,
@@ -469,10 +474,10 @@ class CAT {
pcpu.real_time_vcpu === 'y'
) {
if (!this.switches.CDP_ENABLED) {
- RTCoreData.push(this.newPolicy(regionData.level, regionData.id, vmConfig, index, 'Unified', regionData.capacity_mask_length))
+
+ RTCoreData.push(this.newPolicy(regionData.id, regionData.level,
+ vmConfig, index, 'Unified', regionData.capacity_mask_length))
} else {
- RTCoreData.push(this.newPolicy(regionData.level, regionData.id, vmConfig, index, 'Code', regionData.capacity_mask_length))
- RTCoreData.push(this.newPolicy(regionData.level, regionData.id, vmConfig, index, 'Data', regionData.capacity_mask_length))
+
+ RTCoreData.push(this.newPolicy(regionData.id, regionData.level,
+ vmConfig, index, 'Code', regionData.capacity_mask_length))
+
+ RTCoreData.push(this.newPolicy(regionData.id, regionData.level,
+ vmConfig, index, 'Data', regionData.capacity_mask_length))
}
}
}
@@ -498,10 +503,10 @@ class CAT {
(pcpu.real_time_vcpu === 'y' && vmConfig.vm_type !== 'RTVM')
) {
if (!this.switches.CDP_ENABLED) {
- StandardData.push(this.newPolicy(regionData.level, regionData.id, vmConfig, index, 'Unified', regionData.capacity_mask_length))
+
+ StandardData.push(this.newPolicy(regionData.id, regionData.level,
+ vmConfig, index, 'Unified', regionData.capacity_mask_length))
} else {
- StandardData.push(this.newPolicy(regionData.level, regionData.id, vmConfig, index, "Code", regionData.capacity_mask_length))
- StandardData.push(this.newPolicy(regionData.level, regionData.id, vmConfig, index, "Data", regionData.capacity_mask_length))
+
+ StandardData.push(this.newPolicy(regionData.id, regionData.level,
+ vmConfig, index, "Code", regionData.capacity_mask_length))
+
+ StandardData.push(this.newPolicy(regionData.id, regionData.level,
+ vmConfig, index, "Data", regionData.capacity_mask_length))
}
}
}
@@ -524,10 +529,10 @@ class CAT {
this.serviceVMCPUs.map((pcpuID, index) => {
if (regionData.processors.indexOf(pcpuID) !== -1) {
if (!this.switches.CDP_ENABLED) {
- ServiceData.push(this.newPolicy(regionData.level, regionData.id, this.serviceVM, index, "Unified", regionData.capacity_mask_length))
+ ServiceData.push(this.newPolicy(regionData.id,
+ regionData.level, this.serviceVM, index, "Unified",
+ regionData.capacity_mask_length))
} else {
- ServiceData.push(this.newPolicy(regionData.level, regionData.id, this.serviceVM, index, "Code", regionData.capacity_mask_length))
- ServiceData.push(this.newPolicy(regionData.level, regionData.id, this.serviceVM, index, "Data", regionData.capacity_mask_length))
+ ServiceData.push(this.newPolicy(regionData.id, regionData.level, this.serviceVM, index, "Code", regionData.capacity_mask_length))
+ ServiceData.push(this.newPolicy(regionData.id,
+ regionData.level, this.serviceVM, index, "Data",
+ regionData.capacity_mask_length))
}
}
})
@@ -545,7 +550,7 @@ class CAT {
vmConfig.virtual_cat_support === "y"
) {
VCATData.push(
- this.newPolicy(regionData.level, regionData.id, vmConfig, 0, "Unified", vmConfig.virtual_cat_number)
+ this.newPolicy(regionData.id,
+ regionData.level, vmConfig, 0, "Unified",
+ vmConfig.virtual_cat_number)
)
}
})
@@ -580,39 +585,46 @@ class CAT {
}


- private getCATDataFromScenario() {
+ getCATDataFromScenario() {
let hv = this.scenario.hv;
- let scenarioCATData: CATDBRecord[] = []

+ let scenarioCATData: CATDBRecord[] = []
// noinspection JSUnresolvedVariable
if (
hv !== null &&
- hv.hasOwnProperty('CACHE_REGION') &&
- hv.CACHE_REGION.hasOwnProperty('CACHE_ALLOCATION') &&
- _.isArray(hv.CACHE_REGION.CACHE_ALLOCATION)
+ hv.hasOwnProperty('CACHE_REGION')
) {
- // noinspection JSUnresolvedVariable
- hv.CACHE_REGION.CACHE_ALLOCATION.map((cache_region) => {
- if (
- cache_region.hasOwnProperty('POLICY') &&
- cache_region.POLICY.length > 0
- ) {
- cache_region.POLICY.map(policy => {
- scenarioCATData.push({
- CACHE_ID: cache_region.CACHE_ID,
- CACHE_LEVEL: cache_region.CACHE_LEVEL,
- CLOS_MASK: policy.CLOS_MASK,
- META: {vmid: this.vmIDs[policy.VM]},
- TYPE: policy.TYPE,
- VCPU: policy.VCPU,
- VM: policy.VM
+ let cacheRegion = hv.CACHE_REGION
+ // console.log('cacheRegion.CACHE_ALLOCATION')
+ // console.log(cacheRegion.CACHE_ALLOCATION)
Do not check in commented logs.

--
Best Regards
Junjie Mao


Noted

Best Regards,
Chuang Ke



+ if (cacheRegion !== null && cacheRegion.hasOwnProperty('CACHE_ALLOCATION') &&
+ _.isArray(cacheRegion.CACHE_ALLOCATION)) {
+ // noinspection JSUnresolvedVariable
+
+ cacheRegion.CACHE_ALLOCATION.map((cache_allocation) => {
+ if (
+ cache_allocation.hasOwnProperty('POLICY') &&
+ cache_allocation.POLICY.length > 0
+ ) {
+ cache_allocation.POLICY.map(policy => {
+ scenarioCATData.push({
+ CACHE_ID: cache_allocation.CACHE_ID,
+ CACHE_LEVEL: cache_allocation.CACHE_LEVEL,
+ CLOS_MASK: policy.CLOS_MASK,
+ META: {vmid: this.vmIDs[policy.VM]},
+ TYPE: policy.TYPE,
+ VCPU: policy.VCPU,
+ VM: policy.VM
+ })
})
- })
- }
+ }

- })
- }
+ })

+ }
+ }
+ console.log('scenarioCATData')
+ console.log(scenarioCATData)
return scenarioCATData
}



Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.