Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2922916lqo; Tue, 14 May 2024 13:39:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUE21BNEi7x430lW8oggY8T4g4fAA2me8f0TaYTdbVCwSODTjxzJ0elVZfhGl2rIPW2OY5s2C0gl//3U7oU4GwXHhEOjnxnlXzYjMzBBg== X-Google-Smtp-Source: AGHT+IHy3wDUA2OiuRdBW3fS+M/X3TkJ7bk7qve8WmcBUfylVuNGkRSM0skolVbzzusGC4QYnwSO X-Received: by 2002:a17:906:cd03:b0:a59:9cc1:7330 with SMTP id a640c23a62f3a-a5a2d67db34mr910075566b.64.1715719185985; Tue, 14 May 2024 13:39:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715719185; cv=pass; d=google.com; s=arc-20160816; b=RGRe0Xy6LiBqm9SGPsH6niBbd7iczS1ysFlbmN5rXhIe0XxDZJO9CzjFqcFQh3ZJ41 B1bwi//YgNJE80nJB0OSgDvOiRUqo1FtPRH3AKpMbhYpqFQRyeMDKaMFElv54VZx49ho 88HVuo5U8+kuq4SqxSZccgyGymPt6I7iadg/M2o+n48scOQY+B9PfduJ+NlNZc+i+h2S peChQmTgc8Ma01RVELnWdjNXKKOlw909lPx68Ks7AhpmNIwTbJDVlvn3PSnTuQqH/8bm gAIflVCpJrkJxYXm53stm4gmXHO0bVS+09wpz73kzInCQRFOCWViZ2E0iqSY1LFdA0af iVFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=ITMhM4TN9IG8BffABJDJLkO9uSK3vlKikLrGNKRSMoc=; fh=opgKDPrgWid8ro/tQRgsNMlLjglDELmKjRJTNHxCHPc=; b=suLlbW4MZHzrNPnfZxtDPlwX45kanse8DC1w43lPYE48gPOZaOG4ydIVza5tHUSRgN Zjox6QOlMk3X3gj8pxUedoPuzTZKGkUXGJOKIK06Omk8Rcm+EENxYqGIIaFyb/x3HbD9 al0oOr20z55p8b3m2HYhdMcW2Y+3sHxuKG6a0g6TXnjQZy34x0kBBh+XACEzC35F5GfF t+ZP0aT/YAeQmwLg6ajveqYnE6rBnow6WZ5Xd/mWa5ljqUa8X/7n/v9CWiLfU+j9iwVv Yi+ruZnAMwxk4TjmIl78kqpCirGehPNeEJrvrzW5AKpehG4Ii4kN+UM2Bab4kzvzjxUO bhmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HmAsc7Ct; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-179149-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179149-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b4c42csi645422266b.464.2024.05.14.13.39.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 13:39:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179149-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HmAsc7Ct; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-179149-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179149-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8F7C91F22C27 for ; Tue, 14 May 2024 20:39:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64DA41E491; Tue, 14 May 2024 20:39:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HmAsc7Ct" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94DBC2AF0D for ; Tue, 14 May 2024 20:39:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715719178; cv=none; b=gNFRoN0Ptl8AEQW850DSK0WiXlcIY8HDgD2aiuoX8nIhVpgu7aXrlUGnEx+fr5Q2XSrMNQocxp+JKHPstC4crbKtC8ewLPhnKmzfqwoUcxp5Na/lI6qXu0WrkY80qvF9j6hyTvwRoLaIYETdfh3jh2DFOqYkyaFnsuW3BR1LOZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715719178; c=relaxed/simple; bh=dcfRyOLBWot0N4wtJVvYk4o+gibi42/0MoCaLwXR1rg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=K+DC/fZ8rkgwKVOd0xbVC2OA5Ub/BX945PDt0D3Jwe+lciqk+FRaK+43AQbl1+pKFAODrQSgmSupjeonzO+K/KSKw+kwZckSKPd4WSJWPlDzaSK8awErGWDJ0IQx3N51KpHUrj7lI2LxRbsUpsYd1o6T/kfM0gb6rUr505/XtEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HmAsc7Ct; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715719175; 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:autocrypt:autocrypt; bh=ITMhM4TN9IG8BffABJDJLkO9uSK3vlKikLrGNKRSMoc=; b=HmAsc7Cth7Yr3ID2n6GHr1c3dMAd7bf3cslPgjFFN0RVdLyKauNArgAfEoyiWw6RdUlk5n tXkh/JRRh0AqCoPFGi9oegYhXyDW5TPfa0/Ta7Yl+GXZrHYjiQPbtw79EuJELPWn+w400i 2rkU9xPUpCUqDi7W6peHZG9AB7tO6ZY= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-270-B5hZuHUZM36sIS4w3Wf32g-1; Tue, 14 May 2024 16:39:34 -0400 X-MC-Unique: B5hZuHUZM36sIS4w3Wf32g-1 Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-1ee4e9a73a8so64502945ad.2 for ; Tue, 14 May 2024 13:39:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715719173; x=1716323973; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=ITMhM4TN9IG8BffABJDJLkO9uSK3vlKikLrGNKRSMoc=; b=iypEaFekt8R7gig3Zg+kuB6oljCQRoZxGCF4cCjLphsUCTQvRlPFmoFcsVsxJ27nve 2qkQpWd4g77HXLJD5CuC6Eykphb8UF4yUY8GFV2T1mb4D3IRttMAFyEuH2h8Vtqbqe2B rM9eJgC4mK3REmjQoOm3NIh6o57DBlfWEbCIalEvCy2EnAd7/dDvibRm4jAfahfjy0tr cLUgUNBxjKMpyDqJYPy8xp/rJyHnfmEk5SpbBpQBEgEAPHepwun8ilWC+bGPZd62dpFk OETCgS+/touT5AI3u1I4w8F9Y6GmEcLAWGK0pvzsXz3doMXKXruWSXVWA5MCO5eiwT3w 1jGw== X-Forwarded-Encrypted: i=1; AJvYcCWvv3oE3VRYQomsLYMm2QOGvTV5HxyGoDN3II1MhBu7Jg7feakyLwzhwC8M2hb+IQoYuU/etNDZar7NbuP+9w6RUPnoYGoUDm+mGH6A X-Gm-Message-State: AOJu0Yy47IpvqR+cGj/l39MaJQs5/rVFTdDCG6Rf4YXzQyL/KuQ0fAfb eWqTbSVzEY7pdvYjPi8V3XGdVZI3ecBsLGSIUk4RkYtEPRAxkOE+cXovWJ66thao71egeOOuRYU FCf5lb3l9BzD/Dxpn3bF+DqUshOGMAkKImxE491DGA9Lir1eKepL3s0/yvJM4tQ== X-Received: by 2002:a17:902:f54d:b0:1e2:aa62:2fbf with SMTP id d9443c01a7336-1ef4404a379mr183346865ad.45.1715719172839; Tue, 14 May 2024 13:39:32 -0700 (PDT) X-Received: by 2002:a17:902:f54d:b0:1e2:aa62:2fbf with SMTP id d9443c01a7336-1ef4404a379mr183346485ad.45.1715719172282; Tue, 14 May 2024 13:39:32 -0700 (PDT) Received: from [172.21.1.2] ([50.204.89.31]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0b9d176fsm101887075ad.58.2024.05.14.13.39.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 May 2024 13:39:31 -0700 (PDT) Message-ID: Date: Tue, 14 May 2024 22:39:30 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 5/8] riscv: mm: Take memory hotplug read-lock during kernel page table dump To: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Alexandre Ghiti , Albert Ou , Palmer Dabbelt , Paul Walmsley , linux-riscv@lists.infradead.org Cc: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Andrew Bresticker , Chethan Seshadri , Lorenzo Stoakes , Oscar Salvador , Santosh Mamila , Sivakumar Munnangi , Sunil V L , linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org References: <20240514140446.538622-1-bjorn@kernel.org> <20240514140446.538622-6-bjorn@kernel.org> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqT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Nk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20240514140446.538622-6-bjorn@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 14.05.24 16:04, Björn Töpel wrote: > From: Björn Töpel > > During memory hot remove, the ptdump functionality can end up touching > stale data. Avoid any potential crashes (or worse), by holding the > memory hotplug read-lock while traversing the page table. > > This change is analogous to arm64's commit bf2b59f60ee1 ("arm64/mm: > Hold memory hotplug lock while walking for kernel page table dump"). > > Signed-off-by: Björn Töpel > --- > arch/riscv/mm/ptdump.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/riscv/mm/ptdump.c b/arch/riscv/mm/ptdump.c > index 1289cc6d3700..9d5f657a251b 100644 > --- a/arch/riscv/mm/ptdump.c > +++ b/arch/riscv/mm/ptdump.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -370,7 +371,9 @@ bool ptdump_check_wx(void) > > static int ptdump_show(struct seq_file *m, void *v) > { > + get_online_mems(); > ptdump_walk(m, m->private); > + put_online_mems(); > > return 0; > } Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb