From patchwork Fri Oct 25 15:11:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13850919 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 43159D0C61F for ; Fri, 25 Oct 2024 15:12:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D03C26B0088; Fri, 25 Oct 2024 11:12:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB37E6B0089; Fri, 25 Oct 2024 11:12:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7BB06B008A; Fri, 25 Oct 2024 11:12:10 -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 99C2E6B0088 for ; Fri, 25 Oct 2024 11:12:10 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A7157A0B0F for ; Fri, 25 Oct 2024 15:11:34 +0000 (UTC) X-FDA: 82712464590.21.D11114D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id EFEDF1C000C for ; Fri, 25 Oct 2024 15:11:59 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G3qmtLVM; spf=pass (imf18.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729868975; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5pKboAP4By7PRQHzx/JKVUBvBNHAppZRg9bKS5h/5DI=; b=4MeY0WcYWdyXec8ijfu6hRjm4rvG7xJHPXJudaNCJHOqmneUfl2tCQL9iXvlGDo1HCu0mp PoqraHx/t63+BgdKhJu+iF9BK7OIT8wLaaHQGUpSxyabN8XIxjqFEENvjQra4G6uQ9UeQr Ck8igN4B6UgCCMDsWziObG39nt1ZGwo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729868975; a=rsa-sha256; cv=none; b=R7yfU6lnMfRsESsq5gdmRUozQpNKAkjxIqUEwbYVTVMwjD1M3/5X0MliV5SP+XS1SKeSMg JZbEShRVQjE+KDVsfg86Kt7pZGYzTyQCA7VHU2bKMwKqtQjxqD1pQwjzYZZdFM/EXZRPte eRd0v92MGy9UOEe8StNoq+AVcx5Fpfo= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G3qmtLVM; spf=pass (imf18.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729869127; 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: in-reply-to:in-reply-to:references:references; bh=5pKboAP4By7PRQHzx/JKVUBvBNHAppZRg9bKS5h/5DI=; b=G3qmtLVMI5ATiX7PDk5iWiljrHLCQ0zd0iagYyTSS6MqmcbOcyzzPbZi5VQcy/fcZ6uYhI t4V1p0ZV1RZ1GKgdaX1d0v/zQT7zBVACINVUz5FYIuItqvVdF5ROBsQiJJ4RQGftOL3lHM RQQcKVtsgD8GHPwtOqyEnXmMWUYKWcg= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-505-2i6VTHzzNouTjIokigDSJA-1; Fri, 25 Oct 2024 11:12:04 -0400 X-MC-Unique: 2i6VTHzzNouTjIokigDSJA-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B3F51955F3F; Fri, 25 Oct 2024 15:12:02 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.22.65.27]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7CD01300018D; Fri, 25 Oct 2024 15:11:53 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, kexec@lists.infradead.org, David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Baoquan He , Vivek Goyal , Dave Young , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , Eric Farman , Andrew Morton Subject: [PATCH v1 02/11] fs/proc/vmcore: replace vmcoredd_mutex by vmcore_mutex Date: Fri, 25 Oct 2024 17:11:24 +0200 Message-ID: <20241025151134.1275575-3-david@redhat.com> In-Reply-To: <20241025151134.1275575-1-david@redhat.com> References: <20241025151134.1275575-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspamd-Queue-Id: EFEDF1C000C X-Stat-Signature: 9g7w4k5od8dy6kbkrz5wxoi3n4mhptiy X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1729869119-8994 X-HE-Meta: U2FsdGVkX1+UJ5Zm5Mdb0F5yTilb5YFTxDXbynd3bRzA15WagN+7C2Pv8HO1/AsyPlGQqYRk0klSKuP213h1XwSF4AuCirJM42ZLWmZ79yPwLS5LDFV4z46QRNcOaXFewiASjDfY7R3vl4gLC7EdTWvbJ9UUZ1IuVkcZbhxFbL7QjE/AWpnF2NZu0YpO5STgXRexsdMezNfb4y+3nNUCiwRcVum5N3qgnLwiuqYFIsz6WoeBnAGy/fTL63rQOn57+tqnf5C55jtyvlwUcMX5KzvcKO+iT3B+vyLjDCYumYtqRIXQDbyhBVaxcHHkHXrCmieQ65KQ06rYrRSUYEBhU4xVNlHx+1crP5qikBz5eu6UEG/OJXC7djS+TnAurzgJBd7+G3cVA6i5JhwtHXYk/rMsmOMd7nhOZGO6ILR+B6gc9CVvJFJe2R+kK5pZuMEjjS0ohNKELUBpqJhoXysIBJk43uRyAGCXf5zA3s2AfW/Jd01A5W9XltSQUf3HcjDiuBPa2yFQylvaJV+uKnyNA61ijOCZaBtvLV6i4iwYJvTVkU2cgG0tkX7d/jjfJbOeC52lb3XLKsGmPoytcoVcWALFcjQVG/+6GPsFsOGGI1/sDSlup7em/SraAuKlxyprP51nw2Mb90JNHRiAhJTc+qWw0Ik+si4nTKNCOMHDAkgfISGoxzZ7zkxh+2vygNlBlNOJItVTlZG0FSKuOIR2lxmVSzdAjDOtfD3tB8OYYPAYW56YibEp7v0bVDBMd8J39eReWOKlkmcMlcNTjLP8q0RkNUxeEz7vY5dvbJ7RyY/e7dYszcnh+rUJBt7J0NE5gOz2js60BFOPSnQAqMbksPM2br9pIqr3Y73sQT5iMLQ/Eh1H5zIpqx83yvSYXnwl5LprJ6oZBN99NqfouGSElEyLJ38P7AznqyL6dnrMzSQNVuT4c+O+1kkUVFw7StcWYvPSabBLdyk65xpYGeB 0Ctuvp+Q /oFnvhZ1jvMtxs99kto4FoNdyWqz20yPL9N5lryLIl/JoUnge21ImU+tTSPbylN41qRrYhWgTIbZuLNZYo/m3PZ7I+Uci969KPOBXTV3VhuWnfsOqjQk5vCqwyL0IUUBQaw5ckn0TLgbL59yV6C7DXJaqHuPV+BAm8J+dSSNb5Xrr/CyoWlKctggP8scn2k2jAwOh2K94tO8WhVZLQrZAYn+0uoVUH2r1QoLolKqs/FyeRglfpBzXk2IyJhjn9DRs3H5jC55NvWdvCwbdAUNpWKz+D34bi0VzjJCI9iW5hBRIP3IepsrMxpj5XHbGSlV5+SJX9SPy6/msH2QNsd3ZdM76rwOtRwDR2hku05MIE397wzDyTAL+QlXXWg== 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: Let's use our new mutex instead. Signed-off-by: David Hildenbrand --- fs/proc/vmcore.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 110ce193d20f..b91c304463c9 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -53,7 +53,6 @@ static struct proc_dir_entry *proc_vmcore; #ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP /* Device Dump list and mutex to synchronize access to list */ static LIST_HEAD(vmcoredd_list); -static DEFINE_MUTEX(vmcoredd_mutex); static bool vmcoredd_disabled; core_param(novmcoredd, vmcoredd_disabled, bool, 0); @@ -248,7 +247,7 @@ static int vmcoredd_copy_dumps(struct iov_iter *iter, u64 start, size_t size) size_t tsz; char *buf; - mutex_lock(&vmcoredd_mutex); + mutex_lock(&vmcore_mutex); list_for_each_entry(dump, &vmcoredd_list, list) { if (start < offset + dump->size) { tsz = min(offset + (u64)dump->size - start, (u64)size); @@ -269,7 +268,7 @@ static int vmcoredd_copy_dumps(struct iov_iter *iter, u64 start, size_t size) } out_unlock: - mutex_unlock(&vmcoredd_mutex); + mutex_unlock(&vmcore_mutex); return ret; } @@ -283,7 +282,7 @@ static int vmcoredd_mmap_dumps(struct vm_area_struct *vma, unsigned long dst, size_t tsz; char *buf; - mutex_lock(&vmcoredd_mutex); + mutex_lock(&vmcore_mutex); list_for_each_entry(dump, &vmcoredd_list, list) { if (start < offset + dump->size) { tsz = min(offset + (u64)dump->size - start, (u64)size); @@ -306,7 +305,7 @@ static int vmcoredd_mmap_dumps(struct vm_area_struct *vma, unsigned long dst, } out_unlock: - mutex_unlock(&vmcoredd_mutex); + mutex_unlock(&vmcore_mutex); return ret; } #endif /* CONFIG_MMU */ @@ -1517,9 +1516,9 @@ int vmcore_add_device_dump(struct vmcoredd_data *data) dump->size = data_size; /* Add the dump to driver sysfs list */ - mutex_lock(&vmcoredd_mutex); + mutex_lock(&vmcore_mutex); list_add_tail(&dump->list, &vmcoredd_list); - mutex_unlock(&vmcoredd_mutex); + mutex_unlock(&vmcore_mutex); vmcoredd_update_size(data_size); return 0; @@ -1537,7 +1536,7 @@ EXPORT_SYMBOL(vmcore_add_device_dump); static void vmcore_free_device_dumps(void) { #ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP - mutex_lock(&vmcoredd_mutex); + mutex_lock(&vmcore_mutex); while (!list_empty(&vmcoredd_list)) { struct vmcoredd_node *dump; @@ -1547,7 +1546,7 @@ static void vmcore_free_device_dumps(void) vfree(dump->buf); vfree(dump); } - mutex_unlock(&vmcoredd_mutex); + mutex_unlock(&vmcore_mutex); #endif /* CONFIG_PROC_VMCORE_DEVICE_DUMP */ }