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

Re: [PATCH v4] x86/xen: Add support for HVMOP_set_evtchn_upcall_vector


  • To: Jane Malalane <jane.malalane@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 3 Nov 2022 14:38:07 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=sfPlsqr5AtPpiPki5rWSbZySHT67nxhGfOGkd04WqFk=; b=fkdz+T9EuRKr/AK5bVndZt72Ro7UkSA8R/LZAs781iNVFc9DHQi19i9kV7LZ3Zcz0zVn9luNx/j/8buzVrPwGDAfmBbdLmSf8rMXQzG1X1IlnHd03R+zLMYNl53JRx6f331N9d+0lFxZoZgTzBJH0EbxgF7pHqbUm/Nb9LVPTQ7g1Cg+Vf4ytl1mR/0JnpVATyOq2Y6m36Yh6dgz2WAWfx0qYSUpv4m66VfGZ01QTdE0GDHrRPzHCzoIAWtfby7rlfJtx5STGRIY1OFCBm6LoQXoa6vlHgyTrHXKWBO+SQz9EPLs9fojYSa+N4KFEgmGjMD0ptH8gMylsvTdWaysvw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X5CDuMRI2Zvay+SEXuf7ZeO/4qtA/aYzAHJa7s3Ga7y3gKGKlaJsTtx0cpYmlG2xK4+eomzARik8xhUFSmYUbQu9JbFB7xb0pGH605o4P/KhjJkc3WZHcDknpImtKS+1HvlYHdBz7B7k48iwxqfFPyYg05q0ydt5GqTfBz9zMljZeRNMztu3Dkki+75VLKKdLQFWHpCiHUZVRrC6Qf5udFC4SwIspohjzZAt99fvPwX5357kpEFSWON3z0PQPkA4d38cA42ciA0bjuwfo0roOdx5MU8NqQR6Rs9vlFkaxV+pCvyMHfaSoidZ2ZtjYo9D3Nhp9mjnhjhxWRKTuPRGlA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Maximilian Heyne <mheyne@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, LKML <linux-kernel@xxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 03 Nov 2022 13:38:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 29.07.2022 09:04, Jane Malalane wrote:
> @@ -125,6 +130,9 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_xen_hvm_callback)
>  {
>       struct pt_regs *old_regs = set_irq_regs(regs);
>  
> +     if (xen_percpu_upcall)
> +             ack_APIC_irq();
> +
>       inc_irq_stat(irq_hv_callback_count);
>  
>       xen_hvm_evtchn_do_upcall();
> @@ -168,6 +176,15 @@ static int xen_cpu_up_prepare_hvm(unsigned int cpu)
>       if (!xen_have_vector_callback)
>               return 0;
>  
> +     if (xen_percpu_upcall) {
> +             rc = xen_set_upcall_vector(cpu);

>From all I can tell at least for APs this happens before setup_local_apic().
With there being APIC interaction in this operation mode, as seen e.g. in
the earlier hunk above, I think this is logically wrong. And it leads to
apic_pending_intr_clear() issuing its warning: The vector registration, as
an intentional side effect, marks the vector as pending. Unless IRQs were
enabled at any point between the registration and the check, there's
simply no way for the corresponding IRR bit to be dealt with (by
propagating to ISR when the interrupt is delivered, and then being cleared
from ISR by EOI).

As a note to x86 maintainers: This comment there

        /*
         * If the ISR map is not empty. ACK the APIC and run another round
         * to verify whether a pending IRR has been unblocked and turned
         * into a ISR.
         */

is pretty clearly wrong - with IRQs disabled there's no way for a pending
IRR bit to be "unblocked and turned into a ISR" one. And even if IRQs
were enabled TPR would still prevent the handling of any bits potentially
set in the 16....31 range.

Jan



 


Rackspace

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