[f2fs-dev] [Bug 206057] 5.5.0-rc2-next: f2fs is extremely slow, with ext4 system works well

2020-04-22 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=206057

--- Comment #9 from Jaegeuk Kim (jaeg...@kernel.org) ---
(In reply to Balazs Vinarz from comment #8)
> Hello there,
> 
> as a 32bit ARM user, I'm also affected.
> Will this fix be in 5.7?
> 
> Regards

Yes, it was merged in 5.7-rc1.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [Bug 206057] 5.5.0-rc2-next: f2fs is extremely slow, with ext4 system works well

2020-04-22 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=206057

Balazs Vinarz (viniba...@gmail.com) changed:

   What|Removed |Added

 CC||viniba...@gmail.com

--- Comment #8 from Balazs Vinarz (viniba...@gmail.com) ---
Hello there,

as a 32bit ARM user, I'm also affected.
Will this fix be in 5.7?

Regards

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH v10 05/12] block: blk-crypto-fallback for Inline Encryption

2020-04-22 Thread Christoph Hellwig
> diff --git a/Documentation/block/index.rst b/Documentation/block/index.rst
> index 3fa7a52fafa46..026addfc69bc9 100644
> --- a/Documentation/block/index.rst
> +++ b/Documentation/block/index.rst
> @@ -14,6 +14,7 @@ Block
> cmdline-partition
> data-integrity
> deadline-iosched
> +   inline-encryption
> ioprio
> kyber-iosched
> null_blk

> diff --git a/block/blk-crypto.c b/block/blk-crypto.c
> index 7546363dc584e..18e1a4d64bd33 100644
> --- a/block/blk-crypto.c
> +++ b/block/blk-crypto.c
> @@ -3,6 +3,10 @@
>   * Copyright 2019 Google LLC
>   */
>  
> +/*
> + * Refer to Documentation/block/inline-encryption.rst for detailed 
> explanation.
> + */
> +

These hunks should be in other patches.


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH v10 03/12] block: Inline encryption support for blk-mq

2020-04-22 Thread Christoph Hellwig
> +/**
> + * __blk_crypto_bio_prep - Prepare bio for inline encryption
> + *
> + * @bio_ptr: pointer to original bio pointer
> + *
> + * Succeeds if the bio doesn't have inline encryption enabled or if the bio
> + * crypt context provided for the bio is supported by the underlying device's
> + * inline encryption hardware. Ends the bio with error otherwise.
> + *
> + * Caller must ensure bio has bio_crypt_ctx.
> + *
> + * Return: true on success; false on error (and bio->bi_status will be set
> + *  appropriately, and bio_endio() will have been called so bio
> + *  submission should abort).
> + */
> +bool __blk_crypto_bio_prep(struct bio **bio_ptr)
> +{
> + struct bio *bio = *bio_ptr;

Why is the bio passed by references?  As far as I can see it is never
changed.

> +
> + /* Error if bio has no data. */
> + if (WARN_ON_ONCE(!bio_has_data(bio)))
> + goto fail;
> +
> + if (!bio_crypt_check_alignment(bio))
> + goto fail;
> +
> + /*
> +  * Success if device supports the encryption context, and blk-integrity
> +  * isn't supported by device/is turned off.
> +  */
> + if (!blk_ksm_crypto_cfg_supported(bio->bi_disk->queue->ksm,
> + >bi_crypt_context->bc_key->crypto_cfg)) {

The indentation here looks odd.

> + bio->bi_status = BLK_STS_NOTSUPP;
> + goto fail;
> + }
> +
> + return true;
> +fail:
> + bio_endio(*bio_ptr);

This seems to fail to set a status for the bio_has_data case,
and setting the status for bio_crypt_check_alignment should be moved
to here, where we also end the IO.

> + * __blk_crypto_rq_bio_prep - Prepare a request when its first bio is 
> inserted
> + *
> + * @rq: The request to prepare
> + * @bio: The first bio being inserted into the request
> + *
> + * Frees the bio crypt context in the request's old rq->crypt_ctx, if any, 
> and
> + * moves the bio crypt context of the bio into the request's rq->crypt_ctx.
> + */
> +void __blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio)
> +{
> + mempool_free(rq->crypt_ctx, bio_crypt_ctx_pool);
> + rq->crypt_ctx = bio->bi_crypt_context;
> + bio->bi_crypt_context = NULL;
> +}

This seems to be called in case of the both the initial request
creation and merging a bio into the request (although only the
front merge and not the back merge, which seems weird).

But even then the behvior seems odd as bio->bi_crypt_context becomes
NULL as soon as the bio is attached to a request, which seems like
a somewhat dangerous condition.  Maybe it works, but is it really worth
saving a little memory?  Why not just propagate the context of the first
bio to the request, and free them when the bio is completed?

Why do we always take the context from the bio instead of keeping
the one in the request?  After all we merge the bio into the request.

> +void __blk_crypto_rq_prep_clone(struct request *dst, struct request *src)
> +{
> + dst->crypt_ctx = src->crypt_ctx;

Probably worth just open coding in the only caller..

> +
> +/**
> + * __blk_crypto_insert_cloned_request - Prepare a cloned request to be 
> inserted
> + *   into a request queue.
> + * @rq: the request being queued
> + *
> + * Return: BLK_STS_OK on success, nonzero on error.
> + */
> +blk_status_t __blk_crypto_insert_cloned_request(struct request *rq)
> +{
> + return blk_crypto_init_request(rq);

Same.

>   __blk_queue_split(q, , _segs);
> @@ -2011,6 +2015,15 @@ static blk_qc_t blk_mq_make_request(struct 
> request_queue *q, struct bio *bio)
>  
>   blk_mq_bio_to_request(rq, bio, nr_segs);
>  
> + ret = blk_crypto_init_request(rq);
> + if (ret != BLK_STS_OK) {
> + bio->bi_status = ret;
> + bio_endio(bio);
> + blk_mq_free_request(rq);
> + return BLK_QC_T_NONE;
> + }

Didn't Eric have a comment last round that we shoul dtry this before
attaching the bio to simplify error handling?

> +#define BLK_CRYPTO_DUN_ARRAY_SIZE(BLK_CRYPTO_MAX_IV_SIZE/sizeof(u64))

Please use whitespace before and after operators.


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH v10 02/12] block: Keyslot Manager for Inline Encryption

2020-04-22 Thread Christoph Hellwig
> +bool blk_ksm_crypto_cfg_supported(struct blk_keyslot_manager *ksm,
> +   const struct blk_crypto_config *cfg)
> +{
> + if (!ksm)
> + return false;
> + return (ksm->crypto_modes_supported[cfg->crypto_mode] &
> + cfg->data_unit_size) &&
> +(ksm->max_dun_bytes_supported >= cfg->dun_bytes);

Nit: why not expand this a bit to be more readable:

if (!(ksm->crypto_modes_supported[cfg->crypto_mode] &
cfg->data_unit_size))
return false;
if (ksm->max_dun_bytes_supported < cfg->dun_bytes)
return false;
return true;

> +int blk_ksm_evict_key(struct blk_keyslot_manager *ksm,
> +   const struct blk_crypto_key *key)
> +{
> + struct blk_ksm_keyslot *slot;
> + int err = 0;
> +
> + blk_ksm_hw_enter(ksm);
> + slot = blk_ksm_find_keyslot(ksm, key);
> + if (!slot)
> + goto out_unlock;
> +
> + if (atomic_read(>slot_refs) != 0) {
> + err = -EBUSY;
> + goto out_unlock;
> + }

This check looks racy.


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel