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

Re: [PATCH v3 5/8] xen/arm/gic: Allow routing/removing interrupt to running VMs


  • To: Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Thu, 23 May 2024 08:51:20 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tqzL2ILy27IRr3fbs6qUU0Gh1DeGGGjERPmLLBR117w=; b=PO51PbfRDWSRDY3fyBngnTzQMjpKWbDxbzlb0y0eiZSgrgSjlgkMm0Gw0Ltp2k4lqhFwwkvFkxBVUge0LCoCB5TwHe2tMT8+EOmXjbwT5ZAEbw9ck0bDVAtmu8pl5GWs42Sy1oVFfM7G+Uk1fCAJt3Xt0qvTnXkNhBFINWCbJ2rIH9UaHiJ0Q11P7+NnSj+aYP+B5WH37P0AqAhUvsLluk1Rnjkixs+pXVndBTMU7h+75SLDQa8wdLvIWURW1a/UBbn0WUAa+kN/H44llPRYchL+9a180GY6fQvNoZ9uuxpN93NTFOG+hWTmmZSibM+t9EE9deXlVgyhajDLzhypVQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SiXRzlYkyZ/xVGlWZF1TqLMbu6ONRREKiwFEqEgJaGQfgknbxVg0bhq22caiUqJZHnhw01stDo2XrJQYQdgCETpGgQp06xtIWlvdA/NTZFsRKxx1gWlck9Tf5lBf3o14DYyLBnAkcT0XGtJPHq1f2Df5byMIiidQnhlpDjfwkxrMtQqSnnTMvfWE4LcEqteUDrIaNY003nKwKEqbE9iWIsEtzjSbMNqLZWvq7TsmGTaDIC7dcp6fboaSbsRez5Cw053K34WLn7VxdRq2mzFUWXTmS0X21o9ty3rl0cUks0Ob6MDZH9wSALO5rIOu/toxf8zgzEg311zZGtnJ5mUqAw==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 23 May 2024 00:51:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Julien, Stefano,

On 5/22/2024 9:03 PM, Julien Grall wrote:
Hi Henry,

On 22/05/2024 02:22, Henry Wang wrote:
Also, while looking at the locking, I noticed that we are not doing anything with GIC_IRQ_GUEST_MIGRATING. In gic_update_one_lr(), we seem to assume that
if the flag is set, then p->desc cannot be NULL.

Can we reach vgic_connect_hw_irq() with the flag set?
I think even from the perspective of making the code extra safe, we should also check GIC_IRQ_GUEST_MIGRATING as the LR is allocated for this case. I
will also add the check of GIC_IRQ_GUEST_MIGRATING here.
Yes. I think it might be easier to check for GIC_IRQ_GUEST_MIGRATING
early and return error immediately in that case. Otherwise, we can
continue and take spin_lock(&v_target->arch.vgic.lock) because no
migration is in progress

Ok, this makes sense to me, I will add

     if( test_bit(GIC_IRQ_GUEST_MIGRATING, &p->status) )
     {
         vgic_unlock_rank(v_target, rank, flags);
         return -EBUSY;
     }

right after taking the vgic rank lock.

Summary of our yesterday's discussion on Matrix:
For the split of patch mentioned in...

I think that would be ok. I have to admit, I am still a bit wary about allowing to remove interrupts when the domain is running.

I am less concerned about the add part. Do you need the remove part now? If not, I would suggest to split in two so we can get the most of this series merged for 4.19 and continue to deal with the remove path in the background.

...here, I will do that in the next version.

I will answer here to the other reply:

> I don't think so, if I am not mistaken, no LR will be allocated with other flags set.

I wasn't necessarily thinking about the LR allocation. I was more thinking whether there are any flags that could still be set.

IOW, will the vIRQ like new once vgic_connect_hw_irq() is succesful?

Also, while looking at the flags, I noticed we clear _IRQ_INPROGRESS before vgic_connect_hw_irq(). Shouldn't we only clear *after*?

This is a good catch, with the logic of vgic_connect_hw_irq() extended to reject the invalid cases, it is indeed safer to clear the _IRQ_INPROGRESS  after the successful vgic_connect_hw_irq(). I will move it after.

This brings to another question. You don't special case a dying domain. If the domain is crashing, wouldn't this mean it wouldn't be possible to destroy it?

Another good point, thanks. I will try to make a special case of the dying domain.

Kind regards,
Henry



Cheers,





 


Rackspace

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