All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: Linux Arch list <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] set_pte() part 2 arch usage
Date: Sun, 27 Feb 2005 20:35:57 +1100	[thread overview]
Message-ID: <1109496957.14992.196.camel@gaston> (raw)
In-Reply-To: <20050226190943.7aa031e2.davem@davemloft.net>

On Sat, 2005-02-26 at 19:09 -0800, David S. Miller wrote:
> .../...
> There are many pte level looping constructs of the form:
> 
> 	pte = ...(pmd, address);
> 	address &= ~PMD_MASK;
> 	end = address + size;
> 	if (end > PMD_SIZE)
> 		end = PMD_SIZE;
> 
> 	some_loop() {
> 		...
> 		set_pte_at(mm, address, pte);
> 		address += PAGE_SIZE;
> 		pte++;
> 		...
> 	}
> 
> This "address" mask screws everything up.
> 
> I know of at least three such cases so far, vmalloc.c:unmap_area_pte(),
> vmalloc.c:map_area_pte(), and mprotect.c:change_pte_range()
> 
> The latter could definitely explain the behavior you are seeing on
> ppc64.

Indeed. Sorry, didn't have a chance to test myself yet here, but that's
definitely a bad one. Note that some of those functions use an address +
base (which would work, I suspect that was a later fix to the ones that
do pte_alloc etc...) and some use yet another scheme where the proper
address is passed along (the ones precalculating "next"). I prefer the
later version.

That's just another argument for having all these sharing common code,
even if it's a bit bulky macro at first, the current state of affairs is
just too prone to fail in weird ways.

Ben.

  parent reply	other threads:[~2005-02-27  9:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-24  4:07 [PATCH] set_pte() part 2 arch usage David S. Miller
2005-02-24  5:18 ` Benjamin Herrenschmidt
2005-02-24 22:36   ` David S. Miller
2005-02-25  5:32     ` Benjamin Herrenschmidt
2005-02-25  7:20       ` Benjamin Herrenschmidt
2005-02-25  7:57         ` David S. Miller
2005-02-25 18:37         ` David S. Miller
2005-02-26  0:56           ` Benjamin Herrenschmidt
2005-02-27  3:09             ` David S. Miller
2005-02-27  5:19               ` David S. Miller
2005-03-01  1:45                 ` Benjamin Herrenschmidt
2005-03-01 23:02                   ` David S. Miller
2005-03-01  2:22                 ` Benjamin Herrenschmidt
2005-03-01 23:32                   ` David S. Miller
2005-02-27  9:35               ` Benjamin Herrenschmidt [this message]
2005-02-28  4:14                 ` David S. Miller

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=1109496957.14992.196.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.