linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hans Rosenfeld <hans.rosenfeld@amd.com>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>, Ingo Molnar <mingo@elte.hu>,
	Jeff Chua <jeff.chua.linux@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Gabriel C <nix.or.die@googlemail.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Nishanth Aravamudan <nacc@us.ibm.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] x86: fix PAE pmd_bad bootup warning
Date: Thu, 8 May 2008 16:39:33 +0200	[thread overview]
Message-ID: <20080508143933.GF12654@escobedo.amd.com> (raw)
In-Reply-To: <20080508143453.GE12654@escobedo.amd.com>

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

On Thu, May 08, 2008 at 04:34:53PM +0200, Hans Rosenfeld wrote:
> A stripped-down program exposing the leak is attached.

It is now :)

-- 
%SYSTEM-F-ANARCHISM, The operating system has been overthrown

[-- Attachment #2: hugetest.c --]
[-- Type: text/plain, Size: 1429 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <inttypes.h>
#include <signal.h>
#include <string.h>
#include <strings.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define HUGEPAGES "/proc/sys/vm/nr_hugepages"
#define HUGE_FILE "/mnt/huge/foobar"

void *huge;

int main(int argc, char **argv)
{
	uint64_t ppte;
        int fd, maps;

        if ((fd = open(HUGEPAGES, O_WRONLY, 0)) == -1) {
                perror(HUGEPAGES);
                return 1;
        }
        write(fd, "20\n", 3);
        close(fd);

        if ((fd = open(HUGE_FILE, O_RDWR | O_CREAT, 0)) == -1) {
                perror(HUGE_FILE);
                return 1;
        }

        huge = mmap((void *) 0x1000000, 0x400000,
                    PROT_READ | PROT_WRITE,
                    MAP_PRIVATE | MAP_FIXED,
                    fd, 0);

        if (huge == MAP_FAILED) {
                perror(HUGE_FILE);
                return 1;
        }

        fprintf(stderr, "huge: 0x%0.*" PRIxPTR "\n", sizeof(huge) * 2, huge);
        memset(huge, 1, 12345);

	if ((maps = open("/proc/self/pagemap", O_RDONLY, 0)) < 0) {
		perror("/proc/self/pagemap");
		return 1;
	}

	if (pread(maps, &ppte, sizeof(ppte), ((uintptr_t) huge) >> 9) < 0) {
		perror("pread");
		return 1;
	}

	fprintf(stderr, "ppte: 0x%0.16" PRIx64 "\n", ppte);

        return 0;
}

  reply	other threads:[~2008-05-08 14:39 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b6a2187b0805051806v25fa1272xb08e0b70b9c3408@mail.gmail.com>
     [not found] ` <20080506124946.GA2146@elte.hu>
     [not found]   ` <Pine.LNX.4.64.0805061435510.32567@blonde.site>
     [not found]     ` <alpine.LFD.1.10.0805061138580.32269@woody.linux-foundation.org>
2008-05-06 19:49       ` Hugh Dickins
2008-05-06 20:06         ` Linus Torvalds
2008-05-06 20:30           ` Hugh Dickins
2008-05-08 16:07             ` Nishanth Aravamudan
2008-05-06 20:22         ` Hans Rosenfeld
2008-05-06 20:36           ` Hugh Dickins
2008-05-07 23:39             ` Nishanth Aravamudan
2008-05-06 20:42           ` Dave Hansen
2008-05-08 14:34             ` Hans Rosenfeld
2008-05-08 14:39               ` Hans Rosenfeld [this message]
2008-05-08 14:52               ` Dave Hansen
2008-05-08 15:11                 ` Hans Rosenfeld
2008-05-08 15:51                   ` Dave Hansen
2008-05-08 16:19                     ` Hans Rosenfeld
2008-05-08 16:33                       ` Nishanth Aravamudan
2008-05-08 16:51                         ` Hans Rosenfeld
2008-05-08 17:16                           ` Nishanth Aravamudan
2008-05-08 18:42                             ` Dave Hansen
2008-05-08 18:58                               ` Hugh Dickins
2008-05-08 19:06                                 ` Dave Hansen
2008-05-08 18:48                             ` Hugh Dickins
2008-05-08 19:49                               ` Matt Mackall
2008-05-08 20:08                                 ` Dave Hansen
2008-05-08 20:02                               ` Hans Rosenfeld
2008-05-08 20:16                                 ` Dave Hansen
2008-05-08 23:15                                 ` Dave Hansen
2008-05-14 19:01                                   ` Matt Mackall
2008-05-09  9:03                                 ` Paul Mundt
2008-05-08 16:42                       ` Dave Hansen
2008-05-08 15:44                 ` Nishanth Aravamudan
2008-05-07  4:40         ` Jeff Chua
2008-05-07  5:30           ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080508143933.GF12654@escobedo.amd.com \
    --to=hans.rosenfeld@amd.com \
    --cc=arjan@linux.intel.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=hugh@veritas.com \
    --cc=jeff.chua.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=nacc@us.ibm.com \
    --cc=nix.or.die@googlemail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox