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

Re: [PATCH v2 2/5] x86/ioapic: RTE modifications must use ioapic_write_entry


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 25 Jul 2023 16:41:30 +0200
  • 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=/fCKgd6sLYBCLQCXDyjAJHBrOzBlbkU4oitvYVu7UgE=; b=Yo7uN+u+9ztZy1Vykf3Iv28ufvHjfJqJKM/T+q582iYP2Pdgv8wuiDJu4yiVNMgdXGJqHCXQLp78liz+HSFDP7aXJawhKJkgMvnShmx7jnqTIPjRgBWEC7KEHF0kQb6l7wXTLEcsu96Rx5iOE4J0UcnYu3Jt+KMv/mxmlMZIPvz+NA+4xfuii8iPrjZa87l9FavG/mpdxSTTUw/uL4rF3/2ymgMXUy9hgGaE4rPjGFggxwQXlm4//kJ10iTIjtPcI9/7PKPcG6K+8lnax0bLF3bmqv+GDUcF1OvFhimizpV4E6FMSiGFxIET97LAxvhqmJZUdUKMi8JWioozF1qvrA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mLXB+vOFOxSjtCmvfF+kzlyBaKOQX8fr0Lv3cyLCuldBKMtaUyku1Gwl4c6dvNl2bfczEi7JMXLrtYt1ygGN66glj3IoHhr1a4ugW/Dd6YUJHP/X50Cwtdxdi6ks8aonPS9WyjrpS0GuUcXyEkpj+HeC8gxRBpBYI9Z4ZMYs+7POtVHj+eMAgcRcg0LfNuQg/Qt4GTT2RklT6ks4c1I5XscOHlpq1vxK7wae392roVZoTOlRgfsje9AWkxEQMNssjCBHxQPox3k/WRqlpgZKcncDed3prRaOKkgFpThisMs5PpugeQQQodZQRjM8E3v6dP/6bZaLCyPy9PMkuIW4QA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 25 Jul 2023 14:41:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25.07.2023 15:30, Roger Pau Monné wrote:
> On Tue, Jul 18, 2023 at 05:40:18PM +0200, Jan Beulich wrote:
>> On 18.07.2023 14:43, Roger Pau Monne wrote:
>>> --- a/xen/arch/x86/io_apic.c
>>> +++ b/xen/arch/x86/io_apic.c
>>> @@ -584,16 +585,16 @@ set_ioapic_affinity_irq(struct irq_desc *desc, const 
>>> cpumask_t *mask)
>>>              dest = SET_APIC_LOGICAL_ID(dest);
>>>          entry = irq_2_pin + irq;
>>>          for (;;) {
>>> -            unsigned int data;
>>> +            struct IO_APIC_route_entry rte;
>>> +
>>>              pin = entry->pin;
>>>              if (pin == -1)
>>>                  break;
>>>  
>>> -            io_apic_write(entry->apic, 0x10 + 1 + pin*2, dest);
>>> -            data = io_apic_read(entry->apic, 0x10 + pin*2);
>>> -            data &= ~IO_APIC_REDIR_VECTOR_MASK;
>>> -            data |= MASK_INSR(desc->arch.vector, 
>>> IO_APIC_REDIR_VECTOR_MASK);
>>> -            io_apic_modify(entry->apic, 0x10 + pin*2, data);
>>> +            rte = __ioapic_read_entry(entry->apic, pin, false);
>>> +            rte.dest.dest32 = dest;
>>> +            rte.vector = desc->arch.vector;
>>> +            __ioapic_write_entry(entry->apic, pin, false, rte);
>>
>> ... this makes me wonder whether there shouldn't be an
>> __ioapic_modify_entry() capable of suppressing one of the two
>> writes (but still being handed the full RTE).
> 
> I've wondered about this, and I'm not sure how often can one of the
> two writes be suppressed here, as we modify both the low (for the
> vector) and the high part of the RTE (for the destination).  It's
> unlikely that the same vector could be used on both destinations, and
> IMO such case doesn't warrant the introduction of the extra logic
> required in order to suppress one of the writes.
> 
> Am I overlooking something?

Oh, no, that was me seeing the io_apic_modify() without paying attention
to the earlier io_apic_write() (both in the code you replace).

Jan



 


Rackspace

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