All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, david@redhat.com,
	catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vasily Gorbik <gor@linux.ibm.com>, Will Deacon <will@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH 3/3] s390/mm: Define arch_get_mappable_range()
Date: Wed, 9 Dec 2020 15:57:17 +0100	[thread overview]
Message-ID: <20201209145717.GD7160@osiris> (raw)
In-Reply-To: <7484e153-6c77-8325-6195-621fe144011e@arm.com>

On Wed, Dec 09, 2020 at 08:07:04AM +0530, Anshuman Khandual wrote:
> >> +	if (seg->end + 1 > VMEM_MAX_PHYS || seg->end + 1 < seg->start_addr) {
> >> +		rc = -ERANGE;
> >> +		goto out_resource;
> >> +	}
> >> +
...
> >> +struct range arch_get_mappable_range(void)
> >> +{
> >> +	struct range memhp_range;
> >> +
> >> +	memhp_range.start = 0;
> >> +	memhp_range.end =  VMEM_MAX_PHYS;
> >> +	return memhp_range;
> >> +}
> >> +
> >>  int arch_add_memory(int nid, u64 start, u64 size,
> >>  		    struct mhp_params *params)
> >>  {
> >> @@ -291,6 +300,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
> >>  	if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot))
> >>  		return -EINVAL;
> >>  
> >> +	VM_BUG_ON(!memhp_range_allowed(start, size, 1));
> >>  	rc = vmem_add_mapping(start, size);
> >>  	if (rc)
> > Is there a reason why you added the memhp_range_allowed() check call
> > to arch_add_memory() instead of vmem_add_mapping()? If you would do
> 
> As I had mentioned previously, memhp_range_allowed() is available with
> CONFIG_MEMORY_HOTPLUG but vmem_add_mapping() is always available. Hence
> there will be a build failure in vmem_add_mapping() for the range check
> memhp_range_allowed() without memory hotplug enabled.
> 
> > that, then the extra code in __segment_load() wouldn't be
> > required.
> > Even though the error message from memhp_range_allowed() might be
> > highly confusing.
>
> Alternatively leaving __segment_load() and vmem_add_memory() unchanged
> will create three range checks i.e two memhp_range_allowed() and the
> existing VMEM_MAX_PHYS check in vmem_add_mapping() on all the hotplug
> paths, which is not optimal.

Ah, sorry. I didn't follow this discussion too closely. I just thought
my point of view would be clear: let's not have two different ways to
check for the same thing which must be kept in sync.
Therefore I was wondering why this next version is still doing
that. Please find a way to solve this.

WARNING: multiple messages have this Message-ID (diff)
From: Heiko Carstens <hca@linux.ibm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	linux-s390@vger.kernel.org, Vasily Gorbik <gor@linux.ibm.com>,
	david@redhat.com, catalin.marinas@arm.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, Will Deacon <will@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] s390/mm: Define arch_get_mappable_range()
Date: Wed, 9 Dec 2020 15:57:17 +0100	[thread overview]
Message-ID: <20201209145717.GD7160@osiris> (raw)
In-Reply-To: <7484e153-6c77-8325-6195-621fe144011e@arm.com>

On Wed, Dec 09, 2020 at 08:07:04AM +0530, Anshuman Khandual wrote:
> >> +	if (seg->end + 1 > VMEM_MAX_PHYS || seg->end + 1 < seg->start_addr) {
> >> +		rc = -ERANGE;
> >> +		goto out_resource;
> >> +	}
> >> +
...
> >> +struct range arch_get_mappable_range(void)
> >> +{
> >> +	struct range memhp_range;
> >> +
> >> +	memhp_range.start = 0;
> >> +	memhp_range.end =  VMEM_MAX_PHYS;
> >> +	return memhp_range;
> >> +}
> >> +
> >>  int arch_add_memory(int nid, u64 start, u64 size,
> >>  		    struct mhp_params *params)
> >>  {
> >> @@ -291,6 +300,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
> >>  	if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot))
> >>  		return -EINVAL;
> >>  
> >> +	VM_BUG_ON(!memhp_range_allowed(start, size, 1));
> >>  	rc = vmem_add_mapping(start, size);
> >>  	if (rc)
> > Is there a reason why you added the memhp_range_allowed() check call
> > to arch_add_memory() instead of vmem_add_mapping()? If you would do
> 
> As I had mentioned previously, memhp_range_allowed() is available with
> CONFIG_MEMORY_HOTPLUG but vmem_add_mapping() is always available. Hence
> there will be a build failure in vmem_add_mapping() for the range check
> memhp_range_allowed() without memory hotplug enabled.
> 
> > that, then the extra code in __segment_load() wouldn't be
> > required.
> > Even though the error message from memhp_range_allowed() might be
> > highly confusing.
>
> Alternatively leaving __segment_load() and vmem_add_memory() unchanged
> will create three range checks i.e two memhp_range_allowed() and the
> existing VMEM_MAX_PHYS check in vmem_add_mapping() on all the hotplug
> paths, which is not optimal.

Ah, sorry. I didn't follow this discussion too closely. I just thought
my point of view would be clear: let's not have two different ways to
check for the same thing which must be kept in sync.
Therefore I was wondering why this next version is still doing
that. Please find a way to solve this.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-12-09 14:59 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  4:16 [PATCH 0/3] mm/hotplug: Pre-validate the address range with platform Anshuman Khandual
2020-12-08  4:16 ` Anshuman Khandual
2020-12-08  4:16 ` [PATCH 1/3] mm/hotplug: Prevalidate the address range being added " Anshuman Khandual
2020-12-08  4:16   ` Anshuman Khandual
2020-12-08  4:16 ` [PATCH 2/3] arm64/mm: Define arch_get_mappable_range() Anshuman Khandual
2020-12-08  4:16   ` Anshuman Khandual
2020-12-08  4:16 ` [PATCH 3/3] s390/mm: " Anshuman Khandual
2020-12-08  4:16   ` Anshuman Khandual
2020-12-08 15:27   ` Heiko Carstens
2020-12-08 15:27     ` Heiko Carstens
2020-12-09  2:37     ` Anshuman Khandual
2020-12-09  2:37       ` Anshuman Khandual
2020-12-09 14:57       ` Heiko Carstens [this message]
2020-12-09 14:57         ` Heiko Carstens
2020-12-10  4:18         ` Anshuman Khandual
2020-12-10  4:18           ` Anshuman Khandual
2020-12-10  6:58           ` Heiko Carstens
2020-12-10  6:58             ` Heiko Carstens
2020-12-10  7:04             ` David Hildenbrand
2020-12-10  7:04               ` David Hildenbrand
2020-12-10  7:40               ` Anshuman Khandual
2020-12-10  7:40                 ` Anshuman Khandual
2020-12-10  8:02                 ` David Hildenbrand
2020-12-10  8:02                   ` David Hildenbrand
2020-12-10  8:58                   ` Anshuman Khandual
2020-12-10  8:58                     ` Anshuman Khandual
2020-12-10  9:39                     ` David Hildenbrand
2020-12-10  9:39                       ` David Hildenbrand
2020-12-17 11:45               ` Anshuman Khandual
2020-12-17 11:45                 ` Anshuman Khandual
2020-12-17 12:18                 ` David Hildenbrand
2020-12-17 12:18                   ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201209145717.GD7160@osiris \
    --to=hca@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=david@redhat.com \
    --cc=gor@linux.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.