From patchwork Sun Apr 28 19:01:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13646092 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA972C4345F for ; Sun, 28 Apr 2024 19:02:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D27096B007B; Sun, 28 Apr 2024 15:01:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD7586B0083; Sun, 28 Apr 2024 15:01:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9E8C6B0085; Sun, 28 Apr 2024 15:01:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9BC276B007B for ; Sun, 28 Apr 2024 15:01:59 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0B4761C09E9 for ; Sun, 28 Apr 2024 19:01:59 +0000 (UTC) X-FDA: 82059860358.03.2DBD329 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf20.hostedemail.com (Postfix) with ESMTP id E8D7B1C0004 for ; Sun, 28 Apr 2024 19:01:56 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HWilYCzn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714330917; h=from:from:sender: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: references:dkim-signature; bh=pkigxwzJ0pF/T4NqveAQpx8gjiN35IK7jok4Q5z8klI=; b=EYuHca5MP91vMezFXVBOEDGQBjX1mgfDO9osdGsycFXIlhdVDJOt7C2uQ6MYJNoKjT31es zx+Cfn5bcu5Pb2wZNBJLh41PFPa/qXceTHLP/AEXR1/PS5FR4ITVsmr5DKu6zgjm3b3YWl tAY1s/U0IrPtVS6NH+hCr8HcK3Hv3Pc= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HWilYCzn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714330917; a=rsa-sha256; cv=none; b=jJHjaT6mMNh814WmaQXhKc1DIyH5ySYtizWFcbmbWR+0eKLI7SiVfXwfLcvQg12mFcaOi+ Z3Fc4kpANutT61H9pw4e4p81VP3Vbb2PA45lrIeTEKsv0WWB1DRPc8XzlYgfUuUOsMra1K bq/qwnnnD5oHdjsJRYY2SZEp20VD/yc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714330916; 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; bh=pkigxwzJ0pF/T4NqveAQpx8gjiN35IK7jok4Q5z8klI=; b=HWilYCzniiS/dajtY5AbmQ3AI6fAYAc1Ps3QbkQJaaQpO3ZiaEhHICnA0l1VfpVS/4CW4w RNba3rP4im6E3cglfZhV2VZlEHI52rDFNw/umLkNgxqEZkPLUwcLy2mId6y7K5tG4jIJiK j2lk+YxQROGbHX1paw0uBf1b5YdKo2E= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-S1cMpS3lOtqFLdo4D3FTXQ-1; Sun, 28 Apr 2024 15:01:54 -0400 X-MC-Unique: S1cMpS3lOtqFLdo4D3FTXQ-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7905e4a1e61so1917285a.1 for ; Sun, 28 Apr 2024 12:01:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714330914; x=1714935714; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pkigxwzJ0pF/T4NqveAQpx8gjiN35IK7jok4Q5z8klI=; b=LyrQ0sbk3y5Un4RfehILjDO3s5aIADje5mD2KBdgPzOcua1iXM32y4zpTcXGqt7TZk cNtFfOTZ3Q6tfaHYmVlQXltoYO/XPhgB/7HjrJSX8vTeYo9gQLJX8fJjZ/z/NHkZXNLo 2k8SPNQ1RU+1Rh25XeCXZLCzrIWjbTQNTe687jVpUePwDZ7bMHG0EHkpPG1xo3c/eOmQ giJdDAdRmmfewDjtG6G1ozfItWq9HzuqRSbLtZmx9SQ39d5liXfiPlyZZlO2zJoCohtz Mbv31y/BaAKLlsr+EiXAL/BXP96c+XkafE9nu6NsYdLuxRcCSiBYR41TBGiN8lwxN01k CawA== X-Forwarded-Encrypted: i=1; AJvYcCXYoATwlRpelS67JASgCS6LjdcWhW7kl2BHI8ct9mkZEPK03ikKeX3h4ZOPX01LbRIl3Tgd+TzgBDGQThMlp0GEpSE= X-Gm-Message-State: AOJu0YyPOw+pcBTMwv2rBNChsyLNKc2CDTTFHlLWK+2j4I7qmjOeErXl Tyz2fTDCKdL80znZ5psOxhPg0V4o2B/De6u7ICYCbmBfS3qhjAyU/xqf4vZSHNvay3JABFPYANS GvBZfQPqfoniMpz26Sn2f2dMgFX3yOxSqzb+0uRiYgOzI5gG+ X-Received: by 2002:a05:620a:17a0:b0:790:e83a:e6eb with SMTP id ay32-20020a05620a17a000b00790e83ae6ebmr4022625qkb.5.1714330913779; Sun, 28 Apr 2024 12:01:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEc5kc0cZSyusKzQeLAgeOYcB5BLCEjzPmI8Bn8/lrUkN7IeJKwQ4CrGxFGrgIzhwqWtQQFqg== X-Received: by 2002:a05:620a:17a0:b0:790:e83a:e6eb with SMTP id ay32-20020a05620a17a000b00790e83ae6ebmr4022591qkb.5.1714330913186; Sun, 28 Apr 2024 12:01:53 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id oo8-20020a05620a530800b0078d693c0b4bsm9818152qkn.135.2024.04.28.12.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 12:01:52 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Christophe Leroy , peterx@redhat.com, David Hildenbrand , Andrew Morton , "Aneesh Kumar K . V" , Lorenzo Stoakes , John Hubbard , linuxppc-dev@lists.ozlabs.org, Muchun Song , Jason Gunthorpe Subject: [PATCH 0/2] mm/gup: Fix hugepd for longterm R/O pin on Power Date: Sun, 28 Apr 2024 15:01:49 -0400 Message-ID: <20240428190151.201002-1-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Stat-Signature: h8euay1yfr91ytpyq6d616h3f7rwgthp X-Rspamd-Queue-Id: E8D7B1C0004 X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1714330916-325236 X-HE-Meta: U2FsdGVkX1/CarVrK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ox9dbTDrv0HfCeqPkwbhWEnEICF268BUnZv3rx5/PTgC25DrQQHxbNB6iN7wRCkwto4EeDeMlEbjXslSg+PduGCa1/kuv7rKnzRR7YMKzSUuIGRseJ0h/fKAOeu6bzxD/Jvx4XVk56iJA1g2PNZosKtMwdL5B67nEZiVQJqli86BwH8bFlyOmTp6ogOUDdZ2LFz+EsVRxv0N8EqL7Kreq7J/FAinbEkXyN1UuF0jY0CzVfBZgqs5JHOInGMz3R8+ZoZd01/juS0QeLc7id+bOaQIx9kPcNJTJZ9x7gBa+0koHus1gP5omYHIYlmiTjYoe4KqlVJHQLk13qhLW0cY9CxXdj2jylVgxDOviF6+WJR9Xc4KczL0b0fqS2Ifk2LgcClcfz4jM+aL+PJC/D5zqAAd8dFwA== 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: List-Subscribe: List-Unsubscribe: This series should apply to both mm-stable and mm-unstable, I am not sure whether it's even applicable to apply on mm-stable directly, but perhaps not urgently needed either. Anyway, it'll apply to either tree. It also means cc stable is not needed even if I had the Fixes attached. Patch 1 fixes that bug in mm-stable, patch 2 enhances the gup_longterm to be able to discover such issue. In general, the previous hugetlb rework [1] on gup-slow introduced an issue with R/O longterm pin. Nobody yet found it in either a real report or test case, probably because our test case doesn't yet cover it (not before patch 2), and it's also a pretty rare path: it only happens with Power longterm R/O pins on a page cache that is installed as a hugepd read-only. Please read each of the patch for details. I retested "./run_vmtests.sh -t gup_test -a" on a Power8 system with a Power8 VM, with 16MB hugepd hugepd entries installed. Note that I tested exactly the same matrix before, but patch 2 will change gup_longterm test, so it's actually slightly different test carried out, and the new test (gup_longterm.c, when apply patch 2 only) will hang mm-stable on Andrew's tree with that 16MB huge page. Thanks, [1] https://lore.kernel.org/r/20240327152332.950956-1-peterx@redhat.com Peter Xu (2): mm/gup: Fix hugepd handling in hugetlb rework mm/selftests: Don't prefault in gup_longterm tests mm/gup.c | 64 ++++++++++++++--------- tools/testing/selftests/mm/gup_longterm.c | 12 +++-- 2 files changed, 48 insertions(+), 28 deletions(-)