Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp246771rwd; Mon, 15 May 2023 23:59:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6jg6Oe/hNUP69NIFuZR4OJ8V/neo+F1bkpTASpjVBVdxqaBkpAn0lM0v4vcxX5Wfi9xWuB X-Received: by 2002:a17:903:280b:b0:1ab:197d:2de1 with SMTP id kp11-20020a170903280b00b001ab197d2de1mr32461222plb.2.1684220389929; Mon, 15 May 2023 23:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684220389; cv=none; d=google.com; s=arc-20160816; b=LCSVkUwWfdlQgbsRgH5DdBU8NW4J7Bnwfxoo0OyMcf4S/lNodT/vY7v0yxvD4W4ykW 5Mjq6AxwOOaPpYbpYOK26PNXOedw12ufQx+6lR+8zrgrqIcT99VtjSgtyZeG4jeVB5Ea +J7WGzc7USAVcWE2AOmDDWqg3IJWdkZewhOZuVAPheZxmMJlMvvQ2p4GTDDSZZMYAY30 6hiICMpFghOQe5Lj/SiljtSgAMTgNxiH/+EHoF1mPQynWTLwjerQFKgkSOkqfyk5TZm8 YXv9Aq2aYXzOhMdTYR47oI5R+T6ZpNs8LbdL5TUJHJgnoSJ/kg29lpKqNjxVvi8LBxS1 JD9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WHbmaNPvPira+3Ei9c0lisAI+g/7Fy9RvW2GzSr8ycg=; b=f4xmeibdlloR18k3etq8AhWM+eW+HERF74wZJEKLROYNLOWyO3fKvzTrS+t0/jPn5L jIuzEQtXQOjeaWcyw1Fv95r1N7W+B9iceNoKfHo5ayXlGpmSLr7mg8guhDKMjUFnr3w7 LdylSH7LWYInDxAISrAgydV5wyRgro1weLZsKNtVzZvjh7T3M/le9mY64QYOgS9PiIG3 MPDCvxMFFt/manTwIv47OA9KxkDzIRyhGF/pVgBQz4mw+e6qtayOXFNj0q+hP18qhO+t y0T5d+xgD0PxYKZ3A/UodenPga4TzFhW4KEOQaz2gZAcGE8+BuMBKTKPW2QaIvD3Ncwu 9aZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H5nWBGVp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a17090282c500b001aae741abadsi17314802plz.145.2023.05.15.23.59.36; Mon, 15 May 2023 23:59:49 -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=@kernel.org header.s=k20201202 header.b=H5nWBGVp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230290AbjEPGsr (ORCPT + 99 others); Tue, 16 May 2023 02:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbjEPGsp (ORCPT ); Tue, 16 May 2023 02:48:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D68F448A; Mon, 15 May 2023 23:48:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 769C36346B; Tue, 16 May 2023 06:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 677F7C433D2; Tue, 16 May 2023 06:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684219720; bh=8lytz54EhtEUEVF10JvyKvoVdJWuXGHYr66pEwPqID4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H5nWBGVpVh7eIObnI3HWT8d0qnKWC0WDTq6zvJVPgfC9L8qza8lZPGSQ4Rbb0QDyU z8LRiznozgmQ+IzAHmth7ZWnHGjCHRNxsRsoU/GiM+/ZSQvULmR9qvdU7FCpwiK/GL XCEkd4wA5mSoLqfE3KqOrMETf1k0jX0+ScqlQI6GqLQ6YL3VLQOyBvVnjrTq5cmyjA XlUznXBW8q1iNm93zJJnIbqE5AGFIJL1UIQQN/Vj6FHFfMFI0+9C2MRSscwWCAOYN9 w8pwzCE50uFiCNCgyDJjzv2eBGJL8VrJWuOrr8WY0XUPphLbW8yPj55LJmd9+u1S9J AmXBhTOzSw2Hg== Date: Tue, 16 May 2023 09:48:32 +0300 From: Mike Rapoport To: Baoquan He Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de, christophe.leroy@csgroup.eu, hch@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@aculab.com, shorne@gmail.com, willy@infradead.org, deller@gmx.de Subject: Re: [PATCH v5 RESEND 06/17] mm/ioremap: add slab availability checking in ioremap_prot Message-ID: References: <20230515090848.833045-1-bhe@redhat.com> <20230515090848.833045-7-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230515090848.833045-7-bhe@redhat.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Mon, May 15, 2023 at 05:08:37PM +0800, Baoquan He wrote: > Several architectures has done checking if slab if available in > ioremap_prot(). In fact it should be done in generic ioremap_prot() > since on any architecutre, slab allocator must be available before > get_vm_area_caller() and vunmap() are used. > > Add the checking into generic_ioremap_prot(). > > Suggested-by: Christophe Leroy > Signed-off-by: Baoquan He Reviewed-by: Mike Rapoport (IBM) > --- > mm/ioremap.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mm/ioremap.c b/mm/ioremap.c > index 9f34a8f90b58..2fbe6b9bc50e 100644 > --- a/mm/ioremap.c > +++ b/mm/ioremap.c > @@ -18,6 +18,10 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size, > phys_addr_t last_addr; > struct vm_struct *area; > > + /* An early platform driver might end up here */ > + if (!slab_is_available()) > + return NULL; > + > /* Disallow wrap-around or zero size */ > last_addr = phys_addr + size - 1; > if (!size || last_addr < phys_addr) > -- > 2.34.1 > > -- Sincerely yours, Mike.