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

Re: [PATCH RFC 3/6] x86/ioapic: RTE modifications must use ioapic_write_entry


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 3 Jun 2022 17:01:17 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=jweHrj49xWVULGG2jMQ0CzOE1DRKXh3yACBN7lOJSMw=; b=goo5PETcFOrl2fFEdP/QXYLF9vSxz4/TjFU8mwE40xnchf+iwIQgH1fBobIBxD36Xy74qeMXxx5MJymuEVSrMggIWg1gs+rV6n0XWyQ+pOSX+VjrqbMQUrnEYEiXHdirRSOdgy2GMXkMTgKWtO8dh7i8aR8Daf06GKugj2oK11SKN/EP9+U5n6v5MuYEpm/74dRJKbsBeWKdCvNQdc8h1xK3IKQ8/zI99Q04NHBrVBOXlG9Dbn7b/NbGLGj8z8TYgzCQ4IsIzVOAOJ5+VA4oDRJyZkSm4IsSuV0NjhkzgGm9gMFnLDY8jv6AFacQsaUDy5jUd5oblHXs0qy0nOHb+w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jguwvDVCpD99ePf2yWin6Yr8Xa+XXiUgLrk+u+oodzg9Y3ae1KIs54JqHshIDV/p4pkjTXZ+QAvNnyaYu5JTNvzq1HOMfLZvfGjO/nDtSTyF7uNLn3GBtoXTV8B01cFdVwtpYblz1SPhG3mMHRedHGDfi0nMOCB0FRnj+lbGHwFWa15usQ8pCd1Z/ElPwt/onbhqOtmdV+d2+y3JlpnLJhJ9TUIHl11xUns+U40kJPOjaq4Eik7Y00rzw6i281Tyt/YwIgUiFoIGP/ARpy7YLlfOn9WOCr879BIRDoLzqxmnxmxsApp3jStQZcA0Al7+XVPlUjzKbnNEEWVdcSkEbQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 03 Jun 2022 15:01:35 +0000
  • Ironport-data: A9a23:QYl8x6uf8Dojx7xIblpnwxk5GufnVCJfMUV32f8akzHdYApBsoF/q tZmKTvSOP+IZzenKdh+O4yw8EMCvZ+GyIBiGQQ++ShmHyIV+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/nOHNIQMcacUsxLbVYMpBwJ1FQywobVvqYy2YLjW13V4 ouoyyHiEATNNwBcYzp8B52r8HuDjNyq0N/PlgVjDRzjlAa2e0g9VPrzF4noR5fLatA88tqBb /TC1NmEElbxpH/BPD8HfoHTKSXmSpaKVeSHZ+E/t6KK2nCurQRquko32WZ1he66RFxlkvgoo Oihu6BcRi8UJPLIt9tMWSNSCgFbNqNZ8pj9IWmw5Jn7I03uKxMAwt1IJWRvZcgy3LkyBmtDs /sFNDoKcxaPwfqsx662QfVtgcJlK9T3OIQYuTdryjSx4fQOGMifBfmVo4AAmm5o36iiHt6HD yYdQSBoYxnaJQVGJ38cCY4knffujX76G9FdgA3I/vdsuDKPpOB3+OC2YIr1UeebfOkLu3uo4 WXG8mG6DR5PYbRzzhLAqBpAnNTnnyn2RYYTH72Q7eNxjRuYwWl7IAISfUu2p7++kEHWc8JSL QkY9zQjqYA29Ve3VZ/tUhugunmGsxUAHd1KHIUHBBqlz6PV50OTADcCRzsYMNg+7pZuHHoty 0ODmM7vCXp3qrqJRHmB97CS6zSvJSwSKmxEbigBJecY3+TeTEgIpkqnZr5e/GSd17UZxRmYL +i2kRUD
  • Ironport-hdrordr: A9a23:5seDQKCYixXp9K3lHegwsceALOsnbusQ8zAXPh9KJCC9I/bzqy nxpp8mPH/P5wr5lktQ/OxoHJPwOU80lKQFmLX5WI3PYOCIgguVxe1ZnOjfKnjbalbDH41mpN tdmspFebrN5DFB5K6VgTVQUexQpuVvmJrY+Ns2pE0dKT2CBZsQjTuQXW2gYzdLrUR9dOwEPa vZwvACiyureHwRYMj+Ln4ZX9Lbr9mOsJ79exYJCzMu9QHL1FqTmfbHOind+i1bfyJEwL8k/2 SAuwvl5p+7u/X+7hPHzWfc47lfhdOk4NpeA86njNQTN1zX+0+VTbUkf4fHkCE+oemp5lpvuN 7Qoy04N8A20H/VdnHdm2qZ5yDQlBIVr1Pyw16RhnXu5ebjQighNsZHjYVFNjPE9ksJprhHoe 529lPck6ASIQLLnSz76dSNfQptjFCIrX0rlvNWp2BDULEZdKRaoeUkjQ5o+a87bWzHAb0cYa hT5Jm23ocXTbraVQGSgoBX+q3iYpxpdS32AXTruaSuokprdT5CvgklLfck7wk9HaIGOuZ5Dt v/Q9VVfZF1P7srhPFGdZA8qfXeMB28fTv8dESvHH/AKIYrf1rwlr+f2sRH2AjtQu1C8KcP
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Jun 03, 2022 at 03:34:33PM +0200, Jan Beulich wrote:
> On 21.04.2022 15:21, Roger Pau Monne wrote:
> > Do not allow to write to RTE registers using io_apic_write and instead
> > require changes to RTE to be performed using ioapic_write_entry.
> 
> Hmm, this doubles the number of MMIO access in affected code fragments.

But it does allow to simplify the IOMMU side quite a lot by no longer
having to update the IRTE using two different calls.  I'm quite sure
it saves quite some accesses to the IOMMU RTE in the following
patches.

> > --- a/xen/arch/x86/include/asm/io_apic.h
> > +++ b/xen/arch/x86/include/asm/io_apic.h
> > @@ -161,22 +161,11 @@ static inline void __io_apic_write(unsigned int apic, 
> > unsigned int reg, unsigned
> >  
> >  static inline void io_apic_write(unsigned int apic, unsigned int reg, 
> > unsigned int value)
> >  {
> > -    if ( ioapic_reg_remapped(reg) )
> > -        return iommu_update_ire_from_apic(apic, reg, value);
> > +    /* RTE writes must use ioapic_write_entry. */
> > +    BUG_ON(reg >= 0x10);
> >      __io_apic_write(apic, reg, value);
> >  }
> >  
> > -/*
> > - * Re-write a value: to be used for read-modify-write
> > - * cycles where the read already set up the index register.
> > - */
> > -static inline void io_apic_modify(unsigned int apic, unsigned int reg, 
> > unsigned int value)
> > -{
> > -    if ( ioapic_reg_remapped(reg) )
> > -        return iommu_update_ire_from_apic(apic, reg, value);
> > -    *(IO_APIC_BASE(apic) + 4) = value;
> > -}
> 
> While the last caller goes away, I don't think this strictly needs to
> be dropped (but could just gain a BUG_ON() like you do a few lines up)?

Hm, could do, but it won't be suitable to be used to modify RTEs
anymore, and given that was it's only usage I didn't see much value
for leaving it around.

Thanks, Roger.



 


Rackspace

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