[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC v1 07/15] vt-d: Add API to update IRTE when VT-d PI is used



>>> On 27.03.15 at 03:13, <feng.wu@xxxxxxxxx> wrote:
>> From: Andrew Cooper [mailto:andrew.cooper3@xxxxxxxxxx]
>> Sent: Friday, March 27, 2015 3:17 AM
>> On 25/03/15 12:31, Feng Wu wrote:
>> > +
>> > +    new_ire.lo_intpost.res_1 = 0;
>> > +    new_ire.lo_intpost.res_2 = 0;
>> > +    new_ire.lo_intpost.res_3 = 0;
>> > +    new_ire.hi_intpost.res_1 = 0;
>> > +
>> > +    new_ire.lo_intpost.im = 1;
>> > +
>> > +    memcpy(p, &new_ire, sizeof(struct iremap_entry));
>> > +    iommu_flush_cache_entry(p, sizeof(struct iremap_entry));
>> 
>> Same here regarding sizeof.
>> 
>> Furthermore, is the memcpy() safe to update the live descriptor?
>> 
>> If it is, why do you not update the descriptor in place using p-> rather
>> than copying it to the stack and back?
> 
> There are some example in the current code of updating IRTE, such as
> in ioapic_rte_to_remap_entry(), I try to follow it here.

Doing things the same way as existing code does should always be
done with spending some extra thought on "is the original code
correct" and "does my use case have the same constraints as the
original one". Blindly copying code means blindly spreading mistakes.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.