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

Re: [PATCH] x86/kexec: Use noreturn attributes, and drop unreachable code


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 8 Mar 2022 09:25:00 +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=vpwuUxvuVryOj+z07IltX4NawtC1HTPFBO6aoxcYoW8=; b=Ww//WJccPBInk0CDVXwuDS6BxX9lDJDcmRYSLlPlLhi+vH3BLhPr3K22Cm8v3vzpIPG/WMYytCz70z9qYYC51vB39kvVV/rqcAPVUa5Ft3P6lm3dNCiQiTNpStX7z3MTwagLo5/+JCryegDjlCOO2ER83EryTGrJQMk/cIgUuJAff62cFO4lEayMwv6cviid6u6smdohd0M0aHUk6fXYb51uEUHVAdG4lOIYKtaTJvF3P92XpBR/yDiOGOxSy951ARhN4Sj+YzBVGEt02ed3JtzE+sVgpCNZ2nutf6w0bBI7nqf0TZjmd8udh3nfTFzc7vpliiB20AQXQdUBkmmYnQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k9Pn4D7zB0mkBTah0+rbZMQ8IGL7Yxizp4WxOh5YMQs/L2igdToRISICWoHRDhNOqCUvfYO3rOzV2NfImC607F8UetNH+iB+T0aTTPzJXnmo4Fk0OJNIC5Dl09L00JI8agibwG0BxZZgmnawt2QNSUNL4+Afj8kDqM5Vsm7NobfT729RGmcjbpp7kJ7Bx9AmmW0qFC1JGAPW5MzpS3fg8Rn2jILNQAWS1t6yOc9jPxmzb4FoRcI/l3VhMlvFtLYRMowDJmYG3+upo9Z2iDCn+giBVQSVOr86G+upuowRGOh5VbtJLzDCBuo0wDYj5ZUQWE3wC4g8lKX7nAMMyFAc8Q==
  • 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, 08 Mar 2022 08:25:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.03.2022 22:02, Andrew Cooper wrote:
> kexec_reloc() does not return.  Plumbing this property upwards lets us mark
> machine_kexec() and machine_reboot_kexec() noreturn too.  This in turn lets us
> drop some unreachable BUG()/return statements.

I'm certainly fine with the added attributes. I'm less convinced of the
removal of BUG() - I'd prefer to leave to the compiler elimination of
these when found to be dead, just to be on the safe side. And I'm pretty
uncertain about the removal of "return", when it comes to old enough
compilers.

> @@ -403,9 +401,6 @@ static long cf_check kexec_reboot(void *_image)
>  
>      kexec_common_shutdown();
>      machine_reboot_kexec(image);
> -
> -    BUG();
> -    return 0;
>  }

In principle this function now is also "noreturn", but I think I
vaguely recall some compilers warning about "noreturn" when a function
returns other than void.

Jan




 


Rackspace

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