public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Mike Frysinger <vapier@gentoo.org>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] syscalls/getrusage03: flush stdout to avoid duplicated output
Date: Thu, 19 Jan 2012 18:43:55 +0100	[thread overview]
Message-ID: <20120119174355.GF10302@saboteur.suse.cz> (raw)
In-Reply-To: <201201181139.19497.vapier@gentoo.org>

Hi!
> > > > I don't like idea of defining fork to tst_fork that's exactly the
> > > > magic that may take hours to figure out.
> > > > 
> > > > Forcing it, in this case, is probably good idea.
> > > 
> > > tst_fork() would be the route i'd prefer to go, and i think since we
> > > already take pains in this area to support NOMMU, it isn't an additional
> > > burden.
> > 
> > Hmm, maybe we could get rid of the FORK_OR_VFORK macro and use
> > tst_fork() to cover both flusing and no NOMMU target. That actually
> > looks like good way to go. So let's fix this that way.
> 
> my concern with this is that by having "vfork" in the name people know they 
> need to be aware of the vfork semantics.  there are places where vfork/fork 
> are interchangeable (and hence we use FORK_OR_VFORK).  but there are places 
> where they are not, and so we end up doing one of two things:
> 	- rewrite it to use FORK_OR_VFORK and self_exec
> 	- disable the test altogether

Ah, I see, so vfork() doesn't do the copy on write thing with program
memory. Hmm and it makes sense to use vfork() on non-mmu system as you
can't implement copy on write approach there. I think I'm starting to
uderstand this works.

> so i don't think we want to blindly have everyone get "fork or vfork" 
> semantics.  the current methodology allows for mmu devs to contribute tests 
> without worrying about these issues.  then the non-mmu peeps notice the new 
> tests (because they get build failures due to fork() not being defined), and 
> they get to go in and review each test to see what's needed.

Okay, that makes sense.

> certainly the existing FORK_OR_VFORK/self_exec api could do with a minor 
> cleanup and unification.  i think the reason we have it do vfork+self-exec on 
> nommu but fork on mmu is to keep things simpler for the main dev base, but i 
> wouldn't be opposed to just always having tsts do vfork+self-exec so as to 
> reduce the #ifdef ugliness in tests.

I will meditate about that (I do not fully understand how exactly is
maybe_run_child() and self_exec() working yet).

> > > does that happen ?  POSIX guarantees printf() and friends to be
> > > multithreaded safe, so no lines would be inter-mingled, and they're
> > > sharing the same FILE*, so i wouldn't see adding a fflush() making a
> > > difference.
> > 
> > Looked at the code and there is yet another reason for this, the
> > printing is done with more than one printf(), so rarely the lines could
> > get intermixed. I'll fix that.
> 
> that would be good ... i think even if we had flushing, the multi-thread issue 
> would still be there because of what you've found.

I've just commited fix for this one. But there are some more problems,
global buffer for composing warning messages for example, which is not
likely to cause trouble as you would need to use the tst interface
incorrectly from more threads at once, but still that could happen.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2012-01-19 17:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-10  3:38 [LTP] [PATCH] syscalls/getrusage03: flush stdout to avoid duplicated output Caspar Zhang
2012-01-10  3:40 ` Caspar Zhang
2012-01-10  3:43   ` Wanlong Gao
2012-01-11 12:20   ` Cyril Hrubis
2012-01-11 12:41   ` Jan Stancek
2012-01-11 12:56     ` Cyril Hrubis
     [not found]       ` <aa1139e7-47d6-40d4-8406-4cef27343f29@zmail16.collab.prod.int.phx2.redhat.com>
2012-01-11 14:34         ` Cyril Hrubis
     [not found]           ` <201201130101.06630.vapier@gentoo.org>
2012-01-13 13:07             ` Cyril Hrubis
     [not found]               ` <201201131216.03211.vapier@gentoo.org>
2012-01-18 16:17                 ` Cyril Hrubis
     [not found]                   ` <201201181139.19497.vapier@gentoo.org>
2012-01-19 17:43                     ` Cyril Hrubis [this message]
     [not found]                       ` <201201191334.47413.vapier@gentoo.org>
2012-01-20 14:37                         ` Cyril Hrubis
2012-01-13  5:43 ` Mike Frysinger

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=20120119174355.GF10302@saboteur.suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=vapier@gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox