From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5258C433F5 for ; Mon, 10 Oct 2022 06:59:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF3E56B0071; Mon, 10 Oct 2022 02:59:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA2BE6B0073; Mon, 10 Oct 2022 02:59:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6A516B0074; Mon, 10 Oct 2022 02:59:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C50C06B0071 for ; Mon, 10 Oct 2022 02:59:52 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8299816019C for ; Mon, 10 Oct 2022 06:59:52 +0000 (UTC) X-FDA: 80004139824.20.5245A96 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf13.hostedemail.com (Postfix) with ESMTP id F117E20026 for ; Mon, 10 Oct 2022 06:59:51 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id r14so258830edc.7 for ; Sun, 09 Oct 2022 23:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=a1fp9+rKdmUuY9SWEnGxIrNFPj6sCTeRm1jad3ZuU2k=; b=FqrGflI7dLXRUElNttQgSWoongr4d8SuEdNC1fduJnVRmwF7qBcfQVFzWid8PMFt+s 7RqYMvKsPB6GRY/URbX18HMMxazMGYmo2e6kxaqeoi5GesaXhlmxx+N+g1kNAmbczspz cGB/PNdhsdJsnzmCEBtMlExsqZ0GQPYU+8pAuj52cRHXqBkpDda2Sj+9fUOMSwYbGNFl yLlfy+9767CpJ4Q5wNkXn6WlHi9dVVsRk6LNp1RB1QyUHW2qg2eSerenIa/NX9e0OBQP dGftZ/Enkr+aZ+5HG1dOZ7kA2G6h7ORDqQwB3Gsy07ZiW6uO/qRRJ+yaXMfwhsuuL/wz 8/gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=a1fp9+rKdmUuY9SWEnGxIrNFPj6sCTeRm1jad3ZuU2k=; b=UAU9JhO7jCOZdglmB68m+xldaqjh0MrQOMhbxA5hcyqNILt16Tmr77kSsDafX8XPc4 6EIq9tBB7fDstW5jSz0POh+X6RMHT0sCH3sVt+z5KoNa6dgdPkJgUwD+UoeYMT5hEMhz 4qWcvzf0I5SMQSNNbrG2Xtbs0OZyWT5kInYyNtQjyZWKMN9fmicUjGM/ajDCYJEwGG8B NNYzuQuxBas8qKWxvYjUmkn9JQs3JE1BLjcGqtprRqHEAlsLk/M9eQ1Bst7dzxvms2JZ YPvwmVk0k4T84OsmHSuxAqXSzlXPu3tpBu//OvRspoky1iacg1aZBkYoCu5unIFtekBH JCDg== X-Gm-Message-State: ACrzQf3+Kex9e0kynAWcNLAXmkOwddqJPiL+HWkhnyHR6h7uaUiosf2l SCghd5F/CiWU0aE3DloeKSnAXQ== X-Google-Smtp-Source: AMsMyM5iAaOQ7Q85SCGa9a1GKDPTYFqnf6CENRfzpNWykMCCmv5ldmO3+wQqqF2asmYJsnnE3P9hgg== X-Received: by 2002:a05:6402:5106:b0:45c:2c80:94a4 with SMTP id m6-20020a056402510600b0045c2c8094a4mr2002943edd.298.1665385190546; Sun, 09 Oct 2022 23:59:50 -0700 (PDT) Received: from localhost (cst2-173-61.cust.vodafone.cz. [31.30.173.61]) by smtp.gmail.com with ESMTPSA id m30-20020a17090677de00b00779cde476e4sm4898631ejn.62.2022.10.09.23.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Oct 2022 23:59:50 -0700 (PDT) Date: Mon, 10 Oct 2022 08:59:49 +0200 From: Andrew Jones To: Conor Dooley Cc: Vernon Yang , lkp@intel.com, anup@brainfault.org, atishp@rivosinc.com, kbuild-all@lists.01.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH] RISC-V: KVM: fixup undefined reference to riscv_cbom_block_size Message-ID: <20221010065949.is3kf54ctt2kdmjd@kamzik> References: <202210091222.xuZquaM9-lkp@intel.com> <20221010013329.199167-1-vernon2gm@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665385192; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=a1fp9+rKdmUuY9SWEnGxIrNFPj6sCTeRm1jad3ZuU2k=; b=GXFsxfFp9SyGeC7y0Zovpbauh3SgvxMzFE4wDH4RqfA1N5xsiRoMl1nJiduoTg1EFNSlCV yhkcErz82xKUM+buHDbFUtsdtjZRShJbUTfyqqwCw+52eXe8w1FAEBJqegG8Ys3n7qyZ0Y LOTNyK9bIr6n1hGsbYznXCvqdHMUOqY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ventanamicro.com header.s=google header.b=FqrGflI7; dmarc=none; spf=pass (imf13.hostedemail.com: domain of ajones@ventanamicro.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=ajones@ventanamicro.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665385192; a=rsa-sha256; cv=none; b=tOpA17Pf++jndKtktfrrbm5380vuyJne+JSVt/K3xYNW8A6/9S0wufn09SoZVA+3LPLlvC xe/A7wfNU5OTXh9piJ/HVyNiScbvfnJUPoDpkFaCP2cUoKGBA2tUgrS7fULPfU00r2omNB DDfUFaciim6p5c5wVYHPQuco+7JgHHs= X-Stat-Signature: k85a5cjt9qmmtmphzo3hiumncumew9rc X-Rspamd-Server: rspam09 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ventanamicro.com header.s=google header.b=FqrGflI7; dmarc=none; spf=pass (imf13.hostedemail.com: domain of ajones@ventanamicro.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=ajones@ventanamicro.com X-Rspamd-Queue-Id: F117E20026 X-HE-Tag: 1665385191-589646 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001430, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Oct 10, 2022 at 07:42:04AM +0100, Conor Dooley wrote: > On Mon, Oct 10, 2022 at 09:33:29AM +0800, Vernon Yang wrote: > > When some RISC-V compilers do not support the Zicbom extension, > > the build system auto disable the CONFIG_RISCV_ISA_ZICBOM, so the > > source code of the relevant function is not compiled, resulting > > in the definition of the riscv_cbom_block_size variable cannot > > be found > > Hmm, my understanding was that riscv_cbom_block_size was not supposed to > depend on CONFIG_RISCV_ISA_ZICBOM because the thead is able to use it > even if the toolchain does not support it. > > The code in cacheflush.h looks like: > extern unsigned int riscv_cbom_block_size; > #ifdef CONFIG_RISCV_ISA_ZICBOM > void riscv_init_cbom_blocksize(void); > #else > static inline void riscv_init_cbom_blocksize(void) { } > #endif > > #ifdef CONFIG_RISCV_DMA_NONCOHERENT > void riscv_noncoherent_supported(void); > #endif > > It's early and I only had a quick look but I think that this is not > defined because RISCV_DMA_NONCOHERENT is not defined, not because of > RISCV_ISA_ZICBOM. thead is able to use riscv_cbom_block_size because it does its own initialization of it and selects RISCV_DMA_NONCOHERENT to get access to it. KVM depends on the initializer in dma-noncoherent.c, which is guarded by RISCV_ISA_ZICBOM and does not select RISCV_DMA_NONCOHERENT, but RISCV_ISA_ZICBOM does. I think guarding use of riscv_cbom_block_size with RISCV_ISA_ZICBOM in KVM makes sense. > I'm not the KVM maintainer, but I dislike #ifdefery > in c files, so it'd be nice I think to sort this out in the header and > not have to worry about guarding the variable. I also dislike #ifdefery, but unless we move riscv_cbom_block_size to an unconditionally built file like cacheflush.c (as Anup once did), then we don't have much choice. Thanks, drew