From: Guenter Roeck <linux@roeck-us.net>
To: Barry Song <21cnbao@gmail.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, akpm@linux-foundation.org,
chrisl@kernel.org, sjenning@redhat.com, vitaly.wool@konsulko.com,
linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Nhat Pham <nphamcs@gmail.com>,
Yosry Ahmed <yosryahmed@google.com>,
Chengming Zhou <zhouchengming@bytedance.com>
Subject: Re: [PATCH v7] crypto: scompress: remove memcpy if sg_nents is 1 and pages are lowmem
Date: Sun, 17 Mar 2024 17:33:43 -0700 [thread overview]
Message-ID: <92746b1d-6993-43a2-9245-adda3d9b7e79@roeck-us.net> (raw)
In-Reply-To: <CAGsJ_4xGKFaQPD-KurP2=qiD5zSdnOwZtH-kyASP_PgFX_mJAg@mail.gmail.com>
On 3/17/24 17:21, Barry Song wrote:
> On Mon, Mar 18, 2024 at 8:14 AM Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> On 3/17/24 16:48, Barry Song wrote:
>>> On Mon, Mar 18, 2024 at 7:13 AM Guenter Roeck <linux@roeck-us.net> wrote:
>>>>
>>>> Hi,
>>>>
>>>> On Sat, Mar 02, 2024 at 08:27:45AM +1300, Barry Song wrote:
>>>> [ ... ]
>>>>> @@ -152,8 +165,17 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
>>>>> ret = -ENOSPC;
>>>>> goto out;
>>>>> }
>>>>> - scatterwalk_map_and_copy(scratch->dst, req->dst, 0, req->dlen,
>>>>> - 1);
>>>>> + if (dst == scratch->dst) {
>>>>> + scatterwalk_map_and_copy(scratch->dst, req->dst, 0,
>>>>> + req->dlen, 1);
>>>>> + } else {
>>>>> + int nr_pages = DIV_ROUND_UP(req->dst->offset + req->dlen, PAGE_SIZE);
>>>>> + int i;
>>>>> + struct page *dst_page = sg_page(req->dst);
>>>>> +
>>>>> + for (i = 0; i < nr_pages; i++)
>>>>> + flush_dcache_page(dst_page + i);
>>>>
>>>> flush_dcache_page() is an empty macro on some architectures
>>>> such as xtensa. This results in
>>>
>>> Hi Guenter,
>>>
>>> this is a bug of xtensa, could you test the patch:
>>
>> Thanks for the update.
>>
>>> https://lore.kernel.org/all/20240313045036.51065-1-21cnbao@gmail.com/
>>>
>>
>> That doesn't build for me.
>>
>> CC arch/xtensa/kernel/asm-offsets.s
>> In file included from ./include/linux/highmem.h:8,
>> from ./include/linux/bvec.h:10,
>> from ./include/linux/blk_types.h:10,
>> from ./include/linux/writeback.h:13,
>> from ./include/linux/memcontrol.h:23,
>> from ./include/linux/swap.h:9,
>> from ./include/linux/suspend.h:5,
>> from arch/xtensa/kernel/asm-offsets.c:24:
>> ./include/linux/cacheflush.h:9:5: error: "ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE" is not defined, evaluates to 0 [-Werror=undef]
>> 9 | #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
>>
>> A similar works for loongarch, so I don't know what is wrong.
>> Maybe some context patch is missing.
>
> this is weird as include/asm-generic/cacheflush.h will define it to 0
>
> #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
> static inline void flush_dcache_page(struct page *page)
> {
> }
>
> #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
> #endif
>
> Maybe somewhere else also needs to be fixed.
> Can you tell me your toolchain version and toolchain name? and defconfig name?
>
config is allmodconfig - GCC_PLUGINS.
Toolchains are self-built from gcc source using the buildall system. I tried
gcc 11.4, 12.3, and 13.2. I don't think that matters, though, since
"asm-generic/cacheflush.h" isn't included from arch/xtensa. The diff below
seems to fix the problem, but I have not fully tested it.
Guenter
---
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index 11efdc8eb262..62662919cbbc 100644
--- a/arch/xtensa/include/asm/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
@@ -183,4 +183,6 @@ extern void copy_from_user_page(struct vm_area_struct*, struct page*,
#endif
+#include <asm-generic/cacheflush.h>
+
#endif /* _XTENSA_CACHEFLUSH_H */
prev parent reply other threads:[~2024-03-18 0:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 19:27 [PATCH v7] crypto: scompress: remove memcpy if sg_nents is 1 and pages are lowmem Barry Song
2024-03-08 11:26 ` Herbert Xu
2024-03-17 23:13 ` Guenter Roeck
2024-03-17 23:48 ` Barry Song
2024-03-18 0:13 ` Guenter Roeck
2024-03-18 0:21 ` Barry Song
2024-03-18 0:33 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92746b1d-6993-43a2-9245-adda3d9b7e79@roeck-us.net \
--to=linux@roeck-us.net \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chrisl@kernel.org \
--cc=davem@davemloft.net \
--cc=hannes@cmpxchg.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nphamcs@gmail.com \
--cc=sjenning@redhat.com \
--cc=v-songbaohua@oppo.com \
--cc=vitaly.wool@konsulko.com \
--cc=yosryahmed@google.com \
--cc=zhouchengming@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).