presenter : kilroy 1. introduction experiment 1 - simulate a virtual disk device experiment 2 -...

Post on 03-Jan-2016

228 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Presenter : kilroy

1

IntroductionExperiment 1

- Simulate a virtual disk deviceExperiment 2

- Nand-flash simulation for wear leveling algo.Conclusion

2

What those experiments Why those experimentsWelcome our new machineMain object

3

What to do Simulate a disk device

How to doUsing a block device driver

ObjectUnderstanding more about device

drivers

4

5

Quick function Reference #include <linux/fs.h> int register_blkdev(unsigned int major, const char

*name); int unregister_blkdev(unsigned int major, const char

*name); struct block_device_operations #include <linux/genhd.h> struct gendisk *alloc_disk(int minors); void add_disk(struct gendisk *gd); void set_capacity(struct gendisk *gd, sector_t sectors); void add_disk(struct gendisk *gd);

6

#include <linux/blkdev.h>request_queue_t blk_init_queue(request_fn_proc

*request, spinlock_t *lock);struct request *elv_next_request(request_queue_t

*queue);void end_request(struct request *req, int

success);#include <mm/vmalloc.h>void *vmalloc(unsigned long size);

7

Structure block_device_operations in <linux/fs>

8

Implement function what we need:sbull_init()sbull_exit()sbull_open() sbull_release() sbull_request()sbull_transfer()

9

Nand-falsh simulation Simulate a nand type flash in memory Design an experiment that observing the wear leveling

erase count Two parts, one for ext2 one for jffs2

Two steps Understanding the way of erasing Experiment

Environment 64MB nand type flash 512B page size

10

Step 1:Trace code..

At ..linux/drivers/mtd/nandnand_base.c is the keyFunction nand_erase_nand

11

Function nand_erase_nand 1.check if address align on block bounday

2.check if length align on block bounday3.check the erase will pass the end of device4.shift to get first page5.calculate pages in each block6.check if write protected7.check whether refresh BBT8.erase operation (page by page)   -check if have bad block   -Invalidate the page cache   -see if operation failed and additional status checks are available   -see if block erase succeeded    -check if cross a chip boundary

12

Step 2:Experiment design

Observe form kernel debug messageUsing nandsim to simulateCounting & ploting

13

Experiment 2 result

14

Experiment 2 result

15

Working log will be your good friendGood habit Bug & balk recordShare your problem & result to othersKeep your schedule in mind

Experience form experiment

top related