From patchwork Tue Sep 18 11:58:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 10604249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FD40161F for ; Tue, 18 Sep 2018 11:59:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E4532A76B for ; Tue, 18 Sep 2018 11:59:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 525422A77C; Tue, 18 Sep 2018 11:59:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E28BC2A76B for ; Tue, 18 Sep 2018 11:59:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE3BA8E000B; Tue, 18 Sep 2018 07:59:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D93EA8E0001; Tue, 18 Sep 2018 07:59:00 -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 C5BA38E000B; Tue, 18 Sep 2018 07:59:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by kanga.kvack.org (Postfix) with ESMTP id 9C28A8E0001 for ; Tue, 18 Sep 2018 07:59:00 -0400 (EDT) Received: by mail-ot1-f71.google.com with SMTP id h39-v6so772491otd.17 for ; Tue, 18 Sep 2018 04:59:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=JwdYSxby+nOEHB+Mo44+KJvGh0Fpxk5WgPyeuLAcI+s=; b=dOWJ2tA2iU/b/1QCQNbr8hiOhE6dDLfRJKtzdjxGFLyg155xNaHwRZzJwu+g1EICwG tdK7sBdTnOFZfGXNiap5EZVXL1dBGfkrJDN0PCyFxTmS8vm2ZX+CKsCmgObVzgDFn+I0 V/CEhSU9s435eUR+Mi61HyKv60EVOwhC0Tss0MrTRA5KHfUYAKLLlXtjE0FggHLd8kbJ IiOcrDlb6VGQsf9b1UjUV+i7rwIbUPrmCEusi97VONB2W4VyjyuNc0sbZAgrwCKxNW6j oNf/5MaGJfzJzU7LOXRDPmCpTij0cyp3BEBdz782Q7oC3NYso59Q8sM2oDl/XTyTsP+6 EOXA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: APzg51CD6nU+K4+tAQqup20GrWKO8oK0QHwYlVj7yNzCh6IFDXQk3EOt IE/g39NQmAMgsmc4WoKKoz1wkU+I3TLVRHCuSlIrel3fxpYb2tAssEpOf5mLj4e0PQzM9lysKiJ U0bN6SbOgF0HyCzERTr+kcJbmQ/9mGRcq9jPP3tEIcLnqn4jOYK1Q++xRNqwJVqXQ2Q== X-Received: by 2002:a9d:9a1:: with SMTP id q30-v6mr14551965otd.351.1537271940295; Tue, 18 Sep 2018 04:59:00 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda1/EiodIqxZyE5YoA3tgd9tARUB6rs9aNcUTKUqOuiZ7khgE5qJXGSFWhuoH2q+KLSYC8w X-Received: by 2002:a9d:9a1:: with SMTP id q30-v6mr14551943otd.351.1537271939304; Tue, 18 Sep 2018 04:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537271939; cv=none; d=google.com; s=arc-20160816; b=sGgUgUGZrh4mj2Z9pRl+AEFGf/ivv8at+6oH3/CFW/iogdaU6jwLRrufO7ynkcpQrh aWuqk0KY/Bm0TFuzE4i4p0hY3IYEqjl09B2Q1tjFwaPeHfPkCt/f/7KMQyMM5Cp6DDDd UZwFDuzMqThhkL03Ew697j3g1GjAzFqUPzFBZElQBzfBL4/DdkuXWoexEJh6q4Lh6CrN 3GxGFl0iywKnhD5ELXqrJNtcztt6ArGaCwYM5T7TYT6RadBBz8gky5haJp6xGE1WRk0D +1Q0Zo7xSLkRpWPyTV3GyDeo7cUPOe0+TjfXVZIMq3QAW6NziBWSSRQrzP0xIV9eYbY1 YmCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=JwdYSxby+nOEHB+Mo44+KJvGh0Fpxk5WgPyeuLAcI+s=; b=Rew3yTUuomFmZU6ZJepJ9ZXDEo5U+ceawopSDYPEpd9aZ/XvrZAFG576RFFnTv/3lz 7uWvr3kj11/q/lwCyc4VDnKjTvL1KyGsxoum06/fIChWWsD88DGpB71G/BD5jq2+vMPv a6UAufsEquGrzdmqtJ4zxvPuA8pOoJ+wiuAOB2Oz7gcDvWZxADHpg/A4rV+Y28B6G+IS Jv8jetNvGatjMSjGs3IVM3w+z6lRj7X3lkWaxSx+Hac3m9flaSY4A33kEKmsQu1Km8IG Y5W+DfdABnDP8lk/vJ+qF7UmFA5s10w2rN//SL0ayOGuvGVJmcTWvkqCUY6ox8cmkrEd /LSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id a65-v6si6187045otc.361.2018.09.18.04.58.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Sep 2018 04:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8IBsMr2099418 for ; Tue, 18 Sep 2018 07:58:58 -0400 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0b-001b2d01.pphosted.com with ESMTP id 2mk0w205bk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Sep 2018 07:58:58 -0400 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Sep 2018 07:58:57 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 18 Sep 2018 07:58:55 -0400 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w8IBwsMg46858370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 18 Sep 2018 11:58:54 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F1CEEAE05F; Tue, 18 Sep 2018 07:57:38 -0400 (EDT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DDC0AE05C; Tue, 18 Sep 2018 07:57:36 -0400 (EDT) Received: from skywalker.ibmuc.com (unknown [9.85.75.167]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 18 Sep 2018 07:57:35 -0400 (EDT) From: "Aneesh Kumar K.V" To: akpm@linux-foundation.org, Michal Hocko , Alexey Kardashevskiy , mpe@ellerman.id.au Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Aneesh Kumar K.V" Subject: [PATCH V3 0/2] mm/kvm/vfio/ppc64: Migrate compound pages out of CMA region Date: Tue, 18 Sep 2018 17:28:37 +0530 X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 x-cbid: 18091811-0068-0000-0000-0000033D1941 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009728; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01090083; UDB=6.00563121; IPR=6.00870103; MB=3.00023366; MTD=3.00000008; XFM=3.00000015; UTC=2018-09-18 11:58:57 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18091811-0069-0000-0000-000045C5F380 Message-Id: <20180918115839.22154-1-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-18_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=568 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809180122 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: X-Virus-Scanned: ClamAV using ClamSMTP ppc64 use CMA area for the allocation of guest page table (hash page table). We won't be able to start guest if we fail to allocate hash page table. We have observed hash table allocation failure because we failed to migrate pages out of CMA region because they were pinned. This happen when we are using VFIO. VFIO on ppc64 pins the entire guest RAM. If the guest RAM pages get allocated out of CMA region, we won't be able to migrate those pages. The pages are also pinned for the lifetime of the guest. Currently we support migration of non-compound pages. With THP and with the addition of hugetlb migration we can end up allocating compound pages from CMA region. This patch series add support for migrating compound pages. The first path adds the helper get_user_pages_cma_migrate() which pin the page making sure we migrate them out of CMA region before incrementing the reference count. Aneesh Kumar K.V (2): mm: Add get_user_pages_cma_migrate powerpc/mm/iommu: Allow migration of cma allocated pages during mm_iommu_get arch/powerpc/mm/mmu_context_iommu.c | 120 ++++++++----------------- include/linux/hugetlb.h | 2 + include/linux/migrate.h | 3 + mm/hugetlb.c | 4 +- mm/migrate.c | 132 ++++++++++++++++++++++++++++ 5 files changed, 174 insertions(+), 87 deletions(-)