[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/3] x86/HVM: vMSI simplification
- struct msixtbl_entry's table_len field can be unsigned int, and by moving it down a little the structure size can be reduced slightly - a disjoint xmalloc()/memset() pair can be converted to xzalloc() - a pointless local variable can be dropped Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- unstable.orig/xen/arch/x86/hvm/vmsi.c 2014-11-17 11:40:49.000000000 +0100 +++ unstable/xen/arch/x86/hvm/vmsi.c 2014-11-17 11:43:18.000000000 +0100 @@ -153,9 +153,9 @@ struct msixtbl_entry /* TODO: resolve the potential race by destruction of pdev */ struct pci_dev *pdev; unsigned long gtable; /* gpa of msix table */ - unsigned long table_len; unsigned long table_flags[BITS_TO_LONGS(MAX_MSIX_TABLE_ENTRIES)]; #define MAX_MSIX_ACC_ENTRIES 3 + unsigned int table_len; struct { uint32_t msi_ad[3]; /* Shadow of address low, high and data */ } gentries[MAX_MSIX_ACC_ENTRIES]; @@ -380,16 +380,11 @@ static void add_msixtbl_entry(struct dom uint64_t gtable, struct msixtbl_entry *entry) { - u32 len; - - memset(entry, 0, sizeof(struct msixtbl_entry)); - INIT_LIST_HEAD(&entry->list); INIT_RCU_HEAD(&entry->rcu); atomic_set(&entry->refcnt, 0); - len = pci_msix_get_table_len(pdev); - entry->table_len = len; + entry->table_len = pci_msix_get_table_len(pdev); entry->pdev = pdev; entry->gtable = (unsigned long) gtable; @@ -426,7 +421,7 @@ int msixtbl_pt_register(struct domain *d * xmalloc() with irq_disabled causes the failure of check_lock() * for xenpool->lock. So we allocate an entry beforehand. */ - new_entry = xmalloc(struct msixtbl_entry); + new_entry = xzalloc(struct msixtbl_entry); if ( !new_entry ) return -ENOMEM; Attachment:
x86-vMSI-table-len.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |