All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: David Rientjes <rientjes@google.com>
Cc: Nai Xia <nai.xia@gmail.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Hugh Dickins <hughd@google.com>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Paul Mundt <lethal@linux-sh.org>
Subject: Re: mm: convert vma->vm_flags to 64bit
Date: Fri, 11 Nov 2011 08:52:39 +0000	[thread overview]
Message-ID: <20111111085239.GA12913@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <alpine.DEB.2.00.1111092048520.27280@chino.kir.corp.google.com>

On Wed, Nov 09, 2011 at 08:49:58PM -0800, David Rientjes wrote:
> On Thu, 10 Nov 2011, Nai Xia wrote:
> 
> > Did this patch get merged at last, or on this way being merged, or
> > just dropped ?
> > 
> 
> I thought we were waiting to find out if it caused a problem on arm.  
> Either Russell should be able to clarify that or a couple months in 
> linux-next.

As I said last time, these flags are passed into assembly on ARM.  For
example, we pass a pointer to the VMA, and the assembly code them loads
the vma flags to check whether VM_EXEC is set, so it knows whether it
needs to flush the instruction TLB.

Making this a 64-bit quantity then means we have to deal with the host
endian issues and the position of the VM_EXEC bit inside that 64-bit
quantity.  Remembering that ARM is 32-bit, that needs additional
complexity to sort out, something like:

#ifdef __ARMEB__
#define VM_FLAGS_LOWWORD	4
#else
#define VM_FLAGS_LOWWORD	0
#endif

#if VM_EXEC >= 1<<32
#define VM_FLAG_EXEC		(VM_EXEC >> 32)
#define VM_FLAG_EXECWORD	4
#else
#define VM_FLAG_EXEC		VM_EXEC
#define VM_FLAG_EXECWORD	0
#endif

	ldr	rd, [rn, #VMA_VM_FLAGS + (VM_FLAGS_LOWWORD ^ VM_FLAG_EXECWORD)]
...
	tst	rd, #VM_FLAG_EXEC

which is not only rather horrible, but I also wonder whether VM_EXEC >> 32
will provide the right answer with a binutils targetting 32-bit.

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: David Rientjes <rientjes@google.com>
Cc: Nai Xia <nai.xia@gmail.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Hugh Dickins <hughd@google.com>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Paul Mundt <lethal@linux-sh.org>
Subject: Re: mm: convert vma->vm_flags to 64bit
Date: Fri, 11 Nov 2011 08:52:39 +0000	[thread overview]
Message-ID: <20111111085239.GA12913@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <alpine.DEB.2.00.1111092048520.27280@chino.kir.corp.google.com>

On Wed, Nov 09, 2011 at 08:49:58PM -0800, David Rientjes wrote:
> On Thu, 10 Nov 2011, Nai Xia wrote:
> 
> > Did this patch get merged at last, or on this way being merged, or
> > just dropped ?
> > 
> 
> I thought we were waiting to find out if it caused a problem on arm.  
> Either Russell should be able to clarify that or a couple months in 
> linux-next.

As I said last time, these flags are passed into assembly on ARM.  For
example, we pass a pointer to the VMA, and the assembly code them loads
the vma flags to check whether VM_EXEC is set, so it knows whether it
needs to flush the instruction TLB.

Making this a 64-bit quantity then means we have to deal with the host
endian issues and the position of the VM_EXEC bit inside that 64-bit
quantity.  Remembering that ARM is 32-bit, that needs additional
complexity to sort out, something like:

#ifdef __ARMEB__
#define VM_FLAGS_LOWWORD	4
#else
#define VM_FLAGS_LOWWORD	0
#endif

#if VM_EXEC >= 1<<32
#define VM_FLAG_EXEC		(VM_EXEC >> 32)
#define VM_FLAG_EXECWORD	4
#else
#define VM_FLAG_EXEC		VM_EXEC
#define VM_FLAG_EXECWORD	0
#endif

	ldr	rd, [rn, #VMA_VM_FLAGS + (VM_FLAGS_LOWWORD ^ VM_FLAG_EXECWORD)]
...
	tst	rd, #VM_FLAG_EXEC

which is not only rather horrible, but I also wonder whether VM_EXEC >> 32
will provide the right answer with a binutils targetting 32-bit.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-11-11  8:52 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12  6:10 mm: convert vma->vm_flags to 64bit KOSAKI Motohiro
2011-04-12  6:10 ` KOSAKI Motohiro
2011-04-12  6:33 ` Andrew Morton
2011-04-12  6:33   ` Andrew Morton
2011-04-12  7:12   ` KOSAKI Motohiro
2011-04-12  7:12     ` KOSAKI Motohiro
2011-04-12 11:06     ` Alexey Dobriyan
2011-04-12 11:06       ` Alexey Dobriyan
2011-04-12 11:11       ` Alexey Dobriyan
2011-04-12 11:11         ` Alexey Dobriyan
2011-04-12 22:07       ` Benjamin Herrenschmidt
2011-04-12 22:07         ` Benjamin Herrenschmidt
2011-04-13  0:13         ` KOSAKI Motohiro
2011-04-13  0:13           ` KOSAKI Motohiro
2011-04-13  6:44           ` Alexey Dobriyan
2011-04-13  6:44             ` Alexey Dobriyan
2011-04-13  7:00             ` Benjamin Herrenschmidt
2011-04-13  7:00               ` Benjamin Herrenschmidt
2011-04-13  7:29               ` Russell King - ARM Linux
2011-04-13  7:29                 ` Russell King - ARM Linux
2011-04-13  8:56                 ` Benjamin Herrenschmidt
2011-04-13  8:56                   ` Benjamin Herrenschmidt
2011-04-13  8:34               ` KOSAKI Motohiro
2011-04-13  8:34                 ` KOSAKI Motohiro
2011-04-13  7:04             ` KOSAKI Motohiro
2011-04-13  7:04               ` KOSAKI Motohiro
2011-04-12 23:41       ` KOSAKI Motohiro
2011-04-12 23:41         ` KOSAKI Motohiro
2011-04-13  2:19         ` [PATCH 1/3] mm: add __nocast attribute to vm_flags KOSAKI Motohiro
2011-04-13  2:19           ` KOSAKI Motohiro
2011-04-13  2:20           ` [PATCH 2/3] fremap: convert vm_flags to unsigned long long KOSAKI Motohiro
2011-04-13  2:20             ` KOSAKI Motohiro
2011-04-13  2:21           ` [PATCH 3/3] procfs: " KOSAKI Motohiro
2011-04-13  2:21             ` KOSAKI Motohiro
2011-04-12 20:30   ` mm: convert vma->vm_flags to 64bit Russell King - ARM Linux
2011-04-12 20:30     ` Russell King - ARM Linux
2011-04-18  0:26 ` Hugh Dickins
2011-04-18  0:26   ` Hugh Dickins
2011-04-18  1:21   ` KOSAKI Motohiro
2011-04-18  1:21     ` KOSAKI Motohiro
2011-04-18  1:45   ` Benjamin Herrenschmidt
2011-04-18  1:45     ` Benjamin Herrenschmidt
2011-04-18  3:34     ` KOSAKI Motohiro
2011-04-18  3:34       ` KOSAKI Motohiro
2011-11-10  4:09 ` Nai Xia
2011-11-10  4:09   ` Nai Xia
2011-11-10  4:49   ` David Rientjes
2011-11-10  4:49     ` David Rientjes
2011-11-11  8:52     ` Russell King - ARM Linux [this message]
2011-11-11  8:52       ` Russell King - ARM Linux
2011-11-10 17:22   ` KOSAKI Motohiro
2011-11-10 17:22     ` KOSAKI Motohiro
2011-11-10 21:12     ` Benjamin Herrenschmidt
2011-11-10 21:12       ` Benjamin Herrenschmidt
2011-11-10 21:49       ` KOSAKI Motohiro
2011-11-10 21:49         ` KOSAKI Motohiro
2011-11-11  8:42         ` Russell King - ARM Linux
2011-11-11  8:42           ` Russell King - ARM Linux
2011-11-11  2:09       ` Hugh Dickins
2011-11-11  2:09         ` Hugh Dickins
2011-11-11  4:31         ` Benjamin Herrenschmidt
2011-11-11  4:31           ` Benjamin Herrenschmidt
2011-11-11  8:38           ` Nai Xia
2011-11-11  8:38             ` Nai Xia

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=20111111085239.GA12913@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nai.xia@gmail.com \
    --cc=rientjes@google.com \
    /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.