From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937629AbdCJNs2 (ORCPT ); Fri, 10 Mar 2017 08:48:28 -0500 Received: from mout.gmx.net ([212.227.15.19]:58137 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934258AbdCJNsZ (ORCPT ); Fri, 10 Mar 2017 08:48:25 -0500 Message-ID: <1489153665.4410.4.camel@gmx.de> Subject: Re: kexec, x86/purgatory: Cleanup the unholy mess From: Mike Galbraith To: Thomas Gleixner , Borislav Petkov Cc: "Tobin C. Harding" , LKML , Nicholas Mc Guire , Vivek Goyal , x86@kernel.org Date: Fri, 10 Mar 2017 14:47:45 +0100 In-Reply-To: References: Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:1jN82C/jJ6ZxSS5XgKYidziikL3+u5C3gnki1Zh5cMpMOwCdf9i tSULN19IZ5dElVeu4JEN8EH7RHdUEvLGJwS6vFm0IZP/bjny9+LTyQcXyk4JtIMGeNHVW/u xQzs61+tI1/ZRDSOC+l20MwvBKULZJDysWJiE0af3ktjLKS66qtUPZVGtS6MTZtLmWPrNzp KY7dsZKYvb5DZnHznLFbA== X-UI-Out-Filterresults: notjunk:1;V01:K0:ouE/1MW+fPc=:gO8016WOjP9G1+eirRprOm tHWXqQjXAnDk/hMBhIJ1bXnJ4zYxIIL1i7/eY55CPLFGYFQiKDdluZ+45NzBtjj0aruHCOScu DXZvWY1/bZr8dHa8gjpWEaFr6IjdWIckV04tbGdyhx/6zRpnLS1FLxkcJouHNBwPCGYwkdFmD 8fpdQkqMTPLSxPc0A8kIVLrNqo6UMS5qjwwMG7N5CIMA2n6CMIHswVxW13iuq9uG9Uf5T/7K7 jcIcoGqCnQLKd6C+SZRIni/SdpK9MSPU94rJO0ZblVYZnZ7/W9Ycsn/jrpt3uNLOoaJ4ii0C1 lTA5/4ycDLrTSX/l4a4nG6PgnQ17qTXLy9BIGoHYxo9lbXjmI16GfjsQe2AF5r9A1mjKBmxHY p77ezSP8cGBRu+6TYasTdE/e4sgz9kcEX9dvF5Rt81xFlrnHXGu+EX/5O1rFoeywHiyvb+WxM pvbXnSDzhdTGKEkijj7JkbQol1dogGVBcqQk/8LBVtzTYXva0mVRmOwBQtL6jBxMPm9SSBU4B y9gy9uCN2dbpF61xTl4RzIY3Y8KKjIXV8WOH4Cf0h3rrbCrmwiB6ZQkW35SzX0dsFgpLy3Elz TwGDekixHDD19h3ojmGKCadK/aphbqhBRoxf3I60TpMJ9+rWUoKESaosGIyRcA2TWAkq6ku+/ CkIGzI82agOuwvjXODZvn8vaDTtgjOnAdK7yiuiMWXcTDSQPsxEYk2a5BSJ42dbE5yFpkHKod klbAf9I/JjMra5cb3KMDIv36zKmP5xpZtlCb0G9/q1GdQ8ahFC7w9Muhp6giJ7JztLxZUc2QY nJ3D9mT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-03-10 at 13:17 +0100, Thomas Gleixner wrote: > The purgatory code defines global variables which are referenced via a > symbol lookup in the kexec code (core and arch). > > A recent commit addressing sparse warning made these static and thereby > broke kexec file. > > Why did this happen? Simply because the whole machinery is undocumented and > lacks any form of forward declarations. The variable names are unspecific > and lack a prefix, so adding forward declarations creates shadow variables > in the core code. Aside of that the code relies on magic constants and > duplicate struct definitions with no way to ensure that these things stay > in sync. > > Unbreak kexec and cleanup the mess by: > > - Adding proper forward declarations and document the usage > - Use the proper common defines instead of magic constants > - Add a purgatory_ prefix to have a proper name space > - Use ARRAY_SIZE() instead of a homebrewn reimplementation > > Fixes: 72042a8c7b01 ("x86/purgatory: Make functions and variables static") Well, almost fixes. [ 15.118820] kexec: symbol 'purgatory_sha_regions' in common section [ 15.119187] kexec-bzImage64: Loading purgatory failed -Mike