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 X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B777C433E0 for ; Tue, 30 Jun 2020 17:11:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EE6DD2074D for ; Tue, 30 Jun 2020 17:11:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GNDZ7dfA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE6DD2074D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 755EE6B0002; Tue, 30 Jun 2020 13:11:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 707A56B0003; Tue, 30 Jun 2020 13:11:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61C9A6B0006; Tue, 30 Jun 2020 13:11:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id 4E40A6B0002 for ; Tue, 30 Jun 2020 13:11:16 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 154E51EE6 for ; Tue, 30 Jun 2020 17:11:16 +0000 (UTC) X-FDA: 76986518952.21.corn19_4c00fce26e79 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 930BF180442C3 for ; Tue, 30 Jun 2020 17:11:15 +0000 (UTC) X-HE-Tag: corn19_4c00fce26e79 X-Filterd-Recvd-Size: 5657 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Tue, 30 Jun 2020 17:11:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593537073; 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=Wgnu6wO7MuEZHGg2y9cz2nRwE3MAWd9X0hs3pyDl7J8=; b=GNDZ7dfA0gMUP2grz5yVs3doV7+vUMgrHyd0IShd0W6ApGMEMEwfRYUUABwWVDH7OcjUFI nVCISdwHKmuYq3csti0CBLR3VZxudSf+Fcda1zGjPLlRBL/qNnoJ0M++K7GPwg2CyoDYkl 6aemDgQ8aZh8dGKHcayzYK0QhhoMnF8= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-NC7RTLWKORuns3VqF6xbag-1; Tue, 30 Jun 2020 13:11:07 -0400 X-MC-Unique: NC7RTLWKORuns3VqF6xbag-1 Received: by mail-wr1-f72.google.com with SMTP id y16so19006078wrr.20 for ; Tue, 30 Jun 2020 10:11:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=yhbgPy3RIqyVco+ZXtnNx1YEyJATW1/whGxTMYYXUd4=; b=gezdqczIid3VbRg3RLF7q6cjJTLuyO8B5KvqePk5Vf8+ucj6Tzve2y7LPcoP9n4huU SBQN7qRHGeCjRuHsvyXGRuAU/M5D7hK/tNNdN7KNEjWlWbJ+0DR0idnJKvplnedLVtN/ +6c2w4mt+R1KLQYeHwzuCQipphXeWmoepKsRz7pHEm40SvkvW5UqNHWzpI50WEUGdIUN jJxJkvTt68Ra7so8E+ONmb9LPnulg2rh2Pkw646Ge6umiOj0ERw0wdloUFXl2lZ7VFkT EhT71IQMNFgT3advSFq1mkOfzwh2NGKFEuvmdUJrXgUObrGcmO4Ur2UbC2F5NjhY0jo9 PMkA== X-Gm-Message-State: AOAM532HkUTEG29MDd7pk4lk3g/RaK4scTTuL8vxFLEIR7KRH3q1uGwg Op3O6Oa4WqLU4e6Rp3Yw+Q1LcjvZqIpF9QsR+Y9p//HEsh0M+Ngju/4P6uM/ZWt4p3EEUi/ziLd BmqJa198EsCw= X-Received: by 2002:a05:600c:2058:: with SMTP id p24mr22262823wmg.74.1593537066626; Tue, 30 Jun 2020 10:11:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhWL0b5uQZGwO3pRNQJ9BrMkXvpSgnuuAKj9ZmkWwjoEQcUJ/87vEBLfiBSM7064L0HKcPHg== X-Received: by 2002:a05:600c:2058:: with SMTP id p24mr22262797wmg.74.1593537066344; Tue, 30 Jun 2020 10:11:06 -0700 (PDT) Received: from [192.168.3.122] (p4ff23ffe.dip0.t-ipconnect.de. [79.242.63.254]) by smtp.gmail.com with ESMTPSA id v24sm5200496wrd.92.2020.06.30.10.11.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jun 2020 10:11:05 -0700 (PDT) From: David Hildenbrand Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v1 1/2] mm/memblock: expose only miminal interface to add/walk physmem Date: Tue, 30 Jun 2020 19:11:04 +0200 Message-Id: <31512CDA-4B5E-447C-B84A-C1A592323975@redhat.com> References: Cc: Mike Rapoport , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-mm@kvack.org, Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Andrew Morton In-Reply-To: To: David Hildenbrand X-Mailer: iPhone Mail (17F80) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 930BF180442C3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: > Am 30.06.2020 um 18:58 schrieb David Hildenbrand : >=20 > =EF=BB=BF >>=20 >>> extern struct memblock memblock; >>> @@ -114,6 +110,19 @@ int memblock_remove(phys_addr_t base, phys_addr_t = size); >>> int memblock_free(phys_addr_t base, phys_addr_t size); >>> int memblock_reserve(phys_addr_t base, phys_addr_t size); >>> #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP >>> +/** >>> + * for_each_physmem_range - iterate through physmem areas not included= in type. >>> + * @i: u64 used as loop variable >>> + * @type: ptr to memblock_type which excludes from the iteration, can = be %NULL >>> + * @p_start: ptr to phys_addr_t for start address of the range, can be= %NULL >>> + * @p_end: ptr to phys_addr_t for end address of the range, can be %NU= LL >>> + */ >>> +#define for_each_physmem_range(i, type, p_start, p_end) \ >>> + for (i =3D 0, __next_physmem_range(&i, type, p_start, p_end); \ >>> + i !=3D (u64)ULLONG_MAX; \ >>> + __next_physmem_range(&i, type, p_start, p_end)) >>> +void __next_physmem_range(u64 *idx, struct memblock_type *type, >>> + phys_addr_t *out_start, phys_addr_t *out_end); >>=20 >> __next_physmem_range() is not really necessary, the >> for_each_physmem_range() macro can use __next_mem_range() directly, but >> I suspect it won't look nice :) >>=20 >> Can you please make __next_physmem_range() static inline if we are to >> keep it? >=20 > The thing is, then I have to expose "physmem" to something outside > memblock.c. That's what I wanted to avoid here. (instead, have a minimal > interface that is sufficient enough for this special case of physmem - > add memory during boot, walk memory after boot. Performance is not an > issue). ... but it might do with an extern declaration within the inline function. = Will have a look tomorrow, thanks!