Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp779165rdb; Fri, 8 Sep 2023 16:51:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEznwi6SqtuPNidjR+jeHQLwlYROe9CKb0XK5qRUZdTSUrpfTNHvhEUlm2gtxl9WbTismI5 X-Received: by 2002:a17:902:e88f:b0:1bc:7441:d81a with SMTP id w15-20020a170902e88f00b001bc7441d81amr4580839plg.6.1694217059634; Fri, 08 Sep 2023 16:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694217059; cv=none; d=google.com; s=arc-20160816; b=lCQ9iCWMmG9nzhJKPUOTNad7sS+zPA4k/iR579O9WiiSyj3pvg16Ahnh3r+LyF3xZ7 iNdY2RuasOub/Tsnhiepadx9W4IKUZQuLIkM/c7Ps3wVeQnBdElyW3XiUwgSwg8nRyDf mqXctSbhRcghJnk8unHJIz6HU2MqKx7xWSMtc6kILzIJ9c7I6hQXnk0REji5BxhbwYnt RqApLnGgwi2peoTL6sbzClHTZpL8BNPOvGsVoqPSHdCdEbsoavQZYbC8iW4q6P8nRsBw RqzJM/JWqTsNgwoXrAF9W+Q+KgntcL0qY4FLp5eeC/YO2KDg9OPtxA/Y7jUkqKhm63Gr Pa2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=d1dUW7fJkCquDjjruKJF9ic5ByrdeDFJnU0IlXTs1QI=; fh=JHplNe0D7yx0KePOifiHo+e3RxvRh2oSZmiPH+gAKxQ=; b=HCNuqCLl3du1BCTM0eX8Oph80+n26sFZ54hAxNtSovLvou6gLLnw2tmhuNnZSQtUsz pS+K7uTJdTYa9XBbA3dr8j/EdOV4VMJo+cj1f5HoghTEhjZG3IBEhhJXDGq8rH88mXth KakiVuQLJtcEz/yqvgyu6j6Hcn6CZqmdfvABDBx9BfLVeUeI+B1l3h4so9Xg2EOBTLPk 1+Im1TMHQAkfZK4pcNkYky87/LTDz3wXhkKD+1Rrg2vzj5VaewaW7sizrRGpiITSblCz OcUGcT/L/GaQuxYBfBc/8ot6HB0tU35dnYqHD9ydtXfoySEE+vUy06wZykdHyS/MxgFO 3Urw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DNLBQWL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li11-20020a170903294b00b001ae40e07fb0si2282631plb.216.2023.09.08.16.50.46; Fri, 08 Sep 2023 16:50:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DNLBQWL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244719AbjIHTtj (ORCPT + 99 others); Fri, 8 Sep 2023 15:49:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244353AbjIHTti (ORCPT ); Fri, 8 Sep 2023 15:49:38 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6878926AA for ; Fri, 8 Sep 2023 12:49:16 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-52e828ad46bso3236552a12.1 for ; Fri, 08 Sep 2023 12:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1694202506; x=1694807306; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=d1dUW7fJkCquDjjruKJF9ic5ByrdeDFJnU0IlXTs1QI=; b=DNLBQWL2KZVgU78u3fLxHSc0mygkAU2IEWDxkI3IdmX2GS5y3Bj5/9SaipU4Jl5AQC S469Sz43zBq7HjGO2Rn5WJH6ptzAqtOOlydtXzNyqT6De+oMhPwzlygDD3RnkPDxhmO6 pFIYI5YYLa31RJLIwMWT/0StowSTsU9/vQsA8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694202506; x=1694807306; h=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=d1dUW7fJkCquDjjruKJF9ic5ByrdeDFJnU0IlXTs1QI=; b=YTxyHbj/irzADHze6aeMG6qmtjAL/ih2vMpOsmr6QI1F4wZXQdqJWfz2/5k1rvsTiI Y40WBEx5VFlwLwY9Vvly4N1FWRBzHwdHMdNlRCohZXKLj4ylgEolKXi0rrbU3JxGDR0h b8x3ZLL0tEcI1vT0M310j088o9fD7T8IsL032gywoojyGu4vk1Y7Ay/DhjkIDonUKgG1 +oShDiSnokVA2MgQ/ZCIuZBLOKW31MMAmC+rN5E4a5l9fJz8nN/mWvuJqu1t0uw02dvc CpO52RIvlw9mnItMZlOSI2K1lllN0YY6Xo5jl3xiy3IL4hmcCXPEKaKnfR0XeGiYSf2v /5SQ== X-Gm-Message-State: AOJu0Yy8i+kjxYyh2mSnpspf0sbowQwqmZbDwMC/BUrfjvn7aneWV2AS /Mzgfc6/mX7trLID707S1ysmsERA/oVhFfIb693TN1QO X-Received: by 2002:a17:906:10c9:b0:9a9:fc74:8d50 with SMTP id v9-20020a17090610c900b009a9fc748d50mr2037229ejv.66.1694202506007; Fri, 08 Sep 2023 12:48:26 -0700 (PDT) Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com. [209.85.218.49]) by smtp.gmail.com with ESMTPSA id v14-20020a170906338e00b00992b1c93279sm1422938eja.110.2023.09.08.12.48.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Sep 2023 12:48:25 -0700 (PDT) Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-9a5dff9d2d9so299998366b.3 for ; Fri, 08 Sep 2023 12:48:25 -0700 (PDT) X-Received: by 2002:a17:906:cc12:b0:9a1:e293:9882 with SMTP id ml18-20020a170906cc1200b009a1e2939882mr2646204ejb.63.1694202504918; Fri, 08 Sep 2023 12:48:24 -0700 (PDT) MIME-Version: 1.0 References: <20230908111053.1660033-1-chenhuacai@loongson.cn> In-Reply-To: <20230908111053.1660033-1-chenhuacai@loongson.cn> From: Linus Torvalds Date: Fri, 8 Sep 2023 12:48:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] LoongArch changes for v6.6 To: Huacai Chen Cc: Arnd Bergmann , Huacai Chen , loongarch@lists.linux.dev, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Guo Ren , Xuerui Wang , Jiaxun Yang Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 Sept 2023 at 04:11, Huacai Chen wrote: > > 7, Add KASAN (Kernel Address Sanitizer) support I have pulled this, but please at least consider (a) don't use the stupid and random __HAVE_ARCH_xyz defines Yes, yes, we have historical uses of it. That doesn't make it good. Instead of making up new random symbol names, just *USE* the names you are defining per architecture. IOW, instead of doing #define __HAVE_ARCH_SHADOW_MAP and defining your own helper replacement functions for kasan_mem_to_shadow() etc, just use those names as-is. So if you have an architecture that has its own version of "kasan_mem_to_shadow()", then use *THAT* name for the #ifdef too. Don't make up another name entirely of the form "__HAVE_ARCH_xyz". Example: architectures can override the default generic versions of "arch_atomic_xyz()" operations, and the way you do that is (for example) static __always_inline int arch_atomic_add_return(int i, atomic_t *v) { return i + xadd(&v->counter, i); } #define arch_atomic_add_return arch_atomic_add_return note how the define to let you know the name exists is the name itself (and because the implementation is an inline function, not the macro, the marker is then just a "define the name to itself"). End result: no made-up secondary names for other things. When you grep for the thing that is used, you find both the implementation and the marker for "look, I am overriding it". And also (b) do you really want to inline those kasan_mem_to_shadow() and kasan_shadow_to_mem() things? Yes, the caller is addr_has_metadata(), and that one is "__always_inline",. because otherwise objtool would complain about doing function calls in SMAP-enabled regions. HOWEVER: - on LoongArch, I don't think you have that objtool / SMAP issue - and if you did, the function should be __always_inline, not just plain inline anyway so I get the feeling that the inline is simply wrong either way. Maybe that function should just be declared, with the implementation being out-of-line? It seems unnecessarily big to be an inline function, and it doesn't seem performance-critical? Neither of the above issues are critical, and the second one in particular really is just a "did you really mean to do that" kind of reaction, but since I was looking at this, I decided to write up my reactions. Linus