Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1580016rdb; Mon, 2 Oct 2023 14:17:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbwMdC9chX24wXUo5AUOZs6r29DcCHcDOC/Hf51FZr4px+nM1WltWRUX9w3hAazqzkKdgk X-Received: by 2002:a05:6a20:1593:b0:126:42ce:bd44 with SMTP id h19-20020a056a20159300b0012642cebd44mr1153056pzj.17.1696281448773; Mon, 02 Oct 2023 14:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696281448; cv=none; d=google.com; s=arc-20160816; b=MkIY0EHHonB7CkwDeaUo57FJrpQ/s9Md3XJa3uaA4An/g1wFO9H7RgRtEVw/Qkhpf4 JMZuBs5S6rXokDVxaYGC/xTd2p6L1ctmPLr264hzvLMVINry3nsIPaId7WstVefO1aQP KtiJjDOG9d++DFcM9zqnbyKa9AAhdVFvhLxXktRVHvKW0iWJHO/8h21InOw2CIyqiw6b 9Ufd6Vc6IZYAfV26ZJDuWVpki6Qz2Sn2X63gAgzqBZL3Wip50TCgHmJIytO7Fo5BmZF5 VY5Kk0ZuzpVX8SVO4RfsFFOLqe20O28AYxGfFz5kLQ0AeULDC4ygQiJdWyEJOwULWrCL 0f9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :feedback-id:dkim-signature:dkim-signature; bh=N+N+eDyJwbmWM7IQgkOKLUE0MMGHc0rbju4i4SQwITA=; fh=INHUQXWjlkz66JakBsXa4bTezieZP48YHyxNIZoPfiI=; b=jF8asuO0wVRNSBhdGUJF2eE/No5TkFUWA9Jo4dFCexqGqvyxyiKQUxGrI3Pw0ClZAn sXfeWUuPq5vVxwezQVnZg5Eq0Zut1a1f2xg7Sk1ZyP6ghRSDVQXL1880tHQ/I9IcPyxx sHt/FnKcYidUAi/41H5uGzOC2u5CLFGrSnBAyaMBNvWJ8FiJOirLU7TojMgO58RosILL hkJ0RikEt7mBmcujJ2KQBSHnVV0GlNlFlFy3d7m/l4N3pUlAZJZHvpmguHNy7ammYCil 31SgqIkoSVX38LfbjPh0rChMZtrUD7yF1WOdrAA8z+1X4tPeRSmPwLIzifr8MMDZE/wb p6nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=o1r4Xi4X; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=NrBhK+tH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id g127-20020a636b85000000b00573f9a427d6si26541977pgc.450.2023.10.02.14.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 14:17:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=o1r4Xi4X; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=NrBhK+tH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C4282809F396; Mon, 2 Oct 2023 05:16:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236890AbjJBMQC (ORCPT + 99 others); Mon, 2 Oct 2023 08:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236847AbjJBMQB (ORCPT ); Mon, 2 Oct 2023 08:16:01 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B766AB7 for ; Mon, 2 Oct 2023 05:15:56 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 56F283201213; Mon, 2 Oct 2023 08:15:52 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 02 Oct 2023 08:15:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1696248951; x=1696335351; bh=N+N+eDyJwbmWM7IQgkOKLUE0MMGHc0rbju4 i4SQwITA=; b=o1r4Xi4XRpANR4t1+OSUZfhXOPXLnO41r7vbPsDeVb/+vEdcfs3 zx9fvT7d+ZpTFILgo8Br49VSu2yNjOWgIxiJW0O0mJLm/ZZjDiGVmLptlj3HHluo XGm68ltfM2SCPAXIpdnaQISeHqmUVplVIaTRcVbnArlMegzun52FL9S82F6njxMh Iq9ANq67K6qxE2UURxTUDFAS+d6xiFxLOKbUMYUGagxumDKUbI9HEOTFnPYbNryA qOqvasYQvCjQqhrFMV0ordePTlyfR32JaQm0KO9HVByox2u0UTRBvh+5Q9qoh3Bj qySzLUgikjMWIETztxXmiRrSNQyPOqf8eDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1696248951; x=1696335351; bh=N+N+eDyJwbmWM7IQgkOKLUE0MMGHc0rbju4 i4SQwITA=; b=NrBhK+tHsuOJycJmvBrNcCCel/68YdBEklbH/JyGT7hXxWa16xC czCJStwi5e8nArlvM/ewzEIKUS4UVAJNVmc4DUBO/dsun5xbgiUcY/gsE8Cy+Pr4 Lgpnf+Ir5sgwq+BLKeyVMQUg0YtFwQo+NVep3rPvqESpa3NyCt5zreALGqgAKzu4 eLRPRWDSBa+n3EUfUjqZ/KmoC49DDRjmT/bx1sA8EawdKSbT6cWNowbjWTwdfEW9 F2GT285uHFbooZ5PC+fEbk/FXEhqgeXCkxwKp3aC/1M40QjOfkSDgTo/N37Fvsj8 BKh/gyHN1Quz4+/Or/eC09BKTUJLSJTkGZA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdelgdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepgeefjeehvdelvdffieejieejiedvvdfhleeivdelveehjeelteegudektdfg jeevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 5578EB60089; Mon, 2 Oct 2023 08:15:51 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-958-g1b1b911df8-fm-20230927.002-g1b1b911d MIME-Version: 1.0 Message-Id: In-Reply-To: References: <20230912072740.2544-1-jszhang@kernel.org> Date: Mon, 02 Oct 2023 14:15:30 +0200 From: "Arnd Bergmann" To: guoren , "Jessica Clarke" Cc: "Jisheng Zhang" , "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , linux-riscv , linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: errata: thead: use riscv_nonstd_cache_ops for CMO Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 05:16:28 -0700 (PDT) On Wed, Sep 13, 2023, at 02:06, Guo Ren wrote: > On Wed, Sep 13, 2023 at 3:00=E2=80=AFAM Jessica Clarke wrote: >> >> On 12 Sep 2023, at 11:53, Guo Ren wrote: >> > Please remove the thead_errata_cache_wback because T-HEAD processors >> > would prioritize using an invalid cacheline instead of evicting an >> > existing cacheline. When we do dcache clean, the following operatio= ns >> > are to let other interconnect masters read. So, keeping wback_inv f= or >> > T-HEAD processors is the best choice, and maybe some other processo= rs' >> > vendor has a different idea, but please use the wback_inv instead of >> > wback_only for the T-HEAD processors. >> >> Unless you can demonstrate that your cores have significantly worse >> performance when using wback instead of wback_inv I do not think the >> non-standard implementation should deviate from the semantics of the >> standard one. There are efforts to unify the implemented semantics of >> the operations across architectures and this would obstruct those. > > I'm afraid I have to disagree with the view that this obstructs > "unifying the implemented semantics of the operations across > architectures." > > static const struct riscv_nonstd_cache_ops thead_errata_cmo_ops =3D { > - .wback =3D &thead_errata_cache_wback, > + .wback =3D &thead_errata_cache_wback_inv, > .inv =3D &thead_errata_cache_inv, > .wback_inv =3D &thead_errata_cache_wback_inv, > > I don't see how the above patch obstructs unifying. On the contrary, > it decreases the custom function, which could help unify. Could you > give the least respect for the vendor's choice? Since the email thread popped up after the latest replies, I saw that I had not replied yet. I agree with Jessica here: we need to ensure that the callback functions do what the interface requires, across all architectures and CPU implementations. The choice to call wback or wback_inv is a matter of optimization in the caller, and we may well end up calling .wback_inv() for cases that currently rely on ,wback(), if we can show this to be faster on certain CPUs, and other cases (e.g. repeatedly writing and flushing individual bytes to single DMA buffer) clearly rely on keeping the cache line. Other policy questions like whether to use .wback or .inv before a DMA from device also still need a better answer, which we must decide globally rather than per CPU implementation. Arnd