Received: by 2002:a89:2d5:0:b0:1ef:f8eb:5d24 with SMTP id d21csp190003lqs; Sun, 17 Mar 2024 17:33:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5Ff8GTX0DZVEOONyh4Tl5iSIBRFxk5sfm9IBjGnquF1KBPPFsjwOp9igEW15xQbpgQitZKoAJkJcVLsksuMKVN9CttY5PdC0zfRD/qw== X-Google-Smtp-Source: AGHT+IGaT+IwOKm35vHGkH6zD7M/QOutiRJmKagJC9nbmneJnLHcUmEaOnSl4cOcTz6rTzP4Fr+l X-Received: by 2002:a17:902:e752:b0:1df:fda8:e0ea with SMTP id p18-20020a170902e75200b001dffda8e0eamr5088279plf.28.1710722039394; Sun, 17 Mar 2024 17:33:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710722039; cv=pass; d=google.com; s=arc-20160816; b=YjqBQb0L2yy734Xyn5cmCr2QpjA+m6ivbHZYBgr+qqhVl9S4kndw0VdsQ7nXHp5RlT DA6LPLTvVOUKXsTjx+P9sgQSYj/o24xBu01bjRqYnitAB8LTzdzTw4eTuYz2f4mI48BZ iisqGYdrbxW5TCP2bEH35M+1zRQXDaWYzm0kOIB5avXWGQ1ia0FmbKjIKm/Z8kNOXeq6 us1P2/nhuRL5WYUXKjRW4/aofWAO8oaR1hU9bjgALn3bl2Fl291ynbxhLoELKmrC9/I0 RUDJjOw6j8YGskXGPmWrxITKb9BzQqNQVe0jAI6Qsv9aJvbY0RiWJMTj3p1l4xCxZYlO xxYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=DfhnDW5OGlo/pr+6UOixZkMPM1UIxu68W5Spy7o3JkA=; fh=8Pjm2hTosh5+glRe9wdJnULW3gHrv7xHEdAcfJ+/aVo=; b=wr4oxuUGfsJew7HOmkPUv2taA4pJGm6PqmX3PXQTTVW4/2HbRbFY8hKRfLYHcSN2cJ /ka9qmgt07bEVTw+1MIsL/X5ZgBgYUjVIxXafVHLiJ7u4IKUcbiTXEZ52HI1QS5lmRj+ m6r9Emo8Uklmqjn2TL6tnuW1sL4GLWdjmF0JlewrXrf/eEqogNGaFajFNqdgN6j4dmyh voKhtmmuUtfs3zfXKsAqAxdKqLozy+HmJTYZEPPF2G0UGfJn80E/KkgbB6QWMq9X60t4 4gXljHFJ9p9Y272CGMHP7aH/+RLSw3bjmQXRJnCpU6Jg0bhsRrpK8aKvjV7ZU16sKwNX dbaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Qezxlb9f; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-crypto+bounces-2700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2700-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q14-20020a170902a3ce00b001dffd28cac7si3328121plb.51.2024.03.17.17.33.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Mar 2024 17:33:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Qezxlb9f; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-crypto+bounces-2700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2700-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 41928B215A1 for ; Mon, 18 Mar 2024 00:33:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 463B2E57E; Mon, 18 Mar 2024 00:33:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qezxlb9f" X-Original-To: linux-crypto@vger.kernel.org Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B609AD23; Mon, 18 Mar 2024 00:33:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710722028; cv=none; b=t4fRPKE5LSGTe9nZkNv/itT69lpcWX15pVlfa7ofNpRCHzfgX4/0C0p2swj+MGGywov3PvE+ENuXCgRuP5TNieg3mFf7dgiXUIDsmwFZScaoYXV/mdd4NyQj1DIdryae+8GqxmPiKm8XKrbXgRP3FiPaPJz4vyLO/+Qz0MDgoJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710722028; c=relaxed/simple; bh=psz1eCidTIDSQgxOYHEcO2MpAtuGi8B5che1X86lyto=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=n7tzF+J1hkI/f86+Ts4SB+kzh9btl/7C0tSWc3ge+70bpaBcwlIBHeuNE+L1xAj0fwKs3VPEmCW5gOD8V9cmj30CCemKSliJye0sc9BOUPVf9h1+Q0vMlAwkAbzQNUpY263Ad+0kxFtpLo9vywK9X4CNoxH91OpJVkWeAgFsI0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Qezxlb9f; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1dd10ae77d8so22835425ad.0; Sun, 17 Mar 2024 17:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710722026; x=1711326826; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=DfhnDW5OGlo/pr+6UOixZkMPM1UIxu68W5Spy7o3JkA=; b=Qezxlb9fEwDK3u56jCik5iIgbIKWsqsWQu7FEQl+Z34adNBblshoEfDcalQ/mSDMIA /iS2N8FVD45FWl1HXS08LHTW/9m3W6J/1hDV3TWFrChqqnr+llXvMlzLa4Grk0heCMf3 g/UmW1oSWG+iAIGhHxywntB1oYl52Lc/c3SisqohDZKBsjDAkklk3oc6YF2nzVzyLLh5 1KYDqSy15XRdWroadtMEj01aVkns4DvvIhiacNgj1+DZqx1KrV+m2cfadmcg7r8f1c3O eKtUv3+1BAGjoIAFVmG4A3rTKntrwJ+RlDFevX7zReZZqI7IN0qRPyJ9RTu1quZ3PgCe looA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710722026; x=1711326826; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DfhnDW5OGlo/pr+6UOixZkMPM1UIxu68W5Spy7o3JkA=; b=BKR832s/NP7eadTjej0/hgdlHDRSYw129GhIMY1Mq+iK8zZdyNCQHfaMN1s4/MnkWx mwnLAcMbJsX0utLwwDRLGtvMIgfpbHVVUE3ylVQD5CIQv0k4FMvej09EaLPqArA3fhzF FB4jl6v2rQI6TR3O7cYnwiit/AXOupUSNsBfuUP9ZKD7UkN44asLca8r9SuLxI4tkrS4 fiWSlIyHFw0RjIzW/EBBjlr3ig4y4xRcYl65WLWYg914R4A01sXj98STnNBkCxMJYQw8 Tvh/s1XuQ0SsMLIywwezAQDJGSUJuPw1Q1/UZl1zX04SHcFnmF1qockPBEGOYfB4Y+S9 gnJg== X-Forwarded-Encrypted: i=1; AJvYcCX2b1m4falwWKEVKsz1TwpkTnTvk/6NyVui56NUbV4KEeyXcdPzsbrcMv/B87BfA+9Ez4cW1v1+S06d2N2WrV+beKvpKkOAyfJ59ex9b40CsN7U177xn6h7dqg7rQ/M3oN7UAse16HannVJ X-Gm-Message-State: AOJu0Yy2jpSfpEjBbcgyYCn8eoN6p7q/8z3fRZSqx4jFBXBHNnDCxsM1 7J/kVKz9A8YLhEubzDheWKohEontvwALDBRqr19oAoMbYusRnAF4 X-Received: by 2002:a17:903:2282:b0:1e0:e11:c631 with SMTP id b2-20020a170903228200b001e00e11c631mr3442856plh.34.1710722025684; Sun, 17 Mar 2024 17:33:45 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id p6-20020a170902eac600b001dd689a6ff4sm7789618pld.227.2024.03.17.17.33.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Mar 2024 17:33:45 -0700 (PDT) Sender: Guenter Roeck Message-ID: <92746b1d-6993-43a2-9245-adda3d9b7e79@roeck-us.net> Date: Sun, 17 Mar 2024 17:33:43 -0700 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7] crypto: scompress: remove memcpy if sg_nents is 1 and pages are lowmem Content-Language: en-US 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 , Johannes Weiner , Nhat Pham , Yosry Ahmed , Chengming Zhou References: <20240301192745.14987-1-21cnbao@gmail.com> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5f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FZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3/17/24 17:21, Barry Song wrote: > On Mon, Mar 18, 2024 at 8:14 AM Guenter Roeck wrote: >> >> On 3/17/24 16:48, Barry Song wrote: >>> On Mon, Mar 18, 2024 at 7:13 AM Guenter Roeck 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 + #endif /* _XTENSA_CACHEFLUSH_H */