All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: 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: [PATCH v3 0/5] powerpc/perf: Miscellaneous fixes
Date: Mon, 6 Oct 2014 23:23:05 -0700	[thread overview]
Message-ID: <20141007062305.GA20849@us.ibm.com> (raw)
In-Reply-To: <1412143402-26061-1-git-send-email-sukadev@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

Sukadev Bhattiprolu [sukadev@linux.vnet.ibm.com] wrote:
| Miscellaenous fixes for perf and 24x7 counters in powerpc.
| 
| Patches 1,3,4 were submitted earlier as a part of the parametrized
| events for 24x7 counters. But they are not directly related to the
| parametrized events.
| 
| Patch 2 simplifies and fixes a bug in catalog_read() which causes the
| catalog file to not read first page.
| 
| Changelog[v3]
| 	[Michael Ellerman] Cleanup patches 1 and 2 and fix a bug
| 	Add patch 5/5 to update contact info for 24x7 and GPCI counters
| 
| Changelog[v2]
| 	Rebase to perf/core tree.
| 
| Cody P Schafer (3):
|   powerpc/perf/hv-24x7: use kmem_cache instead of aligned stack
|     allocations
|   perf Documentation: sysfs events/ interfaces
|   perf Documentation: remove duplicated docs for powerpc cpu specific
|     events

Per Michael Ellerman's suggestion, attaching an informal test case to
demonstrate the bug and the fix.

Sukadev

[-- Attachment #2: cp-catalog.c --]
[-- Type: text/x-csrc, Size: 1420 bytes --]

#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>

/*
 * Usage: cp-catalog <read_size>
 *
 * Read the catalog from beginning to end. Read 'read_size' bytes
 * on each read.
 *
 * To ensure that a bug in catalog_read() in the kernel code is fixed.
 * 	cp-catalog 5 > /tmp/catalog-5
 * 	cp-catalog  > /tmp/catalog-4096
 * 	diff /tmp/catalog-5 /tmp/catalog-4096
 *
 * If both files are identical and size is about 256K, the bug is fixed.
 */
#define CATALOG	"/sys/bus/event_source/devices/hv_24x7/interface/catalog"
#define TMP_CATALOG	"/tmp/catalog"

main(int argc, char *argv[])
{
	int read_size, rfd, wfd, rc;
	struct stat stat_buf;
	char *input_file;
	char buf[4096];
	char output_file[256];

	read_size = 4096;
	if (argc > 1)
		read_size = atoi(argv[1]);

	if (read_size > sizeof(buf))
		read_size = sizeof(buf);

	input_file = CATALOG;
	sprintf(output_file, "%s-%d", TMP_CATALOG, read_size);

	rfd = open(input_file, O_RDONLY);
	if (rfd < 0) {
		perror(input_file);
		_Exit(1);
	}

	wfd  = open(output_file, O_WRONLY|O_CREAT|O_TRUNC);
	if (wfd < 0) {
		perror(output_file);
		_Exit(1);
	}

	while(1) {
		memset(buf, 0, sizeof(buf));
		rc = read(rfd, buf, read_size);
		if (rc <= 0)
			break;
		if (write(wfd, buf, rc) != rc) {
			perror("write()");
			break;
		}
	}
	if (fstat(wfd, &stat_buf) < 0) {
		perror("fstat()");
		_Exit(1);
	}
	printf("catalog size %zd\n", stat_buf.st_size);
}

WARNING: multiple messages have this Message-ID (diff)
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: 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: Michael Ellerman <michaele@au1.ibm.com>,
	linux-kernel@vger.kernel.org, dev@codyps.com,
	linuxppc-dev@lists.ozlabs.org,
	Anshuman Khandual <khandual@linux.vnet.ibm.com>
Subject: Re: [PATCH v3 0/5] powerpc/perf: Miscellaneous fixes
Date: Mon, 6 Oct 2014 23:23:05 -0700	[thread overview]
Message-ID: <20141007062305.GA20849@us.ibm.com> (raw)
In-Reply-To: <1412143402-26061-1-git-send-email-sukadev@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

Sukadev Bhattiprolu [sukadev@linux.vnet.ibm.com] wrote:
| Miscellaenous fixes for perf and 24x7 counters in powerpc.
| 
| Patches 1,3,4 were submitted earlier as a part of the parametrized
| events for 24x7 counters. But they are not directly related to the
| parametrized events.
| 
| Patch 2 simplifies and fixes a bug in catalog_read() which causes the
| catalog file to not read first page.
| 
| Changelog[v3]
| 	[Michael Ellerman] Cleanup patches 1 and 2 and fix a bug
| 	Add patch 5/5 to update contact info for 24x7 and GPCI counters
| 
| Changelog[v2]
| 	Rebase to perf/core tree.
| 
| Cody P Schafer (3):
|   powerpc/perf/hv-24x7: use kmem_cache instead of aligned stack
|     allocations
|   perf Documentation: sysfs events/ interfaces
|   perf Documentation: remove duplicated docs for powerpc cpu specific
|     events

Per Michael Ellerman's suggestion, attaching an informal test case to
demonstrate the bug and the fix.

Sukadev

[-- Attachment #2: cp-catalog.c --]
[-- Type: text/x-csrc, Size: 1420 bytes --]

#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>

/*
 * Usage: cp-catalog <read_size>
 *
 * Read the catalog from beginning to end. Read 'read_size' bytes
 * on each read.
 *
 * To ensure that a bug in catalog_read() in the kernel code is fixed.
 * 	cp-catalog 5 > /tmp/catalog-5
 * 	cp-catalog  > /tmp/catalog-4096
 * 	diff /tmp/catalog-5 /tmp/catalog-4096
 *
 * If both files are identical and size is about 256K, the bug is fixed.
 */
#define CATALOG	"/sys/bus/event_source/devices/hv_24x7/interface/catalog"
#define TMP_CATALOG	"/tmp/catalog"

main(int argc, char *argv[])
{
	int read_size, rfd, wfd, rc;
	struct stat stat_buf;
	char *input_file;
	char buf[4096];
	char output_file[256];

	read_size = 4096;
	if (argc > 1)
		read_size = atoi(argv[1]);

	if (read_size > sizeof(buf))
		read_size = sizeof(buf);

	input_file = CATALOG;
	sprintf(output_file, "%s-%d", TMP_CATALOG, read_size);

	rfd = open(input_file, O_RDONLY);
	if (rfd < 0) {
		perror(input_file);
		_Exit(1);
	}

	wfd  = open(output_file, O_WRONLY|O_CREAT|O_TRUNC);
	if (wfd < 0) {
		perror(output_file);
		_Exit(1);
	}

	while(1) {
		memset(buf, 0, sizeof(buf));
		rc = read(rfd, buf, read_size);
		if (rc <= 0)
			break;
		if (write(wfd, buf, rc) != rc) {
			perror("write()");
			break;
		}
	}
	if (fstat(wfd, &stat_buf) < 0) {
		perror("fstat()");
		_Exit(1);
	}
	printf("catalog size %zd\n", stat_buf.st_size);
}

  parent reply	other threads:[~2014-10-07  6:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01  6:03 [PATCH v3 0/5] powerpc/perf: Miscellaneous fixes Sukadev Bhattiprolu
2014-10-01  6:03 ` Sukadev Bhattiprolu
2014-10-01  6:03 ` [PATCH 1/5] powerpc/perf/hv-24x7: use kmem_cache instead of aligned stack allocations Sukadev Bhattiprolu
2014-10-01  6:03   ` Sukadev Bhattiprolu
2014-10-01  6:03 ` [PATCH 2/5] Simplify catalog_read() Sukadev Bhattiprolu
2014-10-01  6:03   ` Sukadev Bhattiprolu
2014-10-01  6:03 ` [PATCH 3/5] perf Documentation: sysfs events/ interfaces Sukadev Bhattiprolu
2014-10-01  6:03   ` Sukadev Bhattiprolu
2014-10-16  5:21   ` [tip:perf/urgent] " tip-bot for Cody P Schafer
2014-10-01  6:03 ` [PATCH 4/5] perf Documentation: remove duplicated docs for powerpc cpu specific events Sukadev Bhattiprolu
2014-10-01  6:03   ` Sukadev Bhattiprolu
2014-10-16  5:22   ` [tip:perf/urgent] perf Documentation: Remove Ruplicated " tip-bot for Cody P Schafer
2014-10-01  6:03 ` [PATCH 5/5] powerpc: Update contact info in Documentation files Sukadev Bhattiprolu
2014-10-01  6:03   ` Sukadev Bhattiprolu
2014-10-07  6:23 ` Sukadev Bhattiprolu [this message]
2014-10-07  6:23   ` [PATCH v3 0/5] powerpc/perf: Miscellaneous fixes 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=20141007062305.GA20849@us.ibm.com \
    --to=sukadev@linux.vnet.ibm.com \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.