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

Re: [PATCH for-4.22 v2 4/4] char/ns16550: bound execution time of ns16550_interrupt()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 29 Jun 2026 16:44:20 +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=arcselector10001; 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=5e7GOFqcAMsmly9qKlMY7zA6rOCcC4BtBCVQBAjDO6I=; b=m5arWTmldvb1z2DP3JvYqYa4eVNHzasgclWFFVyVZpW/3Avm/KV5W3tOyWh9zDlgU1RcYg2yzfloTj4dAaP4o2XMzuCRUJnDl05OV/tUxVpBxjNh5jEktpIiswcJDQMR6MIfnXvK/zYAsrhozq3OLrzdcvE7DaLl56sTsk9HGKXlXr5T/+mEd9uRCPSRT2JfSZX3e97Ec/kS9AOqbvXEv8Y52P09IOnlIBp3NXxRtV3ar1foFX3+loQTWUjPV/JQRBe+H1cRZoIyxmWTUaOaxxP5ss3dlX9w4gin2QMAZ0UTSKzSYa8GdUf+iikUV+chHD+JNU2XPojRZYigxqFjsQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mdZg89FHHsL1PbT19XUY9z/5BBcYwmHrI9ZjtSZmV9R1S+8aWNFJZLhTEUHcet6W34B6AdocG0oIUwgtVaPhK7jJE6wozVFgNWnFeK1bLn0T+4PfJS6BF+EdwusoEOrQ1SbRzysVJ6cv3HWQtB8JOqMOXs9j9HIcWKzqSCwIZvOp912571WCP0XQzMOhezt2RpqbGntyg0sEYRDkUVHG842i4JWkkEI/Px/CBuMAJ2cgPKeLMP5n9k4azwc6gJrHXtutu6upYk7vrs0wQz/m8QZ5wEGVVwCKCU3rHom8CdWkXHeVSVoaAT8IMNp4Akdn2XK/OI/my5+vmdEaLZAegg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 29 Jun 2026 14:44:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Jun 29, 2026 at 12:39:45PM +0200, Jan Beulich wrote:
> On 29.06.2026 11:45, Roger Pau Monne wrote:
> > --- a/xen/common/irq.c
> > +++ b/xen/common/irq.c
> > @@ -54,3 +54,15 @@ unsigned int cf_check irq_startup_none(struct irq_desc 
> > *desc)
> >  {
> >      return 0;
> >  }
> > +
> > +void disable_irq(unsigned int irq)
> > +{
> > +    struct irq_desc *desc = irq_to_desc(irq);
> > +    unsigned long flags;
> > +
> > +    spin_lock_irqsave(&desc->lock, flags);
> > +    desc->status |= IRQ_DISABLED;
> > +    if ( desc->handler->disable )
> > +        desc->handler->disable(desc);
> 
> I'd like to point out that __pirq_guest_unbind() has this the other way 
> around:
> Call ->disable(), then set flag. Similarly move_native_irq() only calls the
> hook with the flag clear. Whereas fixup_irqs() doesn't care about the flag at
> all. Also considering the wording "disable" vs "disabled", I think setting the
> flag afterwards is better.

As this was done inside of the locked region I didn't think it
mattered much, but yes, the ->disable() handler might itself rely on
the previous state.

> > @@ -190,12 +191,38 @@ static void cf_check ns16550_interrupt(int irq, void 
> > *dev_id)
> >  {
> >      struct serial_port *port = dev_id;
> >      struct ns16550 *uart = port->uart;
> > +    /*
> > +     * Set quite arbitrarily as 4x the time to drain the TX or fill RX 
> > FIFOs,
> > +     * set the upper bound as 5ms or the timeout_ms value, whatever is 
> > higher.
> > +     */
> > +    const unsigned int delta = min(uart->timeout_ms * 4,
> > +                                   max(5u, uart->timeout_ms));
> 
> You may want to also update the description accordingly.
> 
> Preferably with respective adjustments:
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks, I've applied the comments.

Regards, Roger.



 


Rackspace

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