Bug 216278 - ubi: support disabling fastmap for certain ubi device
Summary: ubi: support disabling fastmap for certain ubi device
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-25 09:04 UTC by Zhihao Cheng
Modified: 2022-10-18 01:10 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.19-rc7
Subsystem:
Regression: No
Bisected commit-id:


Attachments
test.sh (3.07 KB, application/x-shellscript)
2022-07-25 09:05 UTC, Zhihao Cheng
Details
mtd-utils modifications (5.45 KB, application/mbox)
2022-07-25 09:07 UTC, Zhihao Cheng
Details

Description Zhihao Cheng 2022-07-25 09:04:16 UTC
Testcase:

IKCONFIG=y, IKCONFIG_PROC=y

1. CONFIG_MTD_UBI_FASTMAP=y
2. ./test.sh 1 # generate ubi image


1. CONFIG_MTD_UBI_FASTMAP=y
2. ./test.sh
3. CONFIG_MTD_UBI_FASTMAP=n
4. ./test.sh

Situation I. Attach UBI image with no existed old fastmap
1. CONFIG_MTD_UBI_FASTMAP=n
   A. set fm_autoconvert
      a. ubiattach        => scan all, no fastmap generated
	  b. ubiattach -f     => scan all, no fastmap generated
   B. not set fm_autoconvert
      a. ubiattach        => scan all, no fastmap generated
	  b. ubiattach -f     => scan all, no fastmap generated
2. CONFIG_MTD_UBI_FASTMAP=y
   A. set fm_autoconvert
      a. ubiattach        => scan all, fastmap generated
	  b. ubiattach -f     => scan all, no fastmap generated
   B. not set fm_autoconvert
      a. ubiattach        => scan all, no fastmap generated
	  b. ubiattach -f     => scan all, no fastmap generated
	  
Situation II. Attach UBI image with existed old fastmap
1. CONFIG_MTD_UBI_FASTMAP=n
   A. set fm_autoconvert
      a. ubiattach        => scan all, no fastmap generated
	  b. ubiattach -f     => scan all, no fastmap generated
   B. not set fm_autoconvert
      a. ubiattach        => scan all, no fastmap generated
	  b. ubiattach -f     => scan all, no fastmap generated
2. CONFIG_MTD_UBI_FASTMAP=y
   A. set fm_autoconvert
      a. ubiattach        => scan fast, fastmap generated
	  b. ubiattach -f     => scan all, no fastmap generated
   B. not set fm_autoconvert
      a. ubiattach        => scan fast, fastmap updated
	  b. ubiattach -f     => scan all, no fastmap generated
Comment 1 Zhihao Cheng 2022-07-25 09:05:23 UTC
Created attachment 301481 [details]
test.sh
Comment 2 Zhihao Cheng 2022-07-25 09:07:39 UTC
Created attachment 301482 [details]
mtd-utils modifications
Comment 3 Zhihao Cheng 2022-07-25 09:08:22 UTC
Apply mtd-utils modifications to mtd-utils, and compile ubiattach.
Comment 4 wangzhaolong1 2022-10-17 14:45:57 UTC
用法:

加载ubi模块或内核命令行参数是mtd=xxx的第5个参数控制fastmap是否打开,0为关闭,1为使能

CONFIG_MTD_UBI_FASTMAP=Y

$ ID="0x20,0xa5,0x00,0x26" # 2G nand flash

$ modprobe nandsim id_bytes=$ID parts=4096 # 两个1G的分区

$ modprobe ubi mtd=1,0,0,1,1 mtd=2,0,0,2,0 fm_autoconvert=1 
# 预期 mtd1 -> ubi1(开启fastmap)  mtd2 -> ubi2(不开启fastmap)成功

$ modprobe -r ubi       # 移除模块,或 ubidetach

$ modprobe ubi mtd=1,0,0,1,0 mtd=2,0,0,2,1 fm_autoconvert=1 
# 预期 mtd1(旧的镜像) -> ubi1(关闭fastmap)  mtd2(旧的镜像) -> ubi2(开启fastmap)成功
Comment 5 wangzhaolong1 2022-10-18 01:10:31 UTC
(In reply to wangzhaolong1 from comment #4)
> 用法:
> 
> 加载ubi模块或内核命令行参数是mtd=xxx的第5个参数控制fastmap是否打开,0为关闭,1为使能
> 
> CONFIG_MTD_UBI_FASTMAP=Y
> 
> $ ID="0x20,0xa5,0x00,0x26" # 2G nand flash
> 
> $ modprobe nandsim id_bytes=$ID parts=4096 # 两个1G的分区
> 
> $ modprobe ubi mtd=1,0,0,1,1 mtd=2,0,0,2,0 fm_autoconvert=1 
> # 预期 mtd1 -> ubi1(开启fastmap)  mtd2 -> ubi2(不开启fastmap)成功
> 
> $ modprobe -r ubi       # 移除模块,或 ubidetach
> 
> $ modprobe ubi mtd=1,0,0,1,0 mtd=2,0,0,2,1 fm_autoconvert=1 
> # 预期 mtd1(旧的镜像) -> ubi1(关闭fastmap)  mtd2(旧的镜像) -> ubi2(开启fastmap)成功

I'm sorry!!I misplaced it.

Note You need to log in before you can comment on or make changes to this bug.