lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 02 Oct 2012 15:19:43 +0100
From:	"Jan Beulich" <JBeulich@...e.com>
To:	"Hugh Dickins" <hughd@...gle.com>
Cc:	"Andi Kleen" <andi@...stfloor.org>,
	"Ingo Molnar" <mingo@...nel.org>, <x86@...nel.org>,
	"Yinghai Lu" <yinghai@...nel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: x86_64: wrong DirectMap kB

>>> On 01.10.12 at 10:37, Hugh Dickins <hughd@...gle.com> wrote:
> I noticed yesterday that the DirectMap counts at the bottom of x86_64's
> /proc/meminfo are wrong on v3.5 and v3.6.  For example, I happen to have
> booted this laptop with mem=700M to run a test, but /proc/meminfo shows
> 
> DirectMap4k:        4096 kB
> DirectMap2M:    18446744073709547520 kB

I cannot see such odd effect with "mem="; with I can (for any
value up to around 1G).

> Or if I boot with the full amount of physical memory, the DirectMap
> numbers do not add up to the full amount of physical memory, as they
> used to do on v3.4 and before.

That one I can see how could have happened, in that said patch
went a little too far: Dropping the "pages" increments from
phys_p[um]d_init() is necessary only for the hotplug case (as
otherwise duplicating accounting already done earlier), while
at boot time we would want to do the accounting.

> Whilst I've not yet tried reverting it, I strongly suspect your
> 20167d3421a0 "x86-64: Fix accounting in kernel_physical_mapping_init()".
> 
> Either it was a complete misunderstanding, totally bogus, and should
> simply be reverted; or perhaps you really noticed something wrong in
> your code inspection, but didn't get the fix quite right?

The latter, apparently. The patch below should fix both aspects.

Jan

--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -386,7 +386,8 @@ phys_pte_init(pte_t *pte_page, unsigned 
 		 * these mappings are more intelligent.
 		 */
 		if (pte_val(*pte)) {
-			pages++;
+			if (!after_bootmem)
+				pages++;
 			continue;
 		}
 
@@ -451,6 +452,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned 
 			 * attributes.
 			 */
 			if (page_size_mask & (1 << PG_LEVEL_2M)) {
+				if (!after_bootmem)
+					pages++;
 				last_map_addr = next;
 				continue;
 			}
@@ -526,6 +529,8 @@ phys_pud_init(pud_t *pud_page, unsigned 
 			 * attributes.
 			 */
 			if (page_size_mask & (1 << PG_LEVEL_1G)) {
+				if (!after_bootmem)
+					pages++;
 				last_map_addr = next;
 				continue;
 			}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ