2014年一码中特
首頁 > 其他 > 詳細

內存熱添加

時間:2019-06-12 02:51:39      閱讀:58      評論:0      收藏:0      [點我收藏+]

標簽:containe   bat   ali   ive   flags   lag   top   south   val   

static void pc_dimm_class_init(ObjectClass oc, void data)
{
DeviceClass dc = DEVICE_CLASS(oc);
PCDIMMDeviceClass
ddc = PC_DIMM_CLASS(oc);

dc->realize = pc_dimm_realize;
dc->unrealize = pc_dimm_unrealize;
dc->props = pc_dimm_properties;
dc->desc = "DIMM memory module";

ddc->get_memory_region = pc_dimm_get_memory_region;
ddc->get_vmstate_memory_region = pc_dimm_get_vmstate_memory_region;

}

static void piix4_pm_class_init(ObjectClass klass, void data)
{
DeviceClass dc = DEVICE_CLASS(klass);
PCIDeviceClass
k = PCI_DEVICE_CLASS(klass);
HotplugHandlerClass hc = HOTPLUG_HANDLER_CLASS(klass);
AcpiDeviceIfClass
adevc = ACPI_DEVICE_IF_CLASS(klass);

k->realize = piix4_pm_realize;
k->config_write = pm_write_config;
k->vendor_id = PCI_VENDOR_ID_INTEL;
k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3;
k->revision = 0x03;
k->class_id = PCI_CLASS_BRIDGE_OTHER;
dc->desc = "PM";
dc->vmsd = &vmstate_acpi;
dc->props = piix4_pm_properties;
/*
 * Reason: part of PIIX4 southbridge, needs to be wired up,
 * e.g. by mips_malta_init()
 */
dc->user_creatable = false;
dc->hotpluggable = false;
hc->plug = piix4_device_plug_cb;
hc->unplug_request = piix4_device_unplug_request_cb;
hc->unplug = piix4_device_unplug_cb;
adevc->ospm_status = piix4_ospm_status;
adevc->send_event = piix4_send_gpe;
adevc->madt_cpu = pc_madt_cpu_entry;

}

pc_init1
{
設置中斷回調函數
if (kvm_ioapic_in_kernel()) {
kvm_pc_setup_irq_routing(pcmc->pci_enabled);
pcms->gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
GSI_NUM_PINS);
} else {
pcms->gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
}

     初始化中斷
     if (kvm_pic_in_kernel()) {
    i8259 = kvm_i8259_init(isa_bus);
} else if (xen_enabled()) {
    i8259 = xen_interrupt_controller_init();
} else {
    i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
}

}

qemu_irq kvm_i8259_init(ISABus bus)
{
i8259_init_chip(TYPE_KVM_I8259, bus, true); 初始化主中斷
i8259_init_chip(TYPE_KVM_I8259, bus, false); 初始化從中斷

return qemu_allocate_irqs(kvm_pic_set_irq, NULL, ISA_NUM_IRQS);

}

#2 0x00007f117a950f34 in qemuMonitorSend (mon=0x7f1160035880, msg=0x7f117605b6f0) at ../../../src/qemu/qemu_monitor.c:1087
#3 0x00007f117a96749e in qemuMonitorJSONCommandWithFd (mon=0x7f1160035880, cmd=0x7f113c01ac40, scm_fd=-1, reply=0x7f117605b798) at ../../../src/qemu/qemu_monitor_json.c:303
#4 0x00007f117a9675d7 in qemuMonitorJSONCommand (mon=0x7f1160035880, cmd=0x7f113c01ac40, reply=0x7f117605b798) at ../../../src/qemu/qemu_monitor_json.c:333
#5 0x00007f117a9709c5 in qemuMonitorJSONAddDeviceArgs (mon=0x7f1160035880, args=0x0) at ../../../src/qemu/qemu_monitor_json.c:3808
#6 0x00007f117a970a78 in qemuMonitorJSONAddDevice (mon=0x7f1160035880, devicestr=0x7f113c001af0 "pc-dimm,node=0,memdev=ram0,id=dimm0,slot=0") at ../../../src/qemu/qemu_monitor_json.c:3832
#7 0x00007f117a9597cc in qemuMonitorAddDeviceWithFd (mon=0x7f1160035880, devicestr=0x7f113c001af0 "pc-dimm,node=0,memdev=ram0,id=dimm0,slot=0", fd=-1, fdname=0x0) at ../../../src/qemu/qemu_monitor.c:3195
#8 0x00007f117a959877 in qemuMonitorAddDevice (mon=0x7f1160035880, devicestr=0x7f113c001af0 "pc-dimm,node=0,memdev=ram0,id=dimm0,slot=0") at ../../../src/qemu/qemu_monitor.c:3212
#9 0x00007f117a9163b5 in qemuDomainAttachMemory (driver=0x7f1170002b10, vm=0x7f11700dd610, mem=0x7f113c002370) at ../../../src/qemu/qemu_hotplug.c:2210
#10 0x00007f117a98f8a0 in qemuDomainAttachDeviceLive (vm=0x7f11700dd610, dev=0x7f113c000a90, conn=0x7f116c0164d0, driver=0x7f1170002b10) at ../../../src/qemu/qemu_driver.c:7734
#11 0x00007f117a992994 in qemuDomainAttachDeviceLiveAndConfig (conn=0x7f116c0164d0, vm=0x7f11700dd610, driver=0x7f1170002b10,
xml=0x7f113c001590 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><memory model=\"dimm\"><target><size unit=\"KiB\">2097152</size><node>0</node></target></memory>", flags=3)
at ../../../src/qemu/qemu_driver.c:8796
#12 0x00007f117a992cc1 in qemuDomainAttachDeviceFlags (dom=0x7f113c001360,
xml=0x7f113c001590 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><memory model=\"dimm\"><target><size unit=\"KiB\">2097152</size><node>0</node></target></memory>", flags=3)
at ../../../src/qemu/qemu_driver.c:8880
#13 0x00007f118a0cdd80 in virDomainAttachDeviceFlags (domain=0x7f113c001360,
xml=0x7f113c001590 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><memory model=\"dimm\"><target><size unit=\"KiB\">2097152</size><node>0</node></target></memory>", flags=3)
at ../../../src/libvirt-domain.c:8156

pc_dimm_plug--> piix4_device_plug_cb -->acpi_memory_plug_cb -->acpi_send_event-->piix4_send_gpe -->acpi_send_gpe_event -->acpi_update_sci -->qemu_set_irq
-->kvm_pc_gsi_handler -->qemu_set_irq -->kvm_pic_set_irq -->kvm_set_irq

#0 pc_dimm_memory_plug ([email protected]=0x5564b9dcaf60, [email protected]=0x5564b8f03af0, mr=0x5564b9d57ce0, align=2097152, [email protected]=0x7ffcd7286750)
at /vms/disk2/v-e0522/v-e0522/daemon/qemu/qemu-2.12/hw/mem/pc-dimm.c:40
#1 0x00005564b75a17db in pc_dimm_plug (errp=0x7ffcd72867b0, dev=0x5564b9dcaf60, hotplug_dev=<optimized out>) qemu-2.12/hw/i386/pc.c:1714
#2 pc_machine_device_plug_cb (hotplug_dev=<optimized out>, dev=0x5564b9dcaf60, errp=0x7ffcd72867b0) qemu-2.12/hw/i386/pc.c:2024
#3 0x00005564b76a5f6e in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7ffcd72868d8) qemu-2.12/hw/core/qdev.c:862
#4 0x00005564b7809227 in property_set_bool (obj=0x5564b9dcaf60, v=<optimized out>, name=<optimized out>, opaque=0x5564ba43ee50, errp=0x7ffcd72868d8) v-e0522/daemon/qemu/qemu-2.12/qom/object.c:1923
#5 0x00005564b780d46f in object_property_set_qobject ([email protected]=0x5564b9dcaf60, [email protected]=0x5564b9ab1570, [email protected]=0x5564b79ca95f "realized", [email protected]=0x7ffcd72868d8)
at /vms/disk2/v-e0522/v-e0522/daemon/qemu/qemu-2.12/qom/qom-qobject.c:27
#6 0x00005564b780b090 in object_property_set_bool (obj=0x5564b9dcaf60, value=<optimized out>, name=0x5564b79ca95f "realized", errp=0x7ffcd72868d8) at /vms/disk2/v-e0522/v-e0522/daemon/qemu/qemu-2.12/qom/object.c:1188
#7 0x00005564b762b68a in qdev_device_add ([email protected]=0x5564b9dcbc80, [email protected]=0x7ffcd72869b0) qemu-2.12/qdev-monitor.c:627
#8 0x00005564b762bcb3 in qmp_device_add (qdict=<optimized out>, ret_data=<optimized out>, errp=0x7ffcd72869e8) qemu-2.12/qdev-monitor.c:807

pc_dimm_plug-->pc_dimm_memory_plug -->memory_region_add_subregion -->memory_region_add_subregion_common -->memory_region_update_container_subregions
--> memory_region_transaction_commit | -->flatviews_reset -->generate_memory_topology -->render_memory_region
| -->address_space_set_flatview -->address_space_update_topology_pass -->kvm_region_add -->kvm_set_phys_mem
將MemoryRegion映射到線性地址空間FlatView,得到若干個 MemoryRegionSection ,調用 kvm_region_add ,將 MemoryRegionSection 注冊到 KVM 中

memory_region_add_subregion_common 加入subregions鏈表

memory_region_transaction_begin
--> qemu_flush_coalesced_mmio_buffer | --> kvm_flush_coalesced_mmio_buffer
| --> ++memory_region_transaction_depth
KVM 中對某些 MMIO 做了 batch 優化:KVM 遇到 MMIO 而 VMEXIT 時,將 MMIO 操作記錄到 kvm_coalesced_mmio 結構中,然后塞到 kvm_coalesced_mmio_ring 中,不退出到 QEMU 。直到某一次退回到 QEMU ,要更新內存空間之前的那一刻,把 kvm_coalesced_mmio_ring 中的 kvm_coalesced_mmio 取出來做一遍,保證內存的一致性。這事就是 kvm_flush_coalesced_mmio_buffer 干的。

qemu_allocate_irq 分配中斷號
pic_stat_update_irq 統計中斷號的次數

mr = ddc->get_memory_region = pc_dimm_get_memory_region
hhc->plug = piix4_device_plug_cb
adevc->send_event = piix4_send_gpe

內存熱添加

標簽:containe   bat   ali   ive   flags   lag   top   south   val   

原文:https://blog.51cto.com/zybcloud/2407551

(0)
(0)
   
舉報
評論 一句話評論(0
登錄后才能評論!
? 2014 bubuko.com 版權所有 魯ICP備09046678號-4
打開技術之扣,分享程序人生!
             

魯公網安備 37021202000002號

2014年一码中特 国彩微信群 甘肃11选5遗漏top10 河南十一选五开奖走势 腾讯棋牌手游 六开彩开奖现场直播 红兰分布图 福建十一选五在线计划 欧乐棋牌赌博 2017145期七星彩规律 腾讯桌球辛运28