Skip to contentSkip to conversation

block: Add test-iosched scheduler

PATCH In review Maya Erez 2 participants 6 messages Jun 12, 2012 – Jun 13, 2012

Subsystems (4)
lore
Share & tools
lore

Maya Erez

author
#0 lore raw

v4 cover block: Add test-iosched scheduler

The test scheduler allows testing a block device by dispatching specific requests according to the test case and declare PASS/FAIL according to the requests completion error code

Changes in v4:
- fix test_init_queue definition

Changes in v3:
- checkpatch error fixes
- Changes to support the packed commands tests
Changes in v2:
- Export test-iosched functionality to allow definition of the block device tests under the block device layer
- Add registration of block device tests utilities

Maya Erez (1):
block: Add test-iosched scheduler

 Documentation/block/test-iosched.txt |   39 ++
 block/Kconfig.iosched                |   11 +
 block/Makefile                       |    1 +
 block/blk-core.c                     |    3 +-
 block/test-iosched.c                 | 1015 ++++++++++++++++++++++++++++++++++
 include/linux/test-iosched.h         |  218 ++++++++
 6 files changed, 1285 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/block/test-iosched.txt
 create mode 100644 block/test-iosched.c
 create mode 100644 include/linux/test-iosched.h
Signature · 4 lines
1.7.3.3
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
author
#1 lore raw

PATCH v4 1/1 block: Add test-iosched scheduler

The test scheduler allows testing a block device by dispatching specific requests according to the test case and declare PASS/FAIL according to the requests completion error code

Documentation/block/test-iosched.txt new file +39 -0
new file mode 100644
index 0000000..75d8134
@@ -0,0 +1,39 @@
+Test IO scheduler
+==================
+
+The test scheduler allows testing a block device by dispatching
+specific requests according to the test case and declare PASS/FAIL
+according to the requests completion error code.
+
+The test IO scheduler implements the no-op scheduler operations, and uses
+them in order to dispatch the non-test requests when no test is running.
+This will allow to keep a normal FS operation in parallel to the test
+capability.
+The test IO scheduler keeps two different queues, one for real-world requests
+(inserted by the FS) and the other for the test requests.
+The test IO scheduler chooses the queue for dispatch requests according to the
+test state (IDLE/RUNNING).
+
+the test IO scheduler is compiled by default as a dynamic module and enabled
+only if CONFIG_DEBUG_FS is defined.
+
+Each block device test utility that would like to use the test-iosched test
+services, should register as a blk_dev_test_type and supply an init and exit
+callbacks. Those callback are called upon selection (or removal) of the
+test-iosched as the active scheduler. From that point the block device test
+can start a test and supply its own callbacks for preparing, running, result
+checking and cleanup of the test.
+
+Each test is exposed via debugfs and can be triggered by writing to
+the debugfs file. In order to add a new test one should expose a new debugfs
+file for the new test.
+
+Selecting IO schedulers
+-----------------------
+Refer to Documentation/block/switching-sched.txt for information on
+selecting an io scheduler on a per-device basis.
+
+
+May 10 2012, maya Erez <[email protected]>
+
+
block/Kconfig.iosched +11 -0
index 421bef9..af3d6a3 100644
@@ -12,6 +12,17 @@ config IOSCHED_NOOP
 	  that do their own scheduling and require only minimal assistance from
 	  the kernel.
 
+config IOSCHED_TEST
+	tristate "Test I/O scheduler"
+	depends on DEBUG_FS
+	default m
+	---help---
+	  The test I/O scheduler is a duplicate of the noop scheduler with
+	  addition of test utlity.
+	  It allows testing a block device by dispatching specific requests
+	  according to the test case and declare PASS/FAIL according to the
+	  requests completion error code.
+
 config IOSCHED_DEADLINE
 	tristate "Deadline I/O scheduler"
 	default y
block/Makefile +1 -0
index 39b76ba..436b220 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_BLK_DEV_THROTTLING)	+= blk-throttle.o
 obj-$(CONFIG_IOSCHED_NOOP)	+= noop-iosched.o
 obj-$(CONFIG_IOSCHED_DEADLINE)	+= deadline-iosched.o
 obj-$(CONFIG_IOSCHED_CFQ)	+= cfq-iosched.o
+obj-$(CONFIG_IOSCHED_TEST)	+= test-iosched.o
 
 obj-$(CONFIG_BLOCK_COMPAT)	+= compat_ioctl.o
 obj-$(CONFIG_BLK_DEV_INTEGRITY)	+= blk-integrity.o
block/blk-core.c +1 -2
index 5639a3d..54ea4da 100644
@@ -1072,8 +1072,6 @@ struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask)
 {
 	struct request *rq;
 
-	BUG_ON(rw != READ && rw != WRITE);
-
 	spin_lock_irq(q->queue_lock);
 	if (gfp_mask & __GFP_WAIT)
 		rq = get_request_wait(q, rw, NULL);
@@ -1406,6 +1404,7 @@ void init_request_from_bio(struct request *req, struct bio *bio)
 	req->ioprio = bio_prio(bio);
 	blk_rq_bio_prep(req->q, req, bio);
 }
+EXPORT_SYMBOL(init_request_from_bio);
 
 void blk_queue_bio(struct request_queue *q, struct bio *bio)
 {
block/test-iosched.c new file +1015 -0

1,015 lines not on this page · raw message

include/linux/test-iosched.h new file +218 -0

218 lines not on this page · raw message

Signature · 4 lines
1.7.3.3
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#2 lore raw
Quoted 3 lines · Maya Erez

The test scheduler allows testing a block device by dispatching specific requests according to the test case and declare PASS/FAIL according to the requests completion error code

What sort of tests have you written that make use of this infrastructure?

block/blk-core.c struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask) · line 1076

Quoted 6 lines
block/blk-core.c +0 -2
@@ -1072,8 +1072,6 @@ struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask)
 {
 	struct request *rq;
 
-	BUG_ON(rw != READ && rw != WRITE);
-

Please explain this.

Cheers,
Jeff

#3 lore raw
Quoted 14 lines · Jeff Moyer
Quoted 3 lines · Maya Erez

The test scheduler allows testing a block device by dispatching specific requests according to the test case and declare PASS/FAIL according to the requests completion error code

What sort of tests have you written that make use of this infrastructure?

Quoted 5 lines
block/blk-core.c +0 -0
@@ -1072,8 +1072,6 @@ struct request *blk_get_request(struct
 request_queue *q, int rw, gfp_t gfp_mask)
 {
 	struct request *rq;
 
Quoted 4 lines

block/blk-core.c struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask) · line 1076

Quoted 2 lines
block/blk-core.c +0 -2
-	BUG_ON(rw != READ && rw != WRITE);
-

Please explain this.

get_request and get_request_wait, called by blk_get_request, expects to get the REQ_SYNC flag in addition to the read/write flag. Moreover, it uses the REQ_SYNC flag in its algorithm decision making. However blk_get_request expects to get a Boolean to indicate only read/write flag and cannot handle the REQ_SYNC flag.

Quoted 4 lines

Cheers,
Jeff

Signature · 2 lines
Sent by consultant of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
#4 lore raw
Quoted 19 lines · [email protected] writes:
Quoted 14 lines · Jeff Moyer
Quoted 3 lines · Maya Erez

The test scheduler allows testing a block device by dispatching specific requests according to the test case and declare PASS/FAIL according to the requests completion error code

What sort of tests have you written that make use of this infrastructure?

Quoted 5 lines
block/blk-core.c +0 -0
@@ -1072,8 +1072,6 @@ struct request *blk_get_request(struct
 request_queue *q, int rw, gfp_t gfp_mask)
 {
 	struct request *rq;
 
Quoted 4 lines

block/blk-core.c struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask) · line 1076

Quoted 2 lines
block/blk-core.c +0 -2
-	BUG_ON(rw != READ && rw != WRITE);
-

Please explain this.

Quoted 5 lines

get_request and get_request_wait, called by blk_get_request, expects to get the REQ_SYNC flag in addition to the read/write flag. Moreover, it uses the REQ_SYNC flag in its algorithm decision making. However blk_get_request expects to get a Boolean to indicate only read/write flag and cannot handle the REQ_SYNC flag.

Right, so why is it okay to change this? Right now, blk_get_request is used for block special requests. There is no sense of sync vs. async for such requests (that's an fs request notion). Perhaps you're calling the wrong function?

Cheers,
Jeff

#5 lore raw
Quoted 27 lines · Jeff Moyer
Quoted 19 lines · [email protected] writes:
Quoted 14 lines · Jeff Moyer
Quoted 3 lines · Maya Erez

The test scheduler allows testing a block device by dispatching specific requests according to the test case and declare PASS/FAIL according to the requests completion error code

What sort of tests have you written that make use of this infrastructure?

Quoted 5 lines
block/blk-core.c +0 -0
@@ -1072,8 +1072,6 @@ struct request *blk_get_request(struct
 request_queue *q, int rw, gfp_t gfp_mask)
 {
 	struct request *rq;
 
Quoted 4 lines

block/blk-core.c struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask) · line 1076

Quoted 2 lines
block/blk-core.c +0 -2
-	BUG_ON(rw != READ && rw != WRITE);
-

Please explain this.

Quoted 5 lines

get_request and get_request_wait, called by blk_get_request, expects to get the REQ_SYNC flag in addition to the read/write flag. Moreover, it uses the REQ_SYNC flag in its algorithm decision making. However blk_get_request expects to get a Boolean to indicate only read/write flag and cannot handle the REQ_SYNC flag.

Quoted 8 lines

Right, so why is it okay to change this? Right now, blk_get_request is used for block special requests. There is no sense of sync vs. async for such requests (that's an fs request notion). Perhaps you're calling the wrong function?

Cheers,
Jeff

I use this function to get a WRITE_FLUSH request (which includes in its flags the REQ_SYNC flag).
Is there another function I should use for this purpose?

Thanks,
Maya

Signature · 2 lines
Sent by consultant of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum