public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shan Wei <shanwei88@gmail.com>
To: Christoph Lameter <cl@linux.com>
Cc: rostedt@goodmis.org, fweisbec@gmail.com,
	Kernel-Maillist <linux-kernel@vger.kernel.org>,
	mingo@redhat.com
Subject: Re: [PATCH 8/9] trace: use this_cpu_ptr per-cpu helper
Date: Sat, 03 Nov 2012 12:51:23 +0800	[thread overview]
Message-ID: <5094A2CB.8040208@gmail.com> (raw)
In-Reply-To: <0000013ac24187fb-694b1865-baeb-4e3b-970e-50bdcd631de7-000000@email.amazonses.com>

Christoph Lameter said, at 2012/11/3 1:53:
> 
> hmm.... what is actually returned is a pointer to char right? And buffer
> is char[1024] so I guess then you need to pass a pointer to char to
> this_cpu_read.
> 
> return this_cpu_read(&(percpu_buffer->buffer))
 
still error....

kernel/trace/trace.c: In function 'get_trace_buf':
kernel/trace/trace.c:1517: error: lvalue required as unary '&' operand
kernel/trace/trace.c:1517: warning: type defaults to 'int' in declaration of 'type name'
kernel/trace/trace.c:1517: warning: cast from pointer to integer of different size
kernel/trace/trace.c:1517: warning: return from incompatible pointer type
kernel/trace/trace.c:1498: warning: unused variable 'buffer'
kernel/trace/trace.c:1517: error: memory input 1 is not directly addressable
kernel/trace/trace.c:1517: error: memory input 1 is not directly addressable

this_cpu_read just read the actual value which a pointer point to.
some case, we just need the pointer.
It's better to use this_cpu_ptr.
return (char *)this_cpu_ptr(&percpu_buffer->buffer);


  reply	other threads:[~2012-11-03  4:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 11:23 [PATCH 8/9] trace: use this_cpu_ptr per-cpu helper Shan Wei
2012-10-31 17:50 ` Christoph Lameter
2012-11-02 15:25   ` Shan Wei
2012-11-02 17:53     ` Christoph Lameter
2012-11-03  4:51       ` Shan Wei [this message]
2012-11-05 15:18         ` Christoph Lameter

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=5094A2CB.8040208@gmail.com \
    --to=shanwei88@gmail.com \
    --cc=cl@linux.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.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