Kasai Takanori
2007-May-30 12:38 UTC
[Xen-devel] [PATCH] Fix expandable grant table for x86
Hi All, We contributed this problem that the grant table was not able to be expanded before. We corrected that HYPERCALL of grant_table_op was able to be called from the HVM domain with x86. It was confirmed to be able to expand grant table by this patch. It is not tested things except the acquisition of the query size. It seems that the structure of HYPERCALL is the same excluding GNTTABOP_setup_table as 32 bits and 64 bits. When it was not hvm domain, GNTTABOP_setup_table returned ENOSYS. Signed-off-by: Takanori Kasai <kasai.takanori@jp.fujitsu.com> Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com> Best Regards, -- Takanori Kasai ----- Original Message ----- From: "Kasai Takanori" <kasai.takanori@jp.fujitsu.com> To: "xen-devel" <xen-devel@lists.xensource.com> Sent: Thursday, May 24, 2007 8:50 PM Subject: [Xen-devel] expandable grant table bug?> Hi All, > > Grant table had been expanded before. > As a result, it is thought that it came to be able to use four VNIF or more. > > The PV domain operated without trouble. > However, VNIF can be only used up to three in DomVTx(x86). > > # xm network-attach 27 > # xm network-attach 27 > # xm network-attach 27 > # xm network-attach 27 > # xm network-list 27 > Idx BE MAC Addr. handle state evt-ch tx-/rx-ring-ref BE-path > 0 0 02:17:42:2f:01:11 0 4 5 1280 /1281 > /local/domain/0/backend/vif/27/0 > 1 0 02:17:42:2f:03:11 1 4 6 1282 /1283 > /local/domain/0/backend/vif/27/1 > 2 0 00:16:3e:4d:2f:0e 2 4 7 1792 /1793 > /local/domain/0/backend/vif/27/2 > 3 0 00:16:3e:11:35:e0 3 6 -1 -1 /-1 > /local/domain/0/backend/vif/27/3 > > The test environment is as follows. > - xen-unstable.hg : cs15072 > - DomVTx(X86) with PV-ON-HVM > > This problem was investigated a little. > The cause is not to be able to execute HYPERVISOR_grant_table_op from the hvm > domain. > Therefore, the number of boot_max_nr_grant_frames is four. > > ・unmodified_drivers/linux-2.6/platform-pci/platform-pci.c > platform_pci_init() > -> ・linux-2.6-xen-sparse/drivers/xen/core/gnttab.c > gnttab_init() > __max_nr_grant_frames() > > The size of the grant table is acquired here. > > 404 static unsigned int __max_nr_grant_frames(void) > 405 { > 406 struct gnttab_query_size query; > 407 int rc; > 408 > 409 query.dom = DOMID_SELF; > 410 > 411 rc = HYPERVISOR_grant_table_op(GNTTABOP_query_size, &query, 1); <<=> This > 412 if ((rc < 0) || (query.status != GNTST_okay)) > 413 return 4; /* Legacy max supported number of frames */ > 414 > 415 return query.max_nr_frames; > 416 } > > => ・xen/arch/x86/hvm/hvm.c > 736 int hvm_do_hypercall(struct cpu_user_regs *regs) > 737 { > ... > 759 if ( (eax >= NR_hypercalls) || !hvm_hypercall32_table[eax] ) > 760 { > 761 if ( eax != __HYPERVISOR_grant_table_op ) > 762 gdprintk(XENLOG_WARNING, "HVM vcpu %d:%d bad hypercall > %u.\n", > 763 current->domain->domain_id, current->vcpu_id, eax); > 764 regs->eax = -ENOSYS; > 765 return HVM_HCALL_completed; > 766 } > > hvm_hypercall32_table is as follows. > Therefore, grant_table_op cannot be called. > > 726 static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = { > 727 HYPERCALL_COMPAT32(memory_op), > 728 HYPERCALL(xen_version), > 729 HYPERCALL(event_channel_op), > 730 HYPERCALL(sched_op), > 731 HYPERCALL(hvm_op) > 732 }; > > Cannot grant_table_op make it call from the hvm domain? > > How should we correct it if so? > > Best Regard, > > -- > Takanori Kasai_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel