Commit Graph

22 Commits (3d203be833068c0f633878743d0c08d6acd24b58)

Author SHA1 Message Date
Adrian Hunter 3d203be833 mmc_test: fix memory allocation segment limits
Correctly allocate memory to meet the host controller
driver's maximum segment size and count limits.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:13 +08:00
Andy Shevchenko 130067ed15 mmc_test: move files from sysfs to debugfs
As proposed by Greg K-H it is more logical to keep files for the mmc_test
driver under debugfs.

Additionally this patch brings seq_file API for show() method.  It allows
to write unlimited data to the file.

Example of usage:
  # mount -t debugfs none /sys/kernel/debug
  # modprobe mmc_test
    [  581.395843] mmc_test mmc0:0001: Card claimed for testing.
  # echo 25 > /sys/kernel/debug/mmc0/mmc0\:0001/test
    [  604.568542] mmc0: Starting tests of card mmc0:0001...
    [  604.582733] mmc0: Test case 25. Best-case read performance into scattered pages...
    [  604.923553] mmc0: Transfer of 8192 sectors (4096 KiB) took 0.124664314 seconds (33644 kB/s, 32856 KiB/s)
    [  604.933227] mmc0: Result: OK
    [  604.936248] mmc0: Tests completed.
  # cat /sys/kernel/debug/mmc0/mmc0\:0001/test
    Test 25: 0
    1 8192 0.124664314 33644784

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: Greg KH <greg@kroah.com>
Cc: Adrian Hunter <adrian.hunter@nokia.com>
Cc: Chris Ball <cjb@laptop.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:13 +08:00
Andy Shevchenko 3183aa1534 mmc_test: collect data and show it via sysfs by demand
Make it possible to get test results via sysfs.  It helps to do tests
non-interactively.  We have the file created under sysfs already and
can use it to show test results.

Prior to this patch, the "test" file under each card's sysfs node was
write-only, and results were obtained by looking at dmesg.  This patch
improves programmatic access to the test results, making them available by
reading back from the same "test" file:

[root@host mmc0:e624]# echo 6 > test
[root@host mmc0:e624]# cat test
Test 6: 2

[cjb@laptop.org: changelog improvements]
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: Chris Ball <cjb@laptop.org>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:13 +08:00
Andy Shevchenko 5c25aee536 mmc_test: change simple_strtol() to strict_strtol()
It's better to use strict_strtol() to convert user's input and strictly
check it. At least it forbids to interpret wrong input as a 0 and
prevents to run all tests.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:12 +08:00
Andy Shevchenko 63be54cefa mmc_test: use API to check card type
There are methods to check card type. Let's use them instead of direct checking
type bits.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:12 +08:00
Adrian Hunter c8c8c1bdbe mmc_test: fix performance tests that go over max_blk_count
The host controller driver limits I/O transfers to maximum
transfer size, maximum block count, maximum segment size
and maximum segment count.  The performance tests were
not obeying these limits which meant they would not work
with some drivers.  This patch fixes that.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:12 +08:00
Andy Shevchenko 265cdc900c mmc: rename dev_to_mmc_card() to mmc_dev_to_card()
Global symbols should use their subsystem name in a prefixed fashion.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:12 +08:00
Andy Shevchenko 453722b9f7 mmc: make mmc_dev_to_card() macro public
Conversion from struct device to struct mmc_card is used more than in one
place.  Due to this it's better to have public macro for such thing.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Cc: Adrian Hunter <adrian.hunter@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:12 +08:00
Adrian Hunter fec4dcce23 mmc_test: fix large memory allocation
- Fix mmc_test_alloc_mem.

- Use nr_free_buffer_pages() instead of sysinfo.totalram to determine
  total lowmem pages.

- Change variables containing memory sizes to unsigned long.

- Limit maximum test area size to 128MiB because that is the maximum MMC
  high capacity erase size (the maxmium SD allocation unit size is just
  4MiB)

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-12 08:43:31 -07:00
Adrian Hunter 64f7120d89 mmc_test: add performance tests
mmc_test provides tests aimed at testing SD/MMC hosts.  This patch adds
performance tests.

It is advantageous to have performance tests in a kernel
module like mmc_test for the following reasons:
	- transfer times can be measured very accurately
	- arbitrarily large transfers are possible
	- the effect of contiguous vs scattered pages
	can be determined

The new tests are:

	23. Best-case read performance
	24. Best-case write performance
	25. Best-case read performance into scattered pages
	26. Best-case write performance from scattered pages
	27. Single read performance by transfer size
	28. Single write performance by transfer size
	29. Single trim performance by transfer size
	30. Consecutive read performance by transfer size
	31. Consecutive write performance by transfer size
	32. Consecutive trim performance by transfer size

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-12 08:43:30 -07:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Johan Kristell c286d03cce mmc_test: block addressed cards
This patch fixes a bug in the multiblock write tests where the written
data is read back for verifying one block at a time.  The tests in
mmc_test assumes that all cards are byte addressable.

This will cause the multi block write tests to fail, leading the user of
the mmc_test driver thinking there is something wrong with the sdhci
driver they are testing.

The start address for the block is calculated as: blocknum * 512. For
block addressable cards the blocknum alone should be used.

Signed-off-by: Johan Kristell <johan.kristell@axis.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-02-11 13:59:42 -08:00
Rabin Vincent 58a5dd3e0e mmc_test: fix basic read test
Due to a typo in the Basic Read test, it's currently identical to the
Basic Write test.  Fix this.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2009-02-18 21:01:14 +01:00
Akinobu Mita a650031a6b mmc_test: initialize mmc_test_lock statically
The mutex mmc_test_lock is initialized at every time mmc_test device
is probed. Probing another mmc_test device may break the mutex, if
the probe function is called while the mutex is locked.

This patch fixes it by statically initializing mmc_test_lock.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-09-20 13:03:50 +02:00
Pierre Ossman b7ac2cf1cd mmc_test: Revert "mmc_test: test oversized sg lists"
This reverts commit 48b5352ea1. Oversized
sg lists are not allowed anymore, and the core even checks for them in
debug mode, so this test is entirely incorrect.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-08-01 19:03:37 +02:00
Pierre Ossman 60c9c7b1d9 mmc_test: print message when attaching to card
Make it a bit more obvious that the card has been claimed by the
mmc_test driver so that people don't have to wonder why their block
device never shows up.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-23 14:42:09 +02:00
Pierre Ossman 48b5352ea1 mmc_test: test oversized sg lists
Add tests that make sure the driver properly checks the blocks and
blksz fields and doesn't assume the sg list has a size that perfectly
matches the current request.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-23 14:42:08 +02:00
Pierre Ossman 2661081f5a mmc_test: highmem tests
Add a couple of tests to make sure the host driver handles highmem
memory pages properly. Unfortunately there is no way to guarantee an
allocation below 4 GB in i386, so it might give you addresses that
are out of reach for the hardware (OTOH, so will any other highmem
allocation in the kernel).

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-23 14:42:08 +02:00
Pierre Ossman 6b174931a7 mmc_test: cleanup
Clean up and reorganise the mmc_test driver so that it (hopefully)
is easier to extend with more complex tests.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15 14:14:45 +02:00
Pierre Ossman 0121a9829b mmc_test: only bind to supported cards
We can only perform the tests on MMC and SD cards, so avoid binding
to any other type.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15 14:14:44 +02:00
Pierre Ossman fd8c326cad mmc_test: add test case control
Add the ability to run just a single test case by writing the test
case number into the sysfs "test" file.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15 14:14:40 +02:00
Pierre Ossman 88ae600d58 mmc: mmc host test driver
A dummy driver that performs a series of requests that are often mis-
handled by host drivers.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-05-14 21:02:16 +02:00