Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-nvdimm@lists.01.org
Subject: Re: [PATCH] ndctl: move test/dax-errors buffer to global to avoid gcc optimization
Date: Thu, 15 Sep 2016 16:29:53 -0600	[thread overview]
Message-ID: <20160915222953.GA8887@omniknight.lm.intel.com> (raw)
In-Reply-To: <147397849629.229288.3348330822830988783.stgit@djiang5-desk3.ch.intel.com>

On 09/15, Dave Jiang wrote:
> Some gcc toolchain are optimizing out the memcpy and this causes dax-errors
> to not trigger the SIG_BUS when doing memcpy on an mmap'd buffer. By moving
> the buffer to a global variable this bypasses the optimization and allow
> the test to work as intended.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  test/dax-errors.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> diff --git a/test/dax-errors.c b/test/dax-errors.c
> index 11d0031..9ea5c91 100644
> --- a/test/dax-errors.c
> +++ b/test/dax-errors.c
> @@ -17,6 +17,8 @@
>  
>  static sigjmp_buf sj_env;
>  static int sig_count;
> +/* buf is global in order to avoid gcc memcpy optimization */
> +static void *buf;
>  
>  static void sigbus_hdl(int sig, siginfo_t *siginfo, void *ptr)
>  {
> @@ -27,7 +29,7 @@ static void sigbus_hdl(int sig, siginfo_t *siginfo, void *ptr)
>  
>  static int test_dax_read_err(int fd)
>  {
> -	void *base, *buf;
> +	void *base;
>  	int rc = 0;
>  
>  	if (fd < 0) {
> 
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2016-09-15 22:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15 22:28 [PATCH] ndctl: move test/dax-errors buffer to global to avoid gcc optimization Dave Jiang
2016-09-15 22:29 ` Vishal Verma [this message]
2016-09-16  1:18 ` Elliott, Robert (Persistent Memory)
2016-09-16 16:27   ` Dave Jiang
2016-09-16 17:24   ` Dave Jiang
2016-09-18 16:42     ` Elliott, Robert (Persistent Memory)
2016-09-19 16:45       ` Dave Jiang
2016-09-19 16:48         ` Dan Williams

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=20160915222953.GA8887@omniknight.lm.intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-nvdimm@lists.01.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