public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] open_posix_testsuite: Don't use clock_settime() to reset a CPU-time Clock
Date: Mon, 08 Nov 2010 14:20:45 +0800	[thread overview]
Message-ID: <4CD796BD.6050303@cn.fujitsu.com> (raw)
In-Reply-To: <AANLkTikkEAuO5jPXExneKC7OHbOViTErs_Fu_XasYma4@mail.gmail.com>

Garrett Cooper wrote:
> On Sun, Nov 7, 2010 at 8:09 PM, Gui Jianfeng <guijianfeng@cn.fujitsu.com> wrote:
>> Gui Jianfeng wrote:
>>> This case is trying to set CPU-time clock(ID is returned by clock_getcpuclockid()) of
>>> a specific process by calling clock_settime(). But Linux kernel doesn't allow to reset
>>> a CPU-time clock of a specific process. Kernel returns -EPERM. So test fails.
>>>
>>> In "IEEE Std 1003.1, 2004 Edition", It's said as following:
>>> If _POSIX_CPUTIME is defined, implementations shall support clock ID values obtained by
>>> invoking clock_getcpuclockid(), which represent the CPU-time clock of a given process.
>>> Implementations shall also support the special clockid_t value CLOCK_PROCESS_CPUTIME_ID,
>>> which represents the CPU-time clock of the calling process when invoking one of the
>>> clock_*() or timer_*() functions. For these clock IDs, the values returned by
>>> clock_gettime() and specified by clock_settime() represent the amount of execution time
>>> of the process associated with the clock. Changing the value of a CPU-time clock via
>>> clock_settime() shall have no effect on the behavior of the sporadic server scheduling
>>> policy.
>>>
>>> So the behaviour when changing the value of a CPU-time clock via clock_settime() is
>>> operating system specific.
>>>
>>> We may change the test progress to stop using clock_settime(). Now, We just make use
>>> of clock_gettime() instead to achieve the same test purpose.
>>>
>>> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
>> Hi Garrett,
>>
>> How do you think this fix?
> 
> The tort is the same in POSIX 2008.1. Taking out the chaff...
> 
> a. If _POSIX_CPUTIME is defined, implementations shall support clock
> ID values obtained by invoking clock_getcpuclockid(), which represent
> the CPU-time clock of a given process.
> b. Implementations shall also support the special clockid_t value
> CLOCK_PROCESS_CPUTIME_ID, which represents the CPU-time clock of the
> calling process when invoking one of the clock_*() or timer_*()
> functions.
> c. For these clock IDs, the values returned by clock_gettime() and
> specified by clock_settime() represent the amount of execution time of
> the process associated with the clock.
> 
> Nowhere does it say that you can't set that clock. Try running the
> test as root to see what you can do... if the test fails (even as
> root), then Linux needs to be fixed to conform to POSIX.

POSIX also says that:
  Changing the value of a CPU-time clock via clock_settime() shall have no effect 
  on the behavior of the sporadic server scheduling policy.

IMHO, this means clock_settime() implementation is OS specific, is it?
So, even if Linux fails to set this clock, it's just fine. Am i missing something?

Gui

> 
> Also, try running the other tests I just added to see whether or not
> the function call fails per POSIX's requirements.
> 
> Thanks!
> -Garrett
> 

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2010-11-08  6:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29  2:39 [LTP] [PATCH] open_posix_testsuite: Don't use clock_settime() to reset a CPU-time Clock Gui Jianfeng
2010-11-08  4:09 ` Gui Jianfeng
2010-11-08  6:02   ` Garrett Cooper
2010-11-08  6:20     ` Gui Jianfeng [this message]
2010-11-15  3:20       ` Gui Jianfeng
2010-11-18 20:29     ` Cyril Hrubis
     [not found]       ` <AANLkTimz2WBPfwCBHajqzA7Uk_72MZeTJdWB0Zbkch8B@mail.gmail.com>
     [not found]         ` <AANLkTi=YvMBmUQLSmtq8aM0+s2-X3BmRM13fSUa6a1-1@mail.gmail.com>
     [not found]           ` <4CF4CCD7.3060009@cn.fujitsu.com>
2010-12-02 12:13             ` Cyril Hrubis
2010-12-30 16:50               ` Cyril Hrubis
2011-02-24  6:21 ` Gui Jianfeng
2011-02-25 14:50   ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2010-12-02  0:29 [LTP] [PATCH] open_posix_testsuite: Don\'t " Mitani

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=4CD796BD.6050303@cn.fujitsu.com \
    --to=guijianfeng@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=yanegomi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox