linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: sukadev@linux.vnet.ibm.com,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	ak@linux.intel.com, Jiri Olsa <jolsa@redhat.com>,
	peterz@infradead.org, eranian@google.com,
	Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org, dev@codyps.com,
	linux-kernel@vger.kernel.org,
	Michael Ellerman <michaele@au1.ibm.com>,
	Anshuman Khandual <khandual@linux.vnet.ibm.com>
Subject: Re: [v2,2/4] Simplify catalog_read()
Date: Wed,  1 Oct 2014 10:32:13 +1000 (EST)	[thread overview]
Message-ID: <20141001003213.A8F78140273@ozlabs.org> (raw)
In-Reply-To: <1411586681-21262-3-git-send-email-sukadev@linux.vnet.ibm.com>

On Wed, 2014-24-09 at 19:24:39 UTC, sukadev@linux.vnet.ibm.com wrote:
> catalog_read() implements the read interface for the sysfs file
> 
> 	/sys/bus/event_source/devices/hv_24x7/interface/catalog
> 
> It essentially takes a buffer, an offset and count as parameters
> to the read() call.  It makes a hypervisor call to read a specific
> page from the catalog and copy the required bytes into the given
> buffer. Each call to catalog_read() returns at most one 4K page.
> 
> Given these requirements, we should be able to simplify the
> catalog_read().
> 
> diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
> index 2f2215c..9427ef7 100644
> --- a/arch/powerpc/perf/hv-24x7.c
> +++ b/arch/powerpc/perf/hv-24x7.c
> @@ -185,6 +105,8 @@ static ssize_t catalog_read(struct file *filp, struct kobject *kobj,
>  	ssize_t ret = 0;
>  	size_t catalog_len = 0, catalog_page_len = 0, page_count = 0;
>  	loff_t page_offset = 0;
> +	loff_t offset_in_page;
> +	size_t copy_len;
>  	uint64_t catalog_version_num = 0;
>  	void *page = kmem_cache_alloc(hv_page_cache, GFP_USER);
>  	struct hv_24x7_catalog_page_0 *page_0 = page;
> @@ -203,6 +125,7 @@ static ssize_t catalog_read(struct file *filp, struct kobject *kobj,
>  
>  	page_offset = offset / 4096;
>  	page_count  = count  / 4096;

I don't see where page_count is used.

> +	offset_in_page = count % 4096;

Shouldn't offset_in_page be based on offset ?

cheers

  reply	other threads:[~2014-10-01  0:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 19:24 [PATCH v2 0/4] powerpc/perf: Miscellaneous fixes Sukadev Bhattiprolu
2014-09-24 19:24 ` [PATCH v2 1/4] powerpc/perf/hv-24x7: use kmem_cache instead of aligned stack allocations Sukadev Bhattiprolu
2014-10-01  1:23   ` [v2, " Michael Ellerman
2014-09-24 19:24 ` [PATCH v2 2/4] Simplify catalog_read() Sukadev Bhattiprolu
2014-10-01  0:32   ` Michael Ellerman [this message]
2014-10-01  0:59     ` [v2,2/4] " Sukadev Bhattiprolu
2014-09-24 19:24 ` [PATCH v2 3/4] perf Documentation: sysfs events/ interfaces Sukadev Bhattiprolu
2014-09-24 19:24 ` [PATCH v2 4/4] perf Documentation: remove duplicated docs for powerpc cpu specific events Sukadev Bhattiprolu

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=20141001003213.A8F78140273@ozlabs.org \
    --to=mpe@ellerman.id.au \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=dev@codyps.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=michaele@au1.ibm.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=sukadev@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).