From: Arnd Bergmann <arnd@arndb.de>
To: michal.simek@petalogix.com
Cc: LTP <ltp-list@lists.sourceforge.net>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Grant Likely <grant.likely@secretlab.ca>,
Paul Mundt <lethal@linux-sh.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
John Williams <john.williams@petalogix.com>
Subject: Re: [LTP] mmap syscall problem
Date: Mon, 6 Jul 2009 16:16:11 +0200 [thread overview]
Message-ID: <200907061616.12220.arnd@arndb.de> (raw)
In-Reply-To: <4A51F3F3.6040501@petalogix.com>
On Monday 06 July 2009, Michal Simek wrote:
>
> > Not necessarily, even on platforms that manage aliases in hardware
> > mappings that violate the aliasing constraints can still result in
> > undefined behaviour, this really depends more on your cache controller
> > and MMU than anything else. I notice that microblaze sets SHMLBA to
> > PAGE_SIZE, you may want to see if this test still breaks after bumping it
> > up to something like PAGE_SIZE * 4.
> >
> Yes, test still break - behavior is the same. I don't have accurate
> information about MMU unit
> but I will ask a question about. We are able to turn off cache
> controller directly in HW.
There may still be a problem with data being queued in some write
buffers that don't get flushed before reading back from another
address.
What happens in a simple user space program that mmaps the same
page to two addresses? Something like
#include <sys/mman.h>
#include <fcntl.h>
int main(void)
{
int fd = open("existing-4k-file", O_RDWR);
char *p1 = mmap(0, 4096, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
char *p2 = mmap(p1 + 4096, 4096, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED, fd, 0);
*p1 = 0xaa; *p2 = 0x55;
return *p1; /* returns 0xaa if broken, 0x55 if correct */
}
Arnd <><
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: michal.simek@petalogix.com
Cc: Paul Mundt <lethal@linux-sh.org>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
LTP <ltp-list@lists.sourceforge.net>,
John Williams <john.williams@petalogix.com>,
Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Grant Likely <grant.likely@secretlab.ca>,
subrata@linux.vnet.ibm.com
Subject: Re: mmap syscall problem
Date: Mon, 6 Jul 2009 16:16:11 +0200 [thread overview]
Message-ID: <200907061616.12220.arnd@arndb.de> (raw)
In-Reply-To: <4A51F3F3.6040501@petalogix.com>
On Monday 06 July 2009, Michal Simek wrote:
>
> > Not necessarily, even on platforms that manage aliases in hardware
> > mappings that violate the aliasing constraints can still result in
> > undefined behaviour, this really depends more on your cache controller
> > and MMU than anything else. I notice that microblaze sets SHMLBA to
> > PAGE_SIZE, you may want to see if this test still breaks after bumping it
> > up to something like PAGE_SIZE * 4.
> >
> Yes, test still break - behavior is the same. I don't have accurate
> information about MMU unit
> but I will ask a question about. We are able to turn off cache
> controller directly in HW.
There may still be a problem with data being queued in some write
buffers that don't get flushed before reading back from another
address.
What happens in a simple user space program that mmaps the same
page to two addresses? Something like
#include <sys/mman.h>
#include <fcntl.h>
int main(void)
{
int fd = open("existing-4k-file", O_RDWR);
char *p1 = mmap(0, 4096, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
char *p2 = mmap(p1 + 4096, 4096, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED, fd, 0);
*p1 = 0xaa; *p2 = 0x55;
return *p1; /* returns 0xaa if broken, 0x55 if correct */
}
Arnd <><
next prev parent reply other threads:[~2009-07-06 14:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-03 12:37 [LTP] mmap syscall problem Michal Simek
2009-07-03 12:37 ` Michal Simek
2009-07-03 15:02 ` [LTP] " Arnd Bergmann
2009-07-03 15:02 ` Arnd Bergmann
2009-07-06 6:32 ` [LTP] " Michal Simek
2009-07-06 6:32 ` Michal Simek
2009-07-06 8:05 ` [LTP] " Arnd Bergmann
2009-07-06 8:05 ` Arnd Bergmann
2009-07-06 12:07 ` [LTP] " Michal Simek
2009-07-06 12:07 ` Michal Simek
2009-07-06 12:14 ` [LTP] " Paul Mundt
2009-07-06 12:14 ` Paul Mundt
2009-07-06 12:54 ` [LTP] " Michal Simek
2009-07-06 12:54 ` Michal Simek
2009-07-06 14:16 ` Arnd Bergmann [this message]
2009-07-06 14:16 ` Arnd Bergmann
2009-07-06 14:43 ` [LTP] " Michal Simek
2009-07-06 14:43 ` Michal Simek
2009-07-06 15:05 ` [LTP] " Arnd Bergmann
2009-07-06 15:05 ` Arnd Bergmann
2009-07-06 15:19 ` [LTP] " Michal Simek
2009-07-06 15:19 ` Michal Simek
2009-07-07 0:44 ` [LTP] " Valdis.Kletnieks
2009-07-07 0:44 ` Valdis.Kletnieks
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=200907061616.12220.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=grant.likely@secretlab.ca \
--cc=john.williams@petalogix.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltp-list@lists.sourceforge.net \
--cc=michal.simek@petalogix.com \
--cc=mingo@elte.hu \
/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.