From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1a1nGJ-0002ha-Qq for mharc-grub-devel@gnu.org; Wed, 25 Nov 2015 22:30:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1nGG-0002e4-9j for grub-devel@gnu.org; Wed, 25 Nov 2015 22:30:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1nGC-0007UC-9p for grub-devel@gnu.org; Wed, 25 Nov 2015 22:30:20 -0500 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:36390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1nGC-0007Tj-1H for grub-devel@gnu.org; Wed, 25 Nov 2015 22:30:16 -0500 Received: by lfs39 with SMTP id 39so80004152lfs.3 for ; Wed, 25 Nov 2015 19:30:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=oP/r6czM4MtptH5tt4deyNVj2QEJvpYYaoxj6xmjbLE=; b=qgI7YpU9gTqlcl1s5VMc6EuOlWKcX8yAoXAOHMHYvV2S3jwcXLs1DSDZa2yJe3ElQ4 YPOPVMag0YJjVSweP2Z9uNz3nWk9fqkFZY4JJv7CN3WaY28vXXpenfCdGD1Y6xgs4wp+ 4USs2mEea323OypP4r+Br5bLjgJ0vashMsTymxQ18WWo3FDUWGB05qR5svq2zp1W8KDZ SVK7GTRcxhMGaOr7hie4IeOuzjFV0kxs7xb8N6WAqCZYeT3HedsmrK4f9zGLLmIIYh0w X+d5HbnsagODjqlMK1Ahs4xLiCJ7b40W9b3W8lPbLjg80k/omiwtU7j85OwEpPlk2N6r Yd6A== X-Received: by 10.25.25.141 with SMTP id 135mr17125203lfz.136.1448508613200; Wed, 25 Nov 2015 19:30:13 -0800 (PST) Received: from [192.168.1.41] (ppp91-76-25-247.pppoe.mtu-net.ru. [91.76.25.247]) by smtp.gmail.com with ESMTPSA id pd9sm3721993lbc.48.2015.11.25.19.30.12 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Nov 2015 19:30:12 -0800 (PST) Subject: Re: grub causing NVDIMMs to be treated as normal memory To: "Elliott, Robert (Persistent Memory)" , The development of GNU GRUB , "dan.j.williams@intel.com" , "linux-nvdimm@lists.01.org" References: <94D0CD8314A33A4D9D801C0FE68B40295BE539AF@G9W0745.americas.hpqcorp.net> <5655FFC3.9030603@gmail.com> <94D0CD8314A33A4D9D801C0FE68B40295BE5549A@G9W0745.americas.hpqcorp.net> From: Andrei Borzenkov X-Enigmail-Draft-Status: N1110 Message-ID: <56567CC3.3040405@gmail.com> Date: Thu, 26 Nov 2015 06:30:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <94D0CD8314A33A4D9D801C0FE68B40295BE5549A@G9W0745.americas.hpqcorp.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c07::22c X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2015 03:30:21 -0000 26.11.2015 03:12, Elliott, Robert (Persistent Memory) пишет: > > >> -----Original Message----- >> From: Linux-nvdimm [mailto:linux-nvdimm-bounces@lists.01.org] On >> Behalf Of Andrei Borzenkov >> Sent: Wednesday, November 25, 2015 12:37 PM >> To: The development of GNU GRUB ; >> dan.j.williams@intel.com; linux-nvdimm@lists.01.org >> Subject: Re: grub causing NVDIMMs to be treated as normal memory >> >> 25.11.2015 02:52, Elliott, Robert (Persistent Memory) пишет: >>> We've noticed that some combinations of grub and old linux kernels >>> >>> end up interpreting the UEFI memory map EfiPersistentMemory type 14 >>> (formerly a reserved value) as regular memory in the linux e820 >>> table, causing silent data corruption on the NVDIMMs. That occurs >>> even though grub prints this message suggesting everything is safe: >>> >>> Unknown memory type 14, considering reserved >>> >>> >>> >>> In broken versions of grub, the code parsing the UEFI memory map >>> has a "default" case that falls through to the >>> >>> GRUB_EFI_BOOT_SERVICES_DATA case, which marks the memory range >>> as GRUB_MEMORY_AVAILABLE and ends up in e820 as regular memory. >> >> Could you test if attached patch works for you (compile tested)? > > Thanks. > > I think I finally got that to compile with > configure --with-platform=efi > make > > but have no clue how to install it and try it out. I'm using a > fedora22 system, which has its own /sbin/grub2-install. I > don't understand how that differs from the grub-install in the > build directory or how to get either of them to work. > >From the build directory pkgdatadir=$PWD ./grub-install --bootloader-id testgrub -d grub-core This should install grub in \EFI\testgrub on ESP and add EFI menu for it. You can add --no-nvram to skip EFI menu update and load it manually then. It will install modules in /boot/grub (instead of /boot/grub2), so you should probably copy /boot/grub2/grub.cfg there. Of course you can simply add patch to Fedora package and rebuild this package. > Anyway, we should create another patch that does: > * #define GRUB_EFI_PERSISTENT_MEMORY 14 per UEFI 2.5 > * #define GRUB_E820_PERSISTENT_MEMORY 7 per ACPI 6.0 > * add a GRUB_MEMORY_PMEM enum > * map GRUB_EFI_PERSISTENT_MEMORY -> GRUM_PMEMORY_MEM > -> GRUB_E820_PERSISTENT_MEMORY per ACPI 6.0 > > to explicitly handle the new types (in addition to handling > unknown values correctly). > That is much more involved than obvious bug fix. It can be done later.