>>> On 27.03.15 at 03:13, <feng...@intel.com> wrote:
>> From: Andrew Cooper [mailto:andrew.coop...@citrix.com]
>> 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@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to