RE: [v6 3/8] iommu, x86: Implement irq_set_vcpu_affinity for intel_ir_chip

From: Wu, Feng
Date: Thu May 21 2015 - 21:03:19 EST




> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@xxxxxxxxxxxxx]
> Sent: Thursday, May 21, 2015 6:48 PM
> To: Wu, Feng
> Cc: joro@xxxxxxxxxx; dwmw2@xxxxxxxxxxxxx; jiang.liu@xxxxxxxxxxxxxxx;
> iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [v6 3/8] iommu, x86: Implement irq_set_vcpu_affinity for
> intel_ir_chip
>
> On Thu, 21 May 2015, Feng Wu wrote:
> > +static int intel_ir_set_vcpu_affinity(struct irq_data *data, void *vcpu_info)
> > +{
> > + struct intel_ir_data *ir_data = data->chip_data;
> > + struct irte *irte_pi = &ir_data->irte_pi_entry;
> > + struct vcpu_data *vcpu_pi_info;
> > +
> > + /* stop posting interrupts, back to remapping mode */
> > + if (!vcpu_info)
> > + modify_irte(&ir_data->irq_2_iommu, &ir_data->irte_entry);
> > + else {
>
> We add braces to both branches if one requires it.
>
> > + vcpu_pi_info = (struct vcpu_data *)vcpu_info;
> > + memcpy(irte_pi, &ir_data->irte_entry, sizeof(struct irte));
>
> This lacks a comment WHY you copy irte_entry to irte_pi_entry and WHY
> we have two seperate entries stored in ir_data.

"ir_data->irte_entry" saves the remapped format of IRTE, as you can see
from patch [4/8], it being a cached irte is still updated when setting the
affinity even when we are in posted mode. So this make it possible to switch
back to remapped mode from posted mode, we can just set "ir_data->irte_entry"
to hardware for that purpose. I will add the comments, thanks for the suggestion!

BTW, do you have any other comments/suggestions about this series?
Any comments are appreciated!

Thanks,
Feng

>
> Thanks,
>
> tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/