linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jia He <jiakernel@gmail.com>
To: Manfred Spraul <manfred@colorfullife.com>,
	Mike Galbraith <bitbucket@online.de>
Cc: linux-kernel@vger.kernel.org,
	Davidlohr Bueso <davidlohr.bueso@hp.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] ipc/sem.c: fix update sem_otime when calling sem_op in semaphore initialization
Date: Sun, 22 Sep 2013 20:53:41 +0800	[thread overview]
Message-ID: <523EE855.1030100@gmail.com> (raw)
In-Reply-To: <523EC97D.8020707@colorfullife.com>

 

On Sun, 22 Sep 2013 12:42:05 +0200 from manfred@colorfullife.com wrote:
> Hi all,
>
> On 09/22/2013 10:26 AM, Mike Galbraith wrote:
>> On Sun, 2013-09-22 at 10:17 +0200, Mike Galbraith wrote:
>>> On Sun, 2013-09-22 at 10:11 +0800, Jia He wrote:
>>>> In commit 0a2b9d4c,the update of semaphore's sem_otime(last semop time)
>>>> was removed because he wanted to move setting sem->sem_otime to one
>>>> place. But after that, the initial semop() will not set the otime
>>>> because its sem_op value is 0(in semtimedop,will not change
>>>> otime if alter == 1).
>>>>
>>>> the error case:
>>>> process_a(server)       process_b(client)
>>>> semget()
>>>> semctl(SETVAL)
>>>> semop()
>>>>                          semget()
>>>>                          setctl(IP_STAT)
>>>>                          for(;;) {               <--not successful here
>>>>                            check until sem_otime > 0
>>>>                          }
> Good catch:
> Since commit 0a2b9d4c, wait-for-zero semops do not update sem_otime anymore.
>
> Let's reverse that part of my commit and move the update of sem_otime back
> into perform_atomic_semop().
>
> Jia: If perform_atomic_semop() updates sem_otime, then the update in
> do_smart_update() is not necessary anymore.
> Thus the whole logic with passing arround "semop_completed" can be removed, too.
> Are you interested in writing that patch?
>
With pleasure.
>
>>> Why not..
>> (pokes evolution's don't-munge-me button)
>>
>> ipc,sem: Create semaphores with plausible sem_otime.
> Mike: no, your patch makes it worse:
> - wait-for-zero semops still don't update sem_otime
> - sem_otime is initialized to sem_ctime. That's not mentioned in the sysv
> standard.
>
Agree.
> -- 
>     Manfred
>


  reply	other threads:[~2013-09-22 12:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-22  2:11 [PATCH] ipc/sem.c: fix update sem_otime when calling sem_op in semaphore initialization Jia He
2013-09-22  8:17 ` Mike Galbraith
2013-09-22  8:26   ` Mike Galbraith
2013-09-22  9:34     ` Jia He
2013-09-22 10:00       ` Mike Galbraith
2013-09-22 12:44         ` Jia He
2013-09-22 10:42     ` Manfred Spraul
2013-09-22 12:53       ` Jia He [this message]
2013-09-22 15:14       ` Jia He
2013-09-24 21:09         ` Manfred Spraul
2013-09-25  3:05           ` Jia He
2013-09-25  6:55             ` Manfred Spraul
2013-09-25  7:49               ` Jia He
2013-09-23  1:08       ` Mike Galbraith
2013-09-23  2:24         ` Jia He

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=523EE855.1030100@gmail.com \
    --to=jiakernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bitbucket@online.de \
    --cc=davidlohr.bueso@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=riel@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).