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=-15.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 E5E32C433DB for ; Mon, 1 Feb 2021 09:08:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8D01A64E06 for ; Mon, 1 Feb 2021 09:08:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D01A64E06 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pAyxGXl6qLCQhmpNuTuA8p8djxW8G79u59QhMTtj++0=; b=Y8PsYNt9yZjkxJBpuw0Qpf/4A ln8pkmj0qFi9HDOsYuT9hzlD1IZU+jq4uWghdKKLIHTD4F/Rlu2feAcaRItAfE31/DpKFx+LezOk6 bGObNhdIRukY9Iu7t7SaAm9jcDpSw27fdm2+Nmhy9KU0N1GdD00foD4mV4DyZ3TMjz9uDEFkdTyOX UWdEwfJ9TxqV66rJK0GcDzv2JmPjGCAupMmboqAOybunwhLu1x+gg7ezJg0wQ1xszPfZ8WgIZH/SB r0OqUAou1ShALtnmJyFetstCNFHHEuISReT9zB8CvjOhOm/+TY0C/k0GYiG+mEABRaCRwwwpymJnA 0oyRDNubw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6VAT-0004vI-V0; Mon, 01 Feb 2021 09:06:45 +0000 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6VAQ-0004tj-Gl for linux-arm-kernel@lists.infradead.org; Mon, 01 Feb 2021 09:06:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612170401; 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=9Cpz/9ce6N68oi1r3HkRt/6ubGoKxWXGrN4Wc0ffQJs=; b=YObJRjHPjLDB3dvsvMeflMznnPEXAwMBdqqEiwz7o++2HdpBOzCU89CwFq2o1wjjuolBSi UhLKHeNdiqvUTRFfeGi6vW/cmQoIKliuIyArQL2sEW/zRKieg7mKBGssuaPDjeyq5D0pjl xLIgbigCslKgyyttZYAIslDGTi6GYhE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-518-msExTuC0OPOra3eeFgOKqQ-1; Mon, 01 Feb 2021 04:06:37 -0500 X-MC-Unique: msExTuC0OPOra3eeFgOKqQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2FCA659; Mon, 1 Feb 2021 09:06:35 +0000 (UTC) Received: from [10.36.115.24] (ovpn-115-24.ams2.redhat.com [10.36.115.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3430A5DA2E; Mon, 1 Feb 2021 09:06:31 +0000 (UTC) Subject: Re: [PATCH V5 3/4] s390/mm: Define arch_get_mappable_range() To: Anshuman Khandual , linux-mm@kvack.org, akpm@linux-foundation.org, hca@linux.ibm.com, catalin.marinas@arm.com, osalvador@suse.de References: <1612149902-7867-1-git-send-email-anshuman.khandual@arm.com> <1612149902-7867-4-git-send-email-anshuman.khandual@arm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <6e84c7a9-730d-64ee-ab8a-ae966a0e007e@redhat.com> Date: Mon, 1 Feb 2021 10:06:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1612149902-7867-4-git-send-email-anshuman.khandual@arm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210201_040642_595570_DDEF3B7F X-CRM114-Status: GOOD ( 24.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , linux-s390@vger.kernel.org, Vasily Gorbik , linux-kernel@vger.kernel.org, Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 01.02.21 04:25, Anshuman Khandual wrote: > This overrides arch_get_mappabble_range() on s390 platform which will be > used with recently added generic framework. It modifies the existing range > check in vmem_add_mapping() using arch_get_mappable_range(). It also adds a > VM_BUG_ON() check that would ensure that mhp_range_allowed() has already > been called on the hotplug path. > > Cc: Heiko Carstens > Cc: Vasily Gorbik > Cc: David Hildenbrand > Cc: linux-s390@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Acked-by: Heiko Carstens > Signed-off-by: Anshuman Khandual > --- > arch/s390/mm/init.c | 1 + > arch/s390/mm/vmem.c | 14 +++++++++++++- > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c > index 73a163065b95..0e76b2127dc6 100644 > --- a/arch/s390/mm/init.c > +++ b/arch/s390/mm/init.c > @@ -297,6 +297,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(!mhp_range_allowed(start, size, true)); > rc = vmem_add_mapping(start, size); > if (rc) > return rc; > diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c > index 01f3a5f58e64..82dbf9450105 100644 > --- a/arch/s390/mm/vmem.c > +++ b/arch/s390/mm/vmem.c > @@ -4,6 +4,7 @@ > * Author(s): Heiko Carstens > */ > > +#include > #include > #include > #include > @@ -532,11 +533,22 @@ void vmem_remove_mapping(unsigned long start, unsigned long size) > mutex_unlock(&vmem_mutex); > } > > +struct range arch_get_mappable_range(void) > +{ > + struct range mhp_range; > + > + mhp_range.start = 0; > + mhp_range.end = VMEM_MAX_PHYS - 1; > + return mhp_range; > +} > + > int vmem_add_mapping(unsigned long start, unsigned long size) > { > + struct range range = arch_get_mappable_range(); > int ret; > > - if (start + size > VMEM_MAX_PHYS || > + if (start < range.start || > + start + size > range.end + 1 || > start + size < start) > return -ERANGE; > > Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel