From patchwork Thu Oct 29 16:27:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 11866807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A13261C for ; Thu, 29 Oct 2020 16:27:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 36F8320825 for ; Thu, 29 Oct 2020 16:27:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bpd85E4L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36F8320825 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 61B706B006E; Thu, 29 Oct 2020 12:27:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5A3AB6B0070; Thu, 29 Oct 2020 12:27:32 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 445696B0071; Thu, 29 Oct 2020 12:27:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id 1464D6B006E for ; Thu, 29 Oct 2020 12:27:32 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A8E1B181AEF1A for ; Thu, 29 Oct 2020 16:27:31 +0000 (UTC) X-FDA: 77425493502.10.hate45_01127482728e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 891FB16A069 for ; Thu, 29 Oct 2020 16:27:31 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,david@redhat.com,,RULES_HIT:30051:30054:30074,0,RBL:216.205.24.124:@redhat.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100;04yrep9orc3d3e674u6pnn8n6aqs8yckzbnx8ye7k31c7w43itygaibw9z8z7b9.dfkbpk3pjjwu3f8k8ezqtah5mrn3hd7wzzzrxrgkpkj74mwty9smxaw6wg614oh.g-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:69,LUA_SUMMARY:none X-HE-Tag: hate45_01127482728e X-Filterd-Recvd-Size: 3488 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Thu, 29 Oct 2020 16:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603988850; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=U6ucExP53XsVuBHTIJjynzcjVBwXkXFE9HrshKR2yNc=; b=bpd85E4L3l1MPpogqISFzEkpE2slVXjUgtuShWGvMSkYsTJ3L557jJMh3L/s04hxktKCAj dZsfzAR8my365duSinEXWgAVeKaXG0chjzNp9dY/9/OIFmS0QKd3qszA3dZfoY9bMX/xnx IrHUNHZf3TRdq08SU3e+G75YZJiyP8Y= 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-319-qPI0bZwUNYmvdiUjZCSeyQ-1; Thu, 29 Oct 2020 12:27:28 -0400 X-MC-Unique: qPI0bZwUNYmvdiUjZCSeyQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBA8B18B6472; Thu, 29 Oct 2020 16:27:25 +0000 (UTC) Received: from t480s.redhat.com (ovpn-112-181.ams2.redhat.com [10.36.112.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B27B5C26A; Thu, 29 Oct 2020 16:27:19 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, David Hildenbrand , Andrew Morton , Benjamin Herrenschmidt , Michael Ellerman , Michal Hocko , Michal Hocko , Mike Rapoport , Oscar Salvador , Paul Mackerras , Rashmica Gupta , Wei Yang Subject: [PATCH v1 0/4] powernv/memtrace: don't abuse memory hot(un)plug infrastructure for memory allocations Date: Thu, 29 Oct 2020 17:27:14 +0100 Message-Id: <20201029162718.29910-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: powernv/memtrace is the only in-kernel user that rips out random memory it never added (doesn't own) in order to allocate memory without a linear mapping. Let's stop abusing memory hot(un)plug infrastructure for that - use alloc_contig_pages() for allocating memory and remove the linear mapping manually. The original idea was discussed in: https://lkml.kernel.org/r/48340e96-7e6b-736f-9e23-d3111b915b6e@redhat.com I only tested allocations briefly via QEMU TCG - see patch #4 for more details. David Hildenbrand (4): powerpc/mm: factor out creating/removing linear mapping powerpc/mm: print warning in arch_remove_linear_mapping() powerpc/mm: remove linear mapping if __add_pages() fails in arch_add_memory() powernv/memtrace: don't abuse memory hot(un)plug infrastructure for memory allocations arch/powerpc/mm/mem.c | 48 +++++--- arch/powerpc/platforms/powernv/Kconfig | 8 +- arch/powerpc/platforms/powernv/memtrace.c | 134 ++++++++-------------- include/linux/memory_hotplug.h | 3 + 4 files changed, 86 insertions(+), 107 deletions(-)