From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Gleixner Subject: RE: [v7 4/8] iommu, x86: No need to migrating irq for VT-d Posted-Interrupts Date: Tue, 26 May 2015 12:00:26 +0200 (CEST) Message-ID: References: <1432531734-25978-1-git-send-email-feng.wu@intel.com> <1432531734-25978-5-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Wu, Feng" Cc: "dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org" , "jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: iommu@lists.linux-foundation.org On Tue, 26 May 2015, Wu, Feng wrote: > > On Mon, 25 May 2015, Feng Wu wrote: > > > + > > > + /* We don't need to modify irte if the interrupt is for posting. */ > > > + if (irte->pst != 1) > > > + modify_irte(&ir_data->irq_2_iommu, irte); > > > > I don't think this is correct. ir_data->irte_entry contains the non > > posted version, which has pst == 0. > > > > You need some other way to store whether you are in posted mode or > > not. > > Yes, seems this is incorrect. Thank you for pointing this out. After more > thinking about this, I think I can do it this way: > #1. Check the 'pst' field in hardware > #2. If 'pst' is 1, we don't update the IRTE in hardware. > > However, the question is the check and update operations should be protected > by the same spinlock ' irq_2_ir_lock ', otherwise, race condition may happen. Why? set_affinity() and vcpu_set_affinity() are serialized via irq_desc->lock. And vcpu_set_affinity() is the only way to switch from and to posted mode. So all you need is a field in intel_irq_data which captures whether posted is enabled or not. Thanks, tglx