Categories: Uncategorized

Oracle VM 3.4.2 CPU pinning & licensing

One of the reasons why we started using Oracle VM was due to Oracle’s licensing policy with their products running on top of Oracle VM.

If you “pin” (or hard partition) the virtual machine to specific cores you don’t need to license whole server pool which the virtual machine runs on. Drawback is when you have commodity hardware with Oracle VM the only way to do CPU pinning is from the command line!

In case you have hyper threading enabled on your Oracle Virtual Server and have x86 Intel processors the licensing is quite straight forward:

VM has 8 vCPUs allocated which means you will need 2 core licenses for your Oracle product if hard partitioning/cpu pinning is used. This is due to Intel-based processor factor 0.5 and 8 vCPUs using total of 8 threads from 4 cores. 4c x 0.5 = 2. 🙂
However you will need to be careful that you have the hard partitioning in place so you don’t need to license whole server pool. Also with hard partitioning in use you will not be able to use live migrate for your VM.

The actual CPU pinning with 3.4.2

I want to check what my OVS has in terms of vCPU’s I can allocate to one VM:

[root@OVS1 ~]# xm info

host : OVS1.local
release : 4.1.12-61.1.9.el6uek.x86_64
version : #2 SMP Tue Sep 13 22:53:36 PDT 2016
machine : x86_64
nr_cpus : 32
nr_nodes : 2
cores_per_socket : 8
threads_per_core : 2
cpu_mhz : 2700

In this server I have 2 CPU sockets with 8 cores each and 2 threads per core. This adds to total of 32 CPUs.

Next I want to check which VM’s are using which CPUs. As seen part of CPUs are allocated to dom0 already:

[root@OVS1 ~]# xm vcpu-list
Name        ID VCPU CPU State Time(s) CPU Affinity
Domain-0 0 0 0 -b- 36760.2 0
Domain-0 0 1 1 -b- 26625.9 1
Domain-0 0 2 2 -b- 46877.3 2
Domain-0 0 3 3 -b- 20995.3 3
Domain-0 0 4 4 -b- 38292.6 4
Domain-0 0 5 5 -b- 21067.0 5
Domain-0 0 6 6 -b- 89754.7 6
Domain-0 0 7 7 -b- 75418.8 7
Domain-0 0 8 8 -b- 47228.8 8
Domain-0 0 9 9 -b- 29581.8 9
Domain-0 0 10 10 -b- 35139.4 10
Domain-0 0 11 11 -b- 20257.9 11
Domain-0 0 12 12 -b- 27636.9 12
Domain-0 0 13 13 -b- 17393.8 13
Domain-0 0 14 14 -b- 27594.6 14
Domain-0 0 15 15 -b- 16195.1 15
Domain-0 0 16 16 -b- 97024.1 16
Domain-0 0 17 17 -b- 72472.6 17
Domain-0 0 18 18 -b- 86671.8 18
Domain-0 0 19 19 r-- 125745.7 19
0004fb0000060000c04cfa6f302883fa 23 0 21 -b- 4074.3 16-31
0004fb0000060000c04cfa6f302883fa 23 1 31 -b- 2706.9 16-31
0004fb0000060000c04cfa6f302883fa 23 2 23 -b- 1013.0 16-31
0004fb0000060000c04cfa6f302883fa 23 3 22 -b- 4148.8 16-31

I’m interested in VM 0004fb0000060000c04cfa6f302883fa named test_vm_1 which uses CPUs (threads) 21,22,23 & 31 currently. I have downloaded OVM tools which are found in patch 13602094 so I can use ovm vmtools to check current status:

[root@OVM1]# ./ovm_vmcontrol -u admin -p password -h OVM1 -v test_vm_1 -c getvcpu
Oracle VM VM Control utility 2.1.
Connecting to OVM Manager using Web Service.
Connected.
OVM Manager version: 3.4.2.1384
Command : getvcpu
Getting pinned CPU list...
No CPU pinned for VM 'test_vm_1'

At the moment CPUs are not pinned. In Oracle VM release 3 you can use OVM tools to do the actual pinning:

[root@OVM1]# ./ovm_vmcontrol -u admin -p password -h fOVM1 -v test_vm_1 -c setvcpu -s 21-24
Oracle VM VM Control utility 2.1.
Connecting to OVM Manager using Web Service.
Connected.
OVM Manager version: 3.4.2.1384
Command : setvcpu
Pinning vCPU '21-24' to VM 'test_vm_1'
Pin vCPU succeed.
[root@OVM1]# ./ovm_vmcontrol -u admin -p password -h OVM1 -v test_vm_1 -c getvcpu
Oracle VM VM Control utility 2.1.
Connecting to OVM Manager using Web Service.
Connected.
OVM Manager version: 3.4.2.1384
Command : getvcpu
Getting pinned CPU list...
Current pinned CPU:21-24

But now after rebooting the VM with OVM 3.4.2 the CPUs are not getting pinned. This can be seen running the vcpu-list command:

[root@OVS1]# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
0004fb0000060000c04cfa6f302883fa 23 0 23 -b- 8.7 16-31
0004fb0000060000c04cfa6f302883fa 23 1 28 -b- 2.0 16-31
0004fb0000060000c04cfa6f302883fa 23 2 31 -b- 1.9 16-31
0004fb0000060000c04cfa6f302883fa 23 3 21 -b- 1.6 16-31

In OVM 3.4.X I still need to login to actual physical OVS and run xm vcpu-pin which wasn’t required earlier with 3.3.X. After that the CPUs are pinned and CPU affinity shows up correctly:

[root@OVS1]# xm vcpu-pin 23 all 21-24
[root@OVS1]# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
0004fb0000060000c04cfa6f302883fa 23 0 24 -b- 9.4 21-24
0004fb0000060000c04cfa6f302883fa 23 1 21 -b- 2.1 21-24
0004fb0000060000c04cfa6f302883fa 23 2 23 -b- 2.3 21-24
0004fb0000060000c04cfa6f302883fa 23 3 22 -b- 1.7 21-24

That’s it! You can also review your VM’s vm.cfg and you should see the CPU pinning in place there as well.

If you would use Oracle’s Private Cloud Appliance which is sort of pre-build Oracle VM you would have “trusted partitions” in use. Then you wouldn’t need to do this manually but all what would be required is OEM connection which Oracle can use (scary huh?) and you would be set. If there would be possibility I would definitely be looking to migrate from “standard” Oracle VM to PCA. However PCA’s Oracle VM version is bit behind of current 3.4.2..

Couple Oracle’s documents also on hard partitioning which are useful and have above in more detail:

PDF Document

PDF Document

Set CPU Pinning for VMs on Oracle VM 3.4.x (Doc ID 2213691.1)

Simo

View Comments

  • Will HA feature be restricted after CPU pinning? For example, CPU 0 -7 are pinned by test-vm1 in OVM server 1 which encounter hardware failure. Could test-vm1 be able to failover to server 2 which CPU0-7 are being occupied?

  • Question:
    I have 2 CPU database licence and VM server:
    nr_nodes : 4
    cores_per_socket : 4
    threads_per_core : 2
    --------------------------------
    CPU core socket node
    CPU0 0 0 0
    CPU1 0 0 0
    CPU2 3 0 0
    CPU3 3 0 0
    CPU4 8 0 0
    CPU5 8 0 0
    CPU6 11 0 0
    CPU7 11 0 0
    CPU8 0 1 1
    CPU9 0 1 1
    CPU10 3 1 1
    CPU11 3 1 1
    CPU12 8 1 1
    CPU13 8 1 1
    CPU14 11 1 1
    CPU15 11 1 1
    CPU16 0 2 2
    CPU17 0 2 2
    CPU18 3 2 2
    CPU19 3 2 2
    CPU20 8 2 2
    CPU21 8 2 2
    CPU22 11 2 2
    CPU23 11 2 2
    CPU24 0 3 3
    CPU25 0 3 3
    CPU26 3 3 3
    CPU27 3 3 3
    CPU28 8 3 3
    CPU29 8 3 3
    CPU30 11 3 3
    CPU31 11 3 3
    ----------------------------
    Name ID VCPU CPU State Time(s) CPU Affinity
    0005fb0000050000c00a3da67855a32b 15 0 1 r-- 9.8 1-2,8-9
    0005fb0000050000c00a3da67855a32b 15 1 9 r-- 9.7 1-2,8-9
    0005fb0000050000c00a3da67855a32b 15 2 2 r-- 9.4 1-2,8-9
    0005fb0000050000c00a3da67855a32b 15 3 9 -b- 9.8 1-2,8-9
    0005fb0000050000c00a3da67855a32b 15 4 - --p 50.3 1-2,8-9
    0005fb0000050000c00a3da67855a32b 15 5 - --p 50.2 1-2,8-9
    0005fb0000050000c00a3da67855a32b 15 6 - --p 50.2 1-2,8-9
    0005fb0000050000c00a3da67855a32b 15 7 - --p 50.3 1-2,8-9
    0005b4353454445678ah5d473643db21 10 0 5 r-- 200.9 3-5
    0005b4353454445678ah5d473643db21 10 2 3 r-- 200.7 3-5
    0005b4353454445678ah5d473643db21 10 3 - --p 200.1 3-5
    0005b4353454445678ah5d473643db21 10 1 4 -b- 200.7 3-5
    0005b4353454445678ah5d473643db21 10 4 - --p 200.2 3-5
    0005b4353454445678ah5d473643db21 10 5 - --p 200.2 3-5
    Domain-0 0 0 0 -b- 200.4 0
    Domain-0 0 1 1 -b- 200.0 1
    Domain-0 0 2 2 -b- 200.6 2
    Domain-0 0 3 3 -b- 200.2 3
    Domain-0 0 4 4 -b- 200.0 4
    Domain-0 0 5 5 --- 200.5 5
    Domain-0 0 6 6 -b- 200.7 6
    Domain-0 0 7 7 -b- 200.8 7
    Domain-0 0 8 8 -b- 200.3 8
    Domain-0 0 9 9 -b- 200.2 9
    Domain-0 0 10 10 r-- 200.5 10
    Domain-0 0 11 11 -b- 200.4 11
    Domain-0 0 12 12 -b- 200.5 12
    Domain-0 0 13 13 -b- 200.6 13
    Domain-0 0 14 14 -b- 200.6 14
    Domain-0 0 15 15 -b- 200.3 15
    Domain-0 0 16 16 r-- 200.8 16
    Domain-0 0 17 17 -b- 200.4 17
    Domain-0 0 18 18 -b- 200.4 18
    Domain-0 0 19 19 r-- 200.6 19
    0004fb0000060000d684503452353224 7 0 12 -b- 300.8 12
    ---------------------------------------------
    Is it correct way to pin two cpus like a this:
    ./ovm_vmcontrol -u admin -p somepassword -h $(hostname) -v vm_machine_name -c setvcpu -s 20-23,28-31

    and what is corrent number of cpus to give to this "vm_machine_name" through VM Manager GUI, max-min=2 cpus, or max-min=8 cpus as it should represent vCPUs (vCPUs~threads)?

  • Hi, Nice Blogs.
    Here 's my question. If I Do Not Pin (Hard Partition) cpus to a vm_guest and my bare metal server has 8 cores. Does it mean I have to license Oracle EE for 8 cores? Btw this is the only vmguest on the server pool

    • Yeah correct, then you license all the cores regardless how many vcpus you have assigned for the VM. Then again if you license them all you can run as many EE VM's in that one physical server as you want.

  • Hi,
    How tu upgrade OVS servers with pinned guest on it with no downtime. So when i Live migrate mine pinned guest to another host it is pinned there to the same CPU-s.
    Can I LM my guest and after OVS upgrade is done move them back? If not how to do it?

    Thanks
    Z

  • Hi,

    I am trying to figure out how to determine the minimal number of licenses of the Oracle Internet Application Server Enterprise Edition (IASEE) linked to my EBS server.

    From what I understood so far, to determine the minimum number of IASEE licences I have to use the following formula:

    npl * coeffcpu * nblminias

    where:

    npl is the number of "Processor" licenses calculated from the EBS server characteristics.

    coeffcpu is the multiplying coefficient that depends on the CPU type (e.g.: 0.5 for Intel CPU)

    nblminias is the minimum number of licenses imposed the Oracle product IAS.

    What I struggle with is how to determine npl for my EBS server!

    The EBS server is a VM in a Oracle VM environment and this VM relies on an hypervisor that has a total of 24 vCPU.

    The Hard Partitioning and CPU pinning are activated.

    Is the following true?

    If I allocate/pin 4 out of the 24 vCPUs to my EBS VM then npl is 4?

    Cheers.

  • Hi,
    Thank You for Your great article.

    I'am curious: is it possible to bind certain vCPU in users' virtual machine with certain CPU core/thread ( 1 to 1, like OVM doing it only towards "system VM " Domain-0 ) ?
    How to do it ,if it is possible ?

    Regards

Recent Posts

Connecting to Autonomous Database Running on Google Cloud

Last time I showed how to provision Autonomous Database Serverless (ADB-S) on Google Cloud. This…

1 month ago

Can you believe it? Provisioning Autonomous Database in GCP!

I bet few years back folks didn't expect that by 2024 we would be able…

1 month ago

IP Address Insights with CLI

My previous post on IP Address Insights I mentioned it wasn't yet available with CLI…

6 months ago

Thoughts on Oracle Database@Azure

This will NOT be a technical walkthrough on Oracle Database@Azure but rather my opinions and…

6 months ago

OCI Vulnerability Scanning Setup

Many times when you work for someone, they already have their own vulnerability scanning throughout…

6 months ago

OCI IP Address Insights

Recently OCI announced small but VERY useful service, IP Address Insights. Why this matters? I've…

6 months ago