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

Re: [PATCH v2 4/6] x86/irq: fix setting irq limits


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 5 Jul 2022 16:06:32 +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=1bAOa85+pWScZPs8MLVb6ZZmrXViQP9KcG8Mi6dCzpA=; b=fs6oW7o/+FSrl/21Eyb9M7lD2SYcyWpCdYoz6TXjteVqhLfpUEoBNMxzSuPPRzBaYa5mNYpNJoYsARw+C9TPTyzYOgo1X52SCKJWP7fooaby++yqvxLYeJQRbgAYON9VZgTGX17VmnmsjyE/3tAxHBvz0JzDWtUrXxWacAmi5HTBsVONuhQqvOYQu92VGlQ1rmr2SRn8uS7GFOuHBw5KFQquThg/r1y2MCsVQhdFqs1ZDZopA/wJ3w4ZJQA8/EQV29McVlgxhas8PNmiGVC5WwPSbok+sKGYEZ26/vyH1YsywkTbPBcnaN1eoz5/FOUAgU9fa4+JNFcSrfkYkPTGOg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ky0sEi+EeBM5HdjHIIvV4VQnbLro6yRx1dxvZp/rYT6asfF8ZTGQjCJ27abfmXOhPKxbgxAluuQiUjNglxHYQFZ1BA5QFvJGrmCxclgHbdAfdQxnayThf9J0e1/k/Sd51Uu2GFWVpTyMjeYkuh72M78Mh4bi/uAM2jHzwVY0UzhYZtanU2J+mJ49cCcCW/EGSTloEUkZrUEYtK1lcUTO+PuvA0XKvAM7Db78PPnAN1Usvzd8yOh0tf0i5nk3lrLrSENVDPcasnQGVq08nFqBkPAyD0BgcOtYTJ/mp92aIRFzBDw4G6Ud4SjiaV+ayXwnYX08jZVaG+yyVkCKawe60A==
  • 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, 05 Jul 2022 14:06:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30.06.2022 10:54, Roger Pau Monne wrote:
> Current code to calculate nr_irqs assumes the APIC destination mode to
> be physical, so all vectors on each possible CPU is available for use
> by a different interrupt source. This is not true when using Logical
> (Cluster) destination mode, where CPUs in the same cluster share the
> vector space.
> 
> Fix by calculating the maximum Cluster ID and use it to derive the
> number of clusters in the system. Note the code assumes Cluster IDs to
> be contiguous, or else we will set nr_irqs to a number higher than the
> real amount of vectors (still not fatal).

While not fatal, it could be (pretty) wasteful. Iirc discontiguous
cluster numbers aren't unusual. It shouldn't be that difficult to
actually count clusters.

> The number of clusters is then used instead of the number of present
> CPUs when calculating the value of nr_irqs.

This takes care of x2APIC clustered mode, but leaves xAPIC flat mode
still as broken as before. vec_spaces should be 1 in that case,
shouldn't it?

> --- a/xen/arch/x86/include/asm/apic.h
> +++ b/xen/arch/x86/include/asm/apic.h
> @@ -27,6 +27,8 @@ enum apic_mode {
>  extern bool iommu_x2apic_enabled;
>  extern u8 apic_verbosity;
>  extern bool directed_eoi_enabled;
> +extern uint16_t x2apic_max_cluster_id;

I don't see a need to use a fixed width type here; unsigned int will
be quite fine afaict (and be in line with ./CODING_STYLE). Or if you
want to save space, then it still would better be "unsigned short".

> @@ -199,6 +201,9 @@ static int MP_processor_info_x(struct 
> mpc_config_processor *m,
>               def_to_bigsmp = true;
>       }
>  
> +     x2apic_max_cluster_id = max(x2apic_max_cluster_id,
> +                                 (uint16_t)(apicid >> 4));
> +
>       return cpu;
>  }

I assume you don't mean to also account for hotplug CPUs? If so,
please add a respective statement to the description.

Jan



 


Rackspace

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