linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: mikey@neuling.org, anton@samba.org
Subject: Re: [V2, 06/12] selftests, powerpc: Add test for system wide DSCR default
Date: Thu, 09 Apr 2015 18:08:11 +0530	[thread overview]
Message-ID: <552672B3.9060700@linux.vnet.ibm.com> (raw)
In-Reply-To: <552654E7.9050906@linux.vnet.ibm.com>

On 04/09/2015 04:01 PM, Anshuman Khandual wrote:
> On 03/27/2015 05:31 PM, Michael Ellerman wrote:
>> On Tue, 2015-13-01 at 10:22:34 UTC, Anshuman Khandual wrote:
>>> This patch adds a test case for the system wide DSCR default
>>> value, which when changed through it's sysfs interface must
>>> be visible to all threads reading DSCR either through the
>>> privilege state SPR or the problem state SPR. The DSCR value
>>> change should be immediate as well.
>>
>> ...
>>
>>> +
>>> +/* Default DSCR access */
>>> +unsigned long get_default_dscr(void)
>>> +{
>>> +	int fd = -1;
>>> +	char buf[16];
>>> +	unsigned long val;
>>> +
>>> +	if (fd == -1) {
>>> +		fd = open(DSCR_DEFAULT, O_RDONLY);
>>> +		if (fd == -1) {
>>> +			perror("open() failed\n");
>>> +			exit(1);
>>> +		}
>>> +	}
>>> +	memset(buf, 0, sizeof(buf));
>>> +	lseek(fd, 0, SEEK_SET);
>>> +	read(fd, buf, sizeof(buf));
>>
> 
> Normally, I build the test cases like
> 
> $cd tools/testing/selftests/powerpc/
> $make dscr
> 
> with these compiler flags "-Wall -O2 -flto -Wall -Werror" which
> is still working for me. Then I figured out that the read and
> write declaration in unistd.h header file has "_wur" in it.
> 
> extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur;
> extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur;
> 
> Then some how the compiler (GCC 4.8.3) is not complaining about it.
> 
>>
>> This and the other tests are failing to build:
>>
>>     In file included from dscr_default_test.c:16:0:
>>     dscr.h: In function ‘get_default_dscr’:
>>     dscr.h:93:6: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result]
>>       read(fd, buf, sizeof(buf));
>>           ^
>>     dscr.h: In function ‘set_default_dscr’:
>>     dscr.h:112:7: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
>>       write(fd, buf, strlen(buf));
>>            ^
>>     cc1: all warnings being treated as errors
> 
> Anyways, I can change the header file helper functions if you would like.
> BTW, the patch series does not apply as it is and requires rebasing. Would
> send out a new version of it.

The rebased patch series works as expected like this version and all the tests
pass. I would add a  .gitignore file for this new test directory. Please let me
know if there are other changes which need to be done. Thanks !!

  reply	other threads:[~2015-04-09 12:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 10:22 [PATCH V2 00/12] POWER DSCR fixes, improvements, docs and tests Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 01/12] powerpc: Fix handling of DSCR related facility unavailable exception Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 02/12] powerpc, process: Remove the unused extern dscr_default Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 03/12] powerpc, offset: Change PACA_DSCR to PACA_DSCR_DEFAULT Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 04/12] powerpc, dscr: Added some in-code documentation Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 05/12] documentation, powerpc: Add documentation for DSCR support Anshuman Khandual
2015-01-13 10:22 ` [PATCH V2 06/12] selftests, powerpc: Add test for system wide DSCR default Anshuman Khandual
2015-01-13 15:22   ` Shuah Khan
2015-01-13 23:44     ` Michael Ellerman
2015-01-20 21:40       ` Dave Jones
2015-01-21  6:51         ` Michael Ellerman
2015-03-27 12:01   ` [V2, " Michael Ellerman
2015-04-09 10:31     ` Anshuman Khandual
2015-04-09 12:38       ` Anshuman Khandual [this message]
2015-01-13 10:22 ` [PATCH V2 07/12] selftests, powerpc: Add test for explicitly changing DSCR value Anshuman Khandual
2015-01-13 15:23   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 08/12] selftests, powerpc: Add test for DSCR SPR numbers Anshuman Khandual
2015-01-13 15:23   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 09/12] selftests, powerpc: Add test for DSCR value inheritence across fork Anshuman Khandual
2015-01-13 15:24   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 10/12] selftests, powerpc: Add test for DSCR inheritence across fork & exec Anshuman Khandual
2015-01-13 15:24   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 11/12] selftests, powerpc: Add test for all DSCR sysfs interfaces Anshuman Khandual
2015-01-13 15:24   ` Shuah Khan
2015-01-13 10:22 ` [PATCH V2 12/12] selftests, powerpc: Add thread based stress test for " Anshuman Khandual
2015-01-13 15:24   ` Shuah Khan
2015-02-04  8:21 ` [PATCH V2 00/12] POWER DSCR fixes, improvements, docs and tests Anshuman Khandual
2015-02-04  8:36   ` Anshuman Khandual

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=552672B3.9060700@linux.vnet.ibm.com \
    --to=khandual@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    /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).