All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Rafael David Tinoco <rafael.tinoco@linaro.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	gorcunov@gmail.com, linux-kselftest@vger.kernel.org,
	shuah@kernel.org
Subject: Re: [PATCH] proc: fixup map_files test on arm
Date: Mon, 12 Nov 2018 17:14:57 +0300	[thread overview]
Message-ID: <20181112141456.GA15690@avx2> (raw)
In-Reply-To: <1541904527.857883.1572718104.2AE8D0DA@webmail.messagingengine.com>

On Sun, Nov 11, 2018 at 12:48:47AM -0200, Rafael David Tinoco wrote:
> Including Shuah and kselftest list...
> 
> On Sat, Nov 10, 2018, at 4:49 PM, Alexey Dobriyan wrote:
> > https://bugs.linaro.org/show_bug.cgi?id=3782
> > 
> > Turns out arm doesn't allow to map address 0, so try minimum virtual
> > address instead.
> > 
> > Reported-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> > ---
> > 
> >  tools/testing/selftests/proc/proc-self-map-files-002.c |    9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > --- a/tools/testing/selftests/proc/proc-self-map-files-002.c
> > +++ b/tools/testing/selftests/proc/proc-self-map-files-002.c
> > @@ -13,7 +13,7 @@
> >   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 
> > OF
> >   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> >   */
> > -/* Test readlink /proc/self/map_files/... with address 0. */
> > +/* Test readlink /proc/self/map_files/... with minimum address. */
> >  #include <errno.h>
> >  #include <sys/types.h>
> >  #include <sys/stat.h>
> > @@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, 
> > unsigned long b)
> >  int main(void)
> >  {
> >  	const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
> > +#ifdef __arm__
> > +	unsigned long va = 2 * PAGE_SIZE;
> > +#else
> > +	unsigned long va = 0;
> > +#endif
> >  	void *p;
> >  	int fd;
> >  	unsigned long a, b;
> > @@ -55,7 +60,7 @@ int main(void)
> >  	if (fd == -1)
> >  		return 1;
> >  
> > -	p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> > +	p = mmap(va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> >  	if (p == MAP_FAILED) {
> >  		if (errno == EPERM)
> >  			return 2;
> 
> I have sent a patch removing proc-self-map-files-002 AND making 001 to use as a
> HINT for mmap (MAP_FIXED) *at least*  *(2 * PAGE_SIZE), which would, likely,
> attend all  architectures, avoiding trying to make the test specific to one,
> and, still, test the symlinks for issues (like bad chars, spaces, so on).

If the goal is to test the lowest address then going for 2*PAGE_SIZE is
a mistake.

Which BTW hints to add a test for the highest address.

> Both tests (001 and 002) have pretty much the same code, while they could have 2
> tests in a single code, using kselftest framework. Is NULL hint + MAP_FIXED
> something imperative for this test ? Why not to have all in a single test ?

I dislike tests which lump everything together into one process.

> Are you keeping the NULL hint just to test mmap, apart" from the core of
> this test ?

WARNING: multiple messages have this Message-ID
From: adobriyan at gmail.com (Alexey Dobriyan)
Subject: [PATCH] proc: fixup map_files test on arm
Date: Mon, 12 Nov 2018 17:14:57 +0300	[thread overview]
Message-ID: <20181112141456.GA15690@avx2> (raw)
In-Reply-To: <1541904527.857883.1572718104.2AE8D0DA@webmail.messagingengine.com>

On Sun, Nov 11, 2018 at 12:48:47AM -0200, Rafael David Tinoco wrote:
> Including Shuah and kselftest list...
> 
> On Sat, Nov 10, 2018, at 4:49 PM, Alexey Dobriyan wrote:
> > https://bugs.linaro.org/show_bug.cgi?id=3782
> > 
> > Turns out arm doesn't allow to map address 0, so try minimum virtual
> > address instead.
> > 
> > Reported-by: Rafael David Tinoco <rafael.tinoco at linaro.org>
> > Signed-off-by: Alexey Dobriyan <adobriyan at gmail.com>
> > ---
> > 
> >  tools/testing/selftests/proc/proc-self-map-files-002.c |    9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > --- a/tools/testing/selftests/proc/proc-self-map-files-002.c
> > +++ b/tools/testing/selftests/proc/proc-self-map-files-002.c
> > @@ -13,7 +13,7 @@
> >   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 
> > OF
> >   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> >   */
> > -/* Test readlink /proc/self/map_files/... with address 0. */
> > +/* Test readlink /proc/self/map_files/... with minimum address. */
> >  #include <errno.h>
> >  #include <sys/types.h>
> >  #include <sys/stat.h>
> > @@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, 
> > unsigned long b)
> >  int main(void)
> >  {
> >  	const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
> > +#ifdef __arm__
> > +	unsigned long va = 2 * PAGE_SIZE;
> > +#else
> > +	unsigned long va = 0;
> > +#endif
> >  	void *p;
> >  	int fd;
> >  	unsigned long a, b;
> > @@ -55,7 +60,7 @@ int main(void)
> >  	if (fd == -1)
> >  		return 1;
> >  
> > -	p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> > +	p = mmap(va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> >  	if (p == MAP_FAILED) {
> >  		if (errno == EPERM)
> >  			return 2;
> 
> I have sent a patch removing proc-self-map-files-002 AND making 001 to use as a
> HINT for mmap (MAP_FIXED) *at least*  *(2 * PAGE_SIZE), which would, likely,
> attend all  architectures, avoiding trying to make the test specific to one,
> and, still, test the symlinks for issues (like bad chars, spaces, so on).

If the goal is to test the lowest address then going for 2*PAGE_SIZE is
a mistake.

Which BTW hints to add a test for the highest address.

> Both tests (001 and 002) have pretty much the same code, while they could have 2
> tests in a single code, using kselftest framework. Is NULL hint + MAP_FIXED
> something imperative for this test ? Why not to have all in a single test ?

I dislike tests which lump everything together into one process.

> Are you keeping the NULL hint just to test mmap, apart" from the core of
> this test ?

WARNING: multiple messages have this Message-ID
From: adobriyan@gmail.com (Alexey Dobriyan)
Subject: [PATCH] proc: fixup map_files test on arm
Date: Mon, 12 Nov 2018 17:14:57 +0300	[thread overview]
Message-ID: <20181112141456.GA15690@avx2> (raw)
Message-ID: <20181112141457.9idzsJEu491NYLijGhKx8vGlVrrm58_Q5frV8be8q4o@z> (raw)
In-Reply-To: <1541904527.857883.1572718104.2AE8D0DA@webmail.messagingengine.com>

On Sun, Nov 11, 2018@12:48:47AM -0200, Rafael David Tinoco wrote:
> Including Shuah and kselftest list...
> 
> On Sat, Nov 10, 2018,@4:49 PM, Alexey Dobriyan wrote:
> > https://bugs.linaro.org/show_bug.cgi?id=3782
> > 
> > Turns out arm doesn't allow to map address 0, so try minimum virtual
> > address instead.
> > 
> > Reported-by: Rafael David Tinoco <rafael.tinoco at linaro.org>
> > Signed-off-by: Alexey Dobriyan <adobriyan at gmail.com>
> > ---
> > 
> >  tools/testing/selftests/proc/proc-self-map-files-002.c |    9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > --- a/tools/testing/selftests/proc/proc-self-map-files-002.c
> > +++ b/tools/testing/selftests/proc/proc-self-map-files-002.c
> > @@ -13,7 +13,7 @@
> >   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 
> > OF
> >   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> >   */
> > -/* Test readlink /proc/self/map_files/... with address 0. */
> > +/* Test readlink /proc/self/map_files/... with minimum address. */
> >  #include <errno.h>
> >  #include <sys/types.h>
> >  #include <sys/stat.h>
> > @@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, 
> > unsigned long b)
> >  int main(void)
> >  {
> >  	const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
> > +#ifdef __arm__
> > +	unsigned long va = 2 * PAGE_SIZE;
> > +#else
> > +	unsigned long va = 0;
> > +#endif
> >  	void *p;
> >  	int fd;
> >  	unsigned long a, b;
> > @@ -55,7 +60,7 @@ int main(void)
> >  	if (fd == -1)
> >  		return 1;
> >  
> > -	p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> > +	p = mmap(va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
> >  	if (p == MAP_FAILED) {
> >  		if (errno == EPERM)
> >  			return 2;
> 
> I have sent a patch removing proc-self-map-files-002 AND making 001 to use as a
> HINT for mmap (MAP_FIXED) *at least*  *(2 * PAGE_SIZE), which would, likely,
> attend all  architectures, avoiding trying to make the test specific to one,
> and, still, test the symlinks for issues (like bad chars, spaces, so on).

If the goal is to test the lowest address then going for 2*PAGE_SIZE is
a mistake.

Which BTW hints to add a test for the highest address.

> Both tests (001 and 002) have pretty much the same code, while they could have 2
> tests in a single code, using kselftest framework. Is NULL hint + MAP_FIXED
> something imperative for this test ? Why not to have all in a single test ?

I dislike tests which lump everything together into one process.

> Are you keeping the NULL hint just to test mmap, apart" from the core of
> this test ?

  reply	other threads:[~2018-11-12 14:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-10 18:49 Alexey Dobriyan
2018-11-11  2:48 ` Rafael David Tinoco
2018-11-11  2:48   ` Rafael David Tinoco
2018-11-11  2:48   ` rafael.tinoco
2018-11-12 14:14   ` Alexey Dobriyan [this message]
2018-11-12 14:14     ` Alexey Dobriyan
2018-11-12 14:14     ` adobriyan
2018-11-12 15:55     ` Cyrill Gorcunov
2018-11-12 15:55       ` Cyrill Gorcunov
2018-11-12 15:55       ` gorcunov
2018-11-12 16:35       ` Rafael David Tinoco
2018-11-12 16:35         ` Rafael David Tinoco
2018-11-12 16:35         ` rafael.tinoco
2018-11-13 16:54         ` [PATCH v2] " Alexey Dobriyan
2018-11-13 16:54           ` Alexey Dobriyan
2018-11-13 16:54           ` adobriyan
2018-11-13 17:01           ` Cyrill Gorcunov
2018-11-13 17:01             ` Cyrill Gorcunov
2018-11-13 17:01             ` gorcunov

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=20181112141456.GA15690@avx2 \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rafael.tinoco@linaro.org \
    --cc=shuah@kernel.org \
    --subject='Re: [PATCH] proc: fixup map_files test on arm' \
    /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

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.