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

Re: [PATCH 4/5] x86/traps: Drop exception_table[] and use if/else dispatching


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 23 Nov 2021 10:05:35 +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=gpGiIk7XQQ/Jt8tQH0bxR8zhEm0WXiioQrFa3PtnkYo=; b=OWG+vSUFzOetl47xtdFAzoydCYkN5EZmmnXU3LH2RQi5gzs8WSYm31kHpfa0vuOZsf+E8v8Tb+/399kNzefdazXI6V1ZSyxInKl1U6WhCymzjM+tz5d3BW1QodDjIQYYb/9YMjwC2PMza2JCWURWF75drgfLQunsmiK6IB7Nd1Z/otp8b8bHbnxXYsCJ69KAF5lm3pWM4BtHJ3XzyPzkzekxZljXjLCi8mUjAj76FX/0a4DObevR+W+ZReU7pZBLd8uRso+hnAygUk+OINCIR4aRoLPEccnp1/UXPTaw/CoBYUSBpuO03Ekd4gceHaknRIVGQkfEZSC2ek0DNE/UTw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=La9Xh4v4HIoMRrdqY9IT3PUmsmWHWlmLHTBk7n7pDicxUQEICQ5WYvGvOYBbdOCMPM8nb+Ua58xo6TTs9bozvbZi9QYU7KL5ZoWCQmH0AKdfBqm1taHuGOWvMiYxxEpdEoXAtMEXy9v5C0q6o3KvjK0st0zZbS5vALgJTBJSWfiW9dmWUy15HXfB1L3JJUOUDbsDnadSCaDNDfzmO09OrmSAnuxjjqGipnzrd1Z1Ui8t56ZIqtbFz36wAdSdEgWTayFFktU1JYfzCe9FgiHeEjL6vMQNc8c8Lywtta90+U00AOTBFBa8FUo+LPFNUlI/Gb8XILDVG0LkxwwETK1erA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 23 Nov 2021 09:05:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.11.2021 19:21, Andrew Cooper wrote:
> There is also a lot of redundancy in the table.  8 vectors head to do_trap(),
> 3 are handled in the IST logic, and that only leaves 7 others not heading to
> the do_reserved_trap() catch-all.  This also removes the fragility that any
> accidental NULL entry in the table becomes a ticking timebomb.
> 
> Function pointers are expensive under retpoline, and different vectors have
> wildly different frequences.  Drop the indirect call, and use an if/else chain
> instead, which is a code layout technique used by profile-guided optimsiation.
> 
> Using Xen's own perfcounter infrastructure, we see the following frequences of
> vectors measured from boot until I can SSH into dom0 and collect the stats:
> 
>   vec | CFL-R   | Milan   | Notes
>   ----+---------+---------+
>   NMI |     345 |    3768 | Watchdog.  Milan has many more CPUs.
>   ----+---------+---------+
>   #PF | 1233234 | 2006441 |
>   #GP |   90054 |   96193 |
>   #UD |     848 |     851 |
>   #NM |       0 |     132 | Per-vendor lazy vs eager FPU policy.
>   #DB |      67 |      67 | No clue, but it's something in userspace.
> 
> Bloat-o-meter (after some manual insertion of ELF metadata) reports:
> 
>   add/remove: 0/1 grow/shrink: 2/0 up/down: 102/-256 (-154)
>   Function                                     old     new   delta
>   handle_exception_saved                       148     226     +78
>   handle_ist_exception                         453     477     +24
>   exception_table                              256       -    -256
> 
> showing that the if/else chains are less than half the size that
> exception_table[] was in the first place.
> 
> As part of this change, make two other minor changes.  do_reserved_trap() is
> renamed to do_unhandled_trap() because it is the catchall, and already covers
> things that aren't reserved any more (#VE/#VC/#HV/#SX).
> 
> Furthermore, don't forward #TS to guests.  #TS is specifically for errors
> relating to the Task State Segment, which is a Xen-owned structure, not a
> guest-owned structure.  Even in the 32bit days, we never let guests register
> their own Task State Segments.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

As it feels like we won't be coming to an agreement here, despite
my reservations against the specific form of some of this and on
the basis that the code change itself is certainly an improvement:
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

I'd nevertheless be curious whether in five or ten years time you'd
still agree with your choice of basing a decision on not really
representative data (at least as far as what the description says).

Jan




 


Rackspace

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