Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1196759lqt; Tue, 19 Mar 2024 16:23:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULnwzzc6atgJDWmRhkpQ72uu191JSeORsLPFZlWhehel592B/JPwX3VAGY4yiS05IeZWjKC+8MYzrFfDqXmPDi0p83YZRdkxUUX5UdZg== X-Google-Smtp-Source: AGHT+IEY+I5Yzk/pSNi+NQQl5CjiHhgW/davO5j4pj8sNz0vFAVRyXSS1TIWAMeH58cuK/I3gDDY X-Received: by 2002:a05:6a00:3d15:b0:6e7:312e:e2ce with SMTP id lo21-20020a056a003d1500b006e7312ee2cemr6567377pfb.8.1710890606058; Tue, 19 Mar 2024 16:23:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710890606; cv=pass; d=google.com; s=arc-20160816; b=Ln8y7EARhDOwZvpplqEncdWKQ7gsURIsSWcgbXfX/GD4qYP8IbDYJyLcwXD2a4Fmf8 Hp+OtwMJfMGn/y2BLzHi36BiRek/DpDMxP99BwC6tPlLEXtOacH5fYAl7bhhEkbYDiEg ZsAaXndqgzoRS0FqFFNTqOH3OthuRPlkAP/7HnynLWLyWHiG0wb/QIdQUzjiDvzFy/Kp zHxLd/scog+zNNOWA9WZrkRfhAJHtEDQAb3H+1RxbO1LGqrffy4hmVVW7KCofYE0gPu0 G43EX3wkRz3tZUdpizlwJa1u3KhAdqx6nHXBxjuduUXL7JGQZ2q43GafCZsR88598MsB xVVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=U+4A2h4w8QtM3WAY0aEieq/AhMxGRQzY01tqgJ4WnAs=; fh=mzL8KCrWNWLq3GQW3sZZoybxfbWmWcnFJYiTjbGK7A0=; b=Yu6RSC5U2Un2eFEoYpY2dfhkomv9ADi74q/js5FbMMtjtpp1hqnI4f/YTVa5xl7pDp POSLBPOczug0puCHSg3cvaMaOxTBNdfcH1bThT94fxADblyq207vOLOoyUF61eA+zbOH COFTOTaN40DUpWjo7/ANYuxOBgH4VLjA88sG1FU3uv1Kxao9Zn6j2FiN/1ucU+wbBy2F U3HGiAZ2yhfAurCenuPhlUQlvMgfN0avdFbMqO7dvXfXooXE0ZSLjmcL+xKHy/41axa8 ZGi+k8YNScwH8wOdWFqCXgFuwY/YU3kRXbEED5gSDvIV3+Y3C0Uxi/3OFFOePtBM1JSI ObRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DpZsMoc0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-108231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d1-20020a654241000000b005dc958db2fcsi11110160pgq.363.2024.03.19.16.23.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 16:23:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DpZsMoc0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-108231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B63FB283E75 for ; Tue, 19 Mar 2024 23:23:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C62D5FBAE; Tue, 19 Mar 2024 23:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DpZsMoc0" Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com [209.85.222.43]) (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 02DD65A4E9 for ; Tue, 19 Mar 2024 23:23:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710890590; cv=none; b=CBkS5+eY1R1p8uATbh5Hi1gI0TKKi89/BID29CWIJpVG1eii3888sYbvmjgGuEqFtkw0eUgWRPdHmMt9Iz/Rq8+83dPyiwfCtQzHWwSSlLKjGnPAQPth4I4WE2shw5TSXC3Yn6IlVsMKr0gdqGbGNjvu22EizFdF3hmxGQx+Ytk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710890590; c=relaxed/simple; bh=MnNt/VMa4IT3l390prhhkwK9TVqN7CpO5cntvcTaBgk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=vA1vUvrmiCSNQB5ED+UxrBSc24jqY7tfzLphw2tCiEE3T0+KdRtuRVFGu0gKzlGqvVDXwBzOP6dDu+KXkIm7u/g14O817bOvwMsQEh6B4emPPPSnrAS1pSV4fXrNoItE33HB3T2yenvt1IeUcpHmYfVNk/zq8ilcnS45kqHdJXw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DpZsMoc0; arc=none smtp.client-ip=209.85.222.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ua1-f43.google.com with SMTP id a1e0cc1a2514c-7e05d6871ddso1001518241.1 for ; Tue, 19 Mar 2024 16:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710890588; x=1711495388; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=U+4A2h4w8QtM3WAY0aEieq/AhMxGRQzY01tqgJ4WnAs=; b=DpZsMoc0nRjGQibYws/iVrUM4CRW97yv8TjlsT4or26ZAD29tGDLqQ00L9LRqf3U2F re1FNHqSN1g40B5uKAfClbk4oT6TCIQcXBJbu9Us/NhPnQy5Qo5JDE9+QPKz570U5fsT vgcaMn1zZMdJ7zx3u7qnJN7upQT98kTncpR4+35OMrfRqRwXjx8vioX9A5m8m6MWHpDt W4Liepgj0untQ5N3fwcMa8IaIPqtoXdtstlRdgHuLXOXZRH65k3kAkE6IKq+6GVRlZv7 eWB6yqnrSC4gk+DpG0Kp9ZumzXTdPqlHdgmEM6AIPD6upZDHgk71azJ+4Qxg/W8djNEs AmKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710890588; x=1711495388; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U+4A2h4w8QtM3WAY0aEieq/AhMxGRQzY01tqgJ4WnAs=; b=cDN0sLLjvlEg9U7JDMFq0OzvtUChEVG+2Z+xui20FHoyknnrKDzdvlsVEQh2zqTdEP sWL+gdf1CDj47r/DLotFkAq3Il9n1BxP4f18q66LcvOxXz5NKk25ikd4Ema3Nn3FdvvK u0EBMHwbyJeVr4moDauBYmzG97YZNg5KxJwqHF7SX1WvuFrOIP7b1gEIaSqSryxlD0GA 4ZUazy6vM+pOdWw94pLyIIY7v1FW2hguHL1iJIY6EDhZhE+lUKDN771eF7zQxSctWp8z umItwQ8z8v6uOC05DjdUh4xVl3dSlTg+LeDPXAezSLze8kZTiE37sNmQQcctXUnK3PA/ fmDw== X-Forwarded-Encrypted: i=1; AJvYcCUqjJUuq21FbPx+SSpIEUpHtfSR2g8lX5p9efOKPjgG3afGHjCgsQ6jrUhniCbaOAqt3O1QTieXOe07HBIEply6pJbP25fwcwpfwrbN X-Gm-Message-State: AOJu0Yy6iYcEWtOYas9VFfLkuIUeCGmyuuskCQH0KZI4xdxkY77E76j5 KdMncsYtofiD0S+Rtg3RZSWyrb9CkrYvSVFuZhvAEj9qO8QNqmpip/Zs+zUqdxC5/Z0EcD2MdaW 0xF/kkUwzd6JSS0dDndeRvdIjdWs= X-Received: by 2002:a05:6102:3126:b0:476:396:486c with SMTP id f6-20020a056102312600b004760396486cmr10709817vsh.15.1710890587752; Tue, 19 Mar 2024 16:23:07 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240319010920.125192-1-21cnbao@gmail.com> In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Wed, 20 Mar 2024 12:22:56 +1300 Message-ID: Subject: Re: [PATCH v2] xtensa: remove redundant flush_dcache_page and ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE macros To: Guenter Roeck Cc: chris@zankel.net, jcmvbkbc@gmail.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, willy@infradead.org, dennis@kernel.org, alexghiti@rivosinc.com, Barry Song , Huacai Chen , Herbert Xu , kernel test robot Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 20, 2024 at 3:18=E2=80=AFAM Guenter Roeck = wrote: > > On 3/18/24 18:27, Barry Song wrote: > > On Tue, Mar 19, 2024 at 2:09=E2=80=AFPM Barry Song <21cnbao@gmail.com> = wrote: > >> > >> From: Barry Song > >> > >> xtensa's flush_dcache_page() can be a no-op sometimes. There is a > >> generic implementation for this case in include/asm-generic/ > >> cacheflush.h. > >> #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE > >> static inline void flush_dcache_page(struct page *page) > >> { > >> } > >> > >> #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 > >> #endif > >> > >> So remove the superfluous flush_dcache_page() definition, which also > >> helps silence potential build warnings complaining the page variable > >> passed to flush_dcache_page() is not used. > >> > >> In file included from crypto/scompress.c:12: > >> include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone': > >> include/crypto/scatterwalk.h:76:30: warning: variable 'page' set b= ut not used [-Wunused-but-set-variable] > >> 76 | struct page *page; > >> | ^~~~ > >> crypto/scompress.c: In function 'scomp_acomp_comp_decomp': > >>>> crypto/scompress.c:174:38: warning: unused variable 'dst_page' [-Wun= used-variable] > >> 174 | struct page *dst_page =3D sg_page(= req->dst); > >> | > >> > >> The issue was originally reported on LoongArch by kernel test > >> robot (Huacai fixed it on LoongArch), then reported by Guenter > >> and me on xtensa. > >> > >> This patch also removes lots of redundant macros which have > >> been defined by asm-generic/cacheflush.h. > >> > >> Cc: Huacai Chen > >> Cc: Herbert Xu > >> Reported-by: kernel test robot > >> Closes: https://lore.kernel.org/oe-kbuild-all/202403091614.NeUw5zcv-lk= p@intel.com/ > >> Reported-by: Barry Song > >> Closes: https://lore.kernel.org/all/CAGsJ_4yDk1+axbte7FKQEwD7X2oxUCFrE= c9M5YOS1BobfDFXPA@mail.gmail.com/ > >> Reported-by: Guenter Roeck > > > > Hi Guenter, > > I am not a xtensa guy, so I will need your help for a full test. if > > turns out it is a too big(ambitious) > > I sent a Tested-by: tag to your patch. As far as my testing goes, it work= s fine, > and I added your patch to my "testing" branch (which tries to be buildabl= e > and testable for all architectures). Thank you very much, Guenter. It would be nice if xtensa can leverage the common cacheflush.h just like other architectures. > > > fix, a minimal fix might be: > > > > FWIW, I think a minimal fix would have been to mark the variable as __may= be_unused, I am not quite sure we want this as the point is that drivers should be independent of architectural differences. The driver code, for itself, seems quite innocent, struct page *dst_page =3D sg_page(req->dst); for (i =3D 0; i < nr_pages; i++) flush_dcache_page(dst_page + i); The only problem is that xtensa's flush_dcache_page is a macro and doesn't use the "page" parameter. if we re-use the inline function in common cacheflush.h, it won't be a prob= lem. > but as others have pointed out it would be nice if there would be a guida= nce > about optional API functions like this one that specifies if it may be > implemented as macro and, if so, how it has to handle unused variables. I agree. personally I like this and will have a go in Documentation/process/coding-style.rst and see others' opinions. > > Thanks, > Guenter Thanks Barry