We found a recursive locking as below: [ 87.848606] -(1)[282:init] down_write+0x3c/0xd0 [ 87.849229] -(1)[282:init] keyslot_manager_evict_key+0x398/0x600 [ 87.850035] -(1)[282:init] blk_crypto_evict_key+0xb0/0x18c [ 87.850779] -(1)[282:init] dm_keyslot_evict_callback+0x74/0xf0 [ 87.851566] -(1)[282:init] default_key_iterate_devices+0xa0/0xb4 [ 87.852373] -(1)[282:init] dm_keyslot_evict+0x15c/0x240 [ 87.853082] -(1)[282:init] keyslot_manager_evict_key+0x3bc/0x600 [ 87.853888] -(1)[282:init] blk_crypto_evict_key+0xb0/0x18c [ 87.854631] -(1)[282:init] fscrypt_destroy_inline_crypt_key+0x84/0x114 Although dm ksm semaphore is totally different with lower device drivers, it will result in lockdep detection disabled, then stability test CANNOT detect lock potential issue anymore. Try to set a sub-class lock level in DM layer. MTK-Commit-Id: aeade56a7b177d3d350ba74fdabf72de8587a103 Change-Id: I22645daf78583910545f83e91cfb87b622db629c Tests: MTK HIE U.T (fscrypt v2) 2~5 cases 100 times in UFS/eMMC platforms Signed-off-by: mtk81325 <peng.zhou@mediatek.com> CR-Id: ALPS05283935 Feature: SIM
69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright 2019 Google LLC
|
|
*/
|
|
|
|
#ifndef __LINUX_BLK_CRYPTO_H
|
|
#define __LINUX_BLK_CRYPTO_H
|
|
|
|
#include <linux/bio.h>
|
|
|
|
#define SECTOR_SHIFT 9
|
|
|
|
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
|
|
|
|
int blk_crypto_submit_bio(struct bio **bio_ptr);
|
|
|
|
bool blk_crypto_endio(struct bio *bio);
|
|
|
|
int blk_crypto_init_key(struct blk_crypto_key *blk_key,
|
|
const u8 *raw_key, unsigned int raw_key_size,
|
|
bool is_hw_wrapped,
|
|
enum blk_crypto_mode_num crypto_mode,
|
|
unsigned int dun_bytes,
|
|
unsigned int data_unit_size);
|
|
|
|
int blk_crypto_start_using_mode(enum blk_crypto_mode_num crypto_mode,
|
|
unsigned int dun_bytes,
|
|
unsigned int data_unit_size,
|
|
bool is_hw_wrapped_key,
|
|
struct request_queue *q);
|
|
|
|
int blk_crypto_evict_key(struct request_queue *q,
|
|
const struct blk_crypto_key *key);
|
|
|
|
inline void blk_crypto_flock(struct keyslot_manager *ksm, unsigned int flags);
|
|
|
|
|
|
#else /* CONFIG_BLK_INLINE_ENCRYPTION */
|
|
|
|
static inline int blk_crypto_submit_bio(struct bio **bio_ptr)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline bool blk_crypto_endio(struct bio *bio)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
static inline void blk_crypto_flock(struct keyslot_manager *ksm,
|
|
unsigned int flags) {}
|
|
|
|
#endif /* CONFIG_BLK_INLINE_ENCRYPTION */
|
|
|
|
#ifdef CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK
|
|
|
|
int blk_crypto_fallback_init(void);
|
|
|
|
#else /* CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK */
|
|
|
|
static inline int blk_crypto_fallback_init(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#endif /* CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK */
|
|
|
|
#endif /* __LINUX_BLK_CRYPTO_H */
|