WriteBooster Study之flushneeded

10 篇文章 1 订阅

一.WB的框图      

   

             WriteBooster Buffer的大小是由FTL去配置,可以配置为12G,24G,36G等,

二. Exception Event 的介绍以及UFS Driver Exception Event FLow的介绍

1. 首先介绍一下Exception Event的流程

1.1

Exception Event ControlUFS Devices在运行过程中会出现异常,如果对应的Bit位置1,就会通过Response UPIU上报给UFS Host

1.2

UFS Host Verify Accept Exception Event: UFS Host在收到UFS Devices返回的Response UPIU时,会去Check Response UPIU的Byte 9 : Device Information,如果Bit[0]时1,说明UFS Device上报了Exception Event。

/**
 * struct utp_upiu_header - UPIU header structure
 * @dword_0: UPIU header DW-0
 * @dword_1: UPIU header DW-1
 * @dword_2: UPIU header DW-2
 */
struct utp_upiu_header {
    __be32 dword_0; --->对应UPIU Basic Header byte[3:0]
    __be32 dword_1;--->对应UPIU
Basic Header byte[7:4]
    __be32 dword_2;--->对应UPIU
Basic Header byte[11:8]
};

 

/**
 * ufshcd_is_exception_event - Check if the device raised an exception event
 * @ucd_rsp_ptr: pointer to response UPIU
 *
 * The function checks if the device raised an exception event indicated in
 * the Device Information field of response UPIU.
 *
 * Returns true if exception is raised, false otherwise.
 */
static inline bool ufshcd_is_exception_event(struct utp_upiu_rsp *ucd_rsp_ptr)
{
    return be32_to_cpu(ucd_rsp_ptr->header.dword_2) &
            MASK_RSP_EXCEPTION_EVENT ? true : false;
}

 

enum {
    MASK_SCSI_STATUS        = 0xFF,
    MASK_TASK_RESPONSE              = 0xFF00,
    MASK_RSP_UPIU_RESULT            = 0xFFFF,
    MASK_QUERY_DATA_SEG_LEN         = 0xFFFF,
    MASK_RSP_UPIU_DATA_SEG_LEN    = 0xFFFF,
    MASK_RSP_EXCEPTION_EVENT        = 0x10000,
    MASK_TM_SERVICE_RESP        = 0xFF,
};
 

1.3 UFS Host Accept Exception Event will to do:

以Urgent Bkops举个例子:

ufs host accept exception event ---> send query read attribute cmd (CDB:03 0e) to ufs devices verify exception event type---> query exception event status is URGENT_BKOP---> send query read attribute cmd (CDB:03 05) to ufs devices verify bkops status --->

---> query bkops status >=1 ---> send query set flag (CDB:06 04)to ufs devices enable fBackgroundOpsEn-->send query write attributes(CDB:04 0d) to ufs devices disable wExceptionEventControl bit[2]  URGENT_BKOPS_EN---> flow finish

 

2. WriteBooster Buffer Flush needed 

 

WriteBooster Flush needed exception event触发的条件:当前WriteBooster Buffer已经写满或接近写满的时候,一般表现为WriteBooster AvailBuffersize为0的时候触发该Exception Event
WriteBooster Flush needed exception event 上报给ufs host的条件:WriteBooster Buffer FLush Exception event control (wExceptionEventControl) bit[5]  WRITEBOOSTER_EVENT_EN置1,置1说明会上报给ufs host, 置0说明不会上报给ufs devices(但是writebooster buffer已经写满或者接近满的时候依然ufs devices WriteBooster Buffer FLush Exception event status(wExceptionEventStatus) bit[5]  WRITEBOOSTER_FLUSH_NEEDED依然置1,这个是ufs devices和fw的行为)
ufs host确认上报exception event是否是WriteBooster Flush needed exception event:通过查询WriteBooster Buffer FLush Exception event status(wExceptionEventStatus) bit[5]  WRITEBOOSTER_FLUSH_NEEDED置1,置1说明产生了WriteBooster Buffer FLush Exception event。
ufs host收到ufs devices上报的WriteBooster Buffer FLush Exception event会怎么处理:这个是根据各个平台自己制定策略,但是制定策略的目的都是为了将WriteBoosterbuffer(SLC)的数据刷回到TLC去,可以使用witebooster flush和writebooster flush during hibernate两种flush的方式
 
 
 

三. WriteBooster Buffer FLush Exception event control (wExceptionEventControl) bit[5] WRITEBOOSTER_EVENT_EN置1对Performance的影响

        当持续对UFS Devices写入或写入量比较大(超过Writebooster buffer 大小)的数据量,如果WRITEBOOSTER_EVENT_EN置1,ufs devices会持续上报WriteBooster Flush needed exception event 异常给ufs devices, ufs devices会持续query read attributes(CDB:03 0e) ufs devices的exception event status, 可能会导致random read performance drop.

 

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值