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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C02FC28D13 for ; Tue, 23 Aug 2022 00:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GLDPYoXtWu44bY53dbBU5g8TQgFZ/7NkAOZtLu2hw1E=; b=AChwpZmNnY/WoN UapcJXdOAJ7DGTkSdzR5V4QtceeG5bHJItXa2igD7FUwDUOT0sxxnKdkPMhf8q0ago8VffXxjODc7 KYB+yLv6fWeEvdz6dwuzm1TKf0J0d5l3Zuk8fmpyDmfi+P8WxEpwpzds/d4Rt6boIYoBpHXnVE5yH aWpZNyCrr6teIJWc8AsiPvXdIewu1A/ZUTaaxubuu8up5jSk4FIGVP50xcGIW4DYJoFxv0L6wZEKC 4Z+QGizoJvuOtvIZ2RZTMM6oxVGQybYw1pg7NC4jrY/yZ2xtB0KEz3fHdbzP2bxukw57rCJfm9ZIU Pa+s5cUOVdLyxlyLhznQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQHen-00GVYG-Ov; Tue, 23 Aug 2022 00:20:38 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQHej-00GVU9-JS for linux-arm-kernel@lists.infradead.org; Tue, 23 Aug 2022 00:20:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661214032; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ard+XQ2JmpaoV1Zy66Z597OHMvsCkwrAtFiswd3hAns=; b=IgFiuzyuO7Ue5AJFsrDdAAbcG/F+OfSrMHUpoKj2vq2THLvMVjGbZm/tDauh23tZDIC/Iz VpnY6Q8nswtI0mdUPdoUbSm1DNNJZB4W88cJ8kFI9E0kPeiaKAVVVxNt8LKe0iZ6S6UxQh KPAGiowiOEaPmCSFy8iHG310ZvI7asY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-399-POZqojPkPHyzqJX0OrHRVw-1; Mon, 22 Aug 2022 20:20:27 -0400 X-MC-Unique: POZqojPkPHyzqJX0OrHRVw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EDC0B1C19762; Tue, 23 Aug 2022 00:20:26 +0000 (UTC) Received: from localhost (ovpn-12-31.pek2.redhat.com [10.72.12.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27F45401B54F; Tue, 23 Aug 2022 00:20:25 +0000 (UTC) Date: Tue, 23 Aug 2022 08:20:22 +0800 From: Baoquan He To: Christophe Leroy Cc: "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "hch@infradead.org" , "agordeev@linux.ibm.com" , "wangkefeng.wang@huawei.com" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v2 01/11] mm/ioremap: change the return value of io[re|un]map_allowed and rename Message-ID: References: <20220820003125.353570-1-bhe@redhat.com> <20220820003125.353570-2-bhe@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220822_172033_744308_6169752F X-CRM114-Status: GOOD ( 30.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 08/22/22 at 06:25am, Christophe Leroy wrote: > = > = > Le 20/08/2022 =E0 02:31, Baoquan He a =E9crit=A0: > > In some architectures, there are ARCH specifici io address mapping > > handling when calling ioremap() or ioremap_prot(), e.g, arc, ia64, > > openrisc, s390, sh. > > = > > In oder to convert them to take GENERIC_IOREMAP method, we need change > > the return value of hook ioremap_allowed() and iounmap_allowed(). > > Meanwhile, rename them to arch_ioremap() and arch_iounmap() to reflect > > their current behaviour. Thanks for reviewing. > = > Please don't just say you need to change the return value. Explain why. The 1st paragraph and the sentence 'In oder to convert them to take GENERIC_IOREMAP method' tell the reason, no? > = > And why does it need a name change ? The new name suggests that what was = > simply a check function becomes now a function doing the job. Is that = > the intention ? Yes, it's not a simple checking any more. It could do io address mapping inside arch_ioremap(), and could modify the passed in 'phys_addr' and 'prot' in patch 2. The ioremap_allowed() isn't appropriate to reflect those. > = > = > > = > > =3D=3D=3D > > arch_ioremap() return a bool, > = > It is not a bool. A bool is either true or false. Thanks, I forgot to update this accordingly. > = > > - IS_ERR means return an error > > - NULL means continue to remap > > - a non-NULL, non-IS_ERR pointer is returned directly > > arch_iounmap() return a bool, > = > Same here, not a bool either. And this place. > = > > - 0 means continue to vunmap > > - error code means skip vunmap and return directly > > = > > This is taken from Kefeng's below old patch. Christoph suggested the > > return value because he foresaw the doablity of converting to take > > GENERIC_IOREMAP on more architectures. > > - [PATCH v3 4/6] mm: ioremap: Add arch_ioremap/iounmap() > > - https://lore.kernel.org/all/20220519082552.117736-5-wangkefeng.wang= @huawei.com/T/#u > > = > > While at it, the invocation of arch_ioremap() need be moved to the > > beginning of ioremap_prot() because architectures like sh, openrisc, > > ia64, need do the ARCH specific io address mapping on the original > > physical address. And in the later patch, the address fix up code > > in arch_ioremap() also need be done on the original addre on some > > architectures. > > = > > This is preparation for later patch, no functionality change. > = > No functionnal change, really ? You mean the new arch_ioremap() owning different definition or the invocation of arch_ioremap() moved up is functional change? Now I am not sure about the latter one, may need update my knowledge base. Thanks Baoquan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 D0626C28D13 for ; Tue, 23 Aug 2022 00:20:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3536F6B0073; Mon, 22 Aug 2022 20:20:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 303308D0001; Mon, 22 Aug 2022 20:20:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CA816B0075; Mon, 22 Aug 2022 20:20:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0AA986B0073 for ; Mon, 22 Aug 2022 20:20:34 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CA687AB53A for ; Tue, 23 Aug 2022 00:20:33 +0000 (UTC) X-FDA: 79828951146.27.D95CCAA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 66EC44001A for ; Tue, 23 Aug 2022 00:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661214032; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ard+XQ2JmpaoV1Zy66Z597OHMvsCkwrAtFiswd3hAns=; b=IgFiuzyuO7Ue5AJFsrDdAAbcG/F+OfSrMHUpoKj2vq2THLvMVjGbZm/tDauh23tZDIC/Iz VpnY6Q8nswtI0mdUPdoUbSm1DNNJZB4W88cJ8kFI9E0kPeiaKAVVVxNt8LKe0iZ6S6UxQh KPAGiowiOEaPmCSFy8iHG310ZvI7asY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-399-POZqojPkPHyzqJX0OrHRVw-1; Mon, 22 Aug 2022 20:20:27 -0400 X-MC-Unique: POZqojPkPHyzqJX0OrHRVw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EDC0B1C19762; Tue, 23 Aug 2022 00:20:26 +0000 (UTC) Received: from localhost (ovpn-12-31.pek2.redhat.com [10.72.12.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27F45401B54F; Tue, 23 Aug 2022 00:20:25 +0000 (UTC) Date: Tue, 23 Aug 2022 08:20:22 +0800 From: Baoquan He To: Christophe Leroy Cc: "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "hch@infradead.org" , "agordeev@linux.ibm.com" , "wangkefeng.wang@huawei.com" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v2 01/11] mm/ioremap: change the return value of io[re|un]map_allowed and rename Message-ID: References: <20220820003125.353570-1-bhe@redhat.com> <20220820003125.353570-2-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661214033; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Ard+XQ2JmpaoV1Zy66Z597OHMvsCkwrAtFiswd3hAns=; b=TZ9aPAjSjk+9+ZvFQ9HR5uKlg6yFyVCCA4VecilXfeHZzZ+BOh9ixgcZZIpTMffkpEjEFx wrIUtIb+86O04BqVPx8HULARJfvGIDH95QkR62m5YNAJ6UGYMOkZUpxSKY3CNvfoFDO77r gMwn2my8zcB+yuEU1N61/kMXWcy/DjU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IgFiuzyu; spf=pass (imf27.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661214033; a=rsa-sha256; cv=none; b=pqA/VIED5PmEzkzynJSTiybgBY66V6dsfmtZKfbZY4nxd+SUV/w+Enc6O9L47jCJVUaQc6 LGmwphsVqD4754l9FYvTXIiYSyrgFFpLrgq1SnUfQLgtWKGkugVhNKWnXX+vx2DF1fUfG9 WErtRiLRO+KzJvxaaXk8hs1TMJBQ5zU= X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IgFiuzyu; spf=pass (imf27.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: xjxec6dffxn66rt7w9c5fwysrfik4xme X-Rspamd-Queue-Id: 66EC44001A X-Rspamd-Server: rspam08 X-HE-Tag: 1661214033-811984 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 08/22/22 at 06:25am, Christophe Leroy wrote: > > > Le 20/08/2022 à 02:31, Baoquan He a écrit : > > In some architectures, there are ARCH specifici io address mapping > > handling when calling ioremap() or ioremap_prot(), e.g, arc, ia64, > > openrisc, s390, sh. > > > > In oder to convert them to take GENERIC_IOREMAP method, we need change > > the return value of hook ioremap_allowed() and iounmap_allowed(). > > Meanwhile, rename them to arch_ioremap() and arch_iounmap() to reflect > > their current behaviour. Thanks for reviewing. > > Please don't just say you need to change the return value. Explain why. The 1st paragraph and the sentence 'In oder to convert them to take GENERIC_IOREMAP method' tell the reason, no? > > And why does it need a name change ? The new name suggests that what was > simply a check function becomes now a function doing the job. Is that > the intention ? Yes, it's not a simple checking any more. It could do io address mapping inside arch_ioremap(), and could modify the passed in 'phys_addr' and 'prot' in patch 2. The ioremap_allowed() isn't appropriate to reflect those. > > > > > > === > > arch_ioremap() return a bool, > > It is not a bool. A bool is either true or false. Thanks, I forgot to update this accordingly. > > > - IS_ERR means return an error > > - NULL means continue to remap > > - a non-NULL, non-IS_ERR pointer is returned directly > > arch_iounmap() return a bool, > > Same here, not a bool either. And this place. > > > - 0 means continue to vunmap > > - error code means skip vunmap and return directly > > > > This is taken from Kefeng's below old patch. Christoph suggested the > > return value because he foresaw the doablity of converting to take > > GENERIC_IOREMAP on more architectures. > > - [PATCH v3 4/6] mm: ioremap: Add arch_ioremap/iounmap() > > - https://lore.kernel.org/all/20220519082552.117736-5-wangkefeng.wang@huawei.com/T/#u > > > > While at it, the invocation of arch_ioremap() need be moved to the > > beginning of ioremap_prot() because architectures like sh, openrisc, > > ia64, need do the ARCH specific io address mapping on the original > > physical address. And in the later patch, the address fix up code > > in arch_ioremap() also need be done on the original addre on some > > architectures. > > > > This is preparation for later patch, no functionality change. > > No functionnal change, really ? You mean the new arch_ioremap() owning different definition or the invocation of arch_ioremap() moved up is functional change? Now I am not sure about the latter one, may need update my knowledge base. Thanks Baoquan