From patchwork Wed Dec 4 12:54:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13893709 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 EA2A1E7716B for ; Wed, 4 Dec 2024 12:55:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7DBD36B0095; Wed, 4 Dec 2024 07:55:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 78E0A6B0098; Wed, 4 Dec 2024 07:55:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 590756B0099; Wed, 4 Dec 2024 07:55:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3176A6B0095 for ; Wed, 4 Dec 2024 07:55:10 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D1130140AF4 for ; Wed, 4 Dec 2024 12:55:09 +0000 (UTC) X-FDA: 82857271686.16.3DFA7DE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 21B062000B for ; Wed, 4 Dec 2024 12:55:00 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dhDYX9yu; spf=pass (imf03.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@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=1733316892; 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:in-reply-to:references:references:dkim-signature; bh=AVSVbg92vBS9ECQ/qpyBYmAQmSQp+EsDoLv4fB2tW0Q=; b=unX2rDbrbgy0mmONiOR3+P3oPqLda+pt267Vn6LuO5iMpEnZOoEocinoSEcGI+/Jnh7v36 DGqvCDWUoNerTBmXUoAnmpayLLYcrZzh4O85MX4Rus1zm4DE3hwmMjpFskoNO5+2XL2A37 UQZCxiQO/8rJyY7qxpb19n0MG2UeWOU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733316892; a=rsa-sha256; cv=none; b=4UXm41hvAsc1sFCCClpMx5ZUhEIUXA3wt0hZof8pNRA26a0S9fhNQFhg26f0OYiX8MTqQ4 NpoH1eB6Y86dlg+I1/69f6DuFF16pkYfNdLWOe2v39sEAWw4vUuhJ4gb+vbqXU7DR5UN6O 8k7g9n+0qI4fWy0dr2ncRfpXrpFX8Ao= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dhDYX9yu; spf=pass (imf03.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@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=1733316906; 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; bh=AVSVbg92vBS9ECQ/qpyBYmAQmSQp+EsDoLv4fB2tW0Q=; b=dhDYX9yu3TDYq4KYGDXG+DYAuSCNuabLgdEZOocFaMMM3bFTl0J58nYQqTCrjiSLsXjTGp edqyBQkkSgQAAtvyfigoe9QFymPWXf/cw9JEmH33YEKPr5bkm3SKMB5NyGTMq97PbMbK5f x70Znfu7oksw/x1Ahne4x0ihMG6BYmc= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-TJKGIPHkMeW8PpNB6OvNWg-1; Wed, 04 Dec 2024 07:55:04 -0500 X-MC-Unique: TJKGIPHkMeW8PpNB6OvNWg-1 X-Mimecast-MFC-AGG-ID: TJKGIPHkMeW8PpNB6OvNWg Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-434941aa9c2so38551885e9.3 for ; Wed, 04 Dec 2024 04:55:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733316904; x=1733921704; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AVSVbg92vBS9ECQ/qpyBYmAQmSQp+EsDoLv4fB2tW0Q=; b=Bd2wSNZ+3yMISBHaGKHSWHUK7I3xXaffoEWSYlXqOx06r8Nk1J0dayOS5rrarxrEsV mtidcDbxa+hFd4BoqDBCzfNq0D0RlFPjIflcEVllL+oDf0qyxWZ3/9xlnPsXObECbMUP B/q18lyKRk6W/tQOO3hzvP1e/pnW48T+OIGE0lZiYdyP8iy/NjV1wVwUkT1fi+Cf/r9N VPAqWi2xUc13R67XZ7eqNCkdl2XduYseTLzNleihVAHuaXV7TAFLUxD4Mve+/R+emk/9 yyykP/wN0k/Cmcj7Z096+7qd1XH4Q0Fk39weU62TTPqiXx+0GuRCwZ6d5uMtu31hAFID 81Dw== X-Gm-Message-State: AOJu0Yz3GgUds0ipsAHTp4qtqpaOF4v0iLHtTr4a2vnuk61OujAth/cJ Ms/nc2pLQzMfqQHEtv+1AgCast6T6/aM/ObI9ZYovTBfNRwG4Tm7l2b1uDxg6uy8cZ5ipK44yhR Xw8rNy/XpdMZPcom0Yg+J6z/Ht0eMKGso6IZhsz38EyxNkEZ/ X-Gm-Gg: ASbGncvuFu3H3mkc4GiPWxdeW3t1q1M3Qp65W00LpgcM3X+NU/HxZTJNvvviyRHQVqq WlVR2oTBVTAw92wVP5h/KZR8jB1Nq/5jPygEmPQVqbnb38arsS2qca0+ksfbFVxRYZqQ/+ny4NC K7IDg4nhpHn+qr9PJL3PrmhqFJfg8KSJf+82scRJAX/yJQKWdu7lGZKAsb1Pg61fqBCJel9nU0v JlTkevWiJbMSZCQFrnel5teHdn4cavex7Z0b6OKkZ3RHfYMbmBR6U/slwT+cbfBMFiyzZeGLr4j PiXE0uq32Lk239Xwoe5o/MGl1tiS7/BqS2s= X-Received: by 2002:a05:600c:1906:b0:434:942c:1466 with SMTP id 5b1f17b1804b1-434d3fe3665mr34089915e9.29.1733316903708; Wed, 04 Dec 2024 04:55:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHp2zQuzmhokkabZpnrzoR4CmRg7d0WsOdBj322Nwyq7pIMtC1YAe5DPX1PH/Wsn3EpBmq5yA== X-Received: by 2002:a05:600c:1906:b0:434:942c:1466 with SMTP id 5b1f17b1804b1-434d3fe3665mr34089715e9.29.1733316903376; Wed, 04 Dec 2024 04:55:03 -0800 (PST) Received: from localhost (p200300cbc70be10038d68aa111b0a20a.dip0.t-ipconnect.de. [2003:cb:c70b:e100:38d6:8aa1:11b0:a20a]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-434d52b66ecsm23469265e9.39.2024.12.04.04.55.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Dec 2024 04:55:02 -0800 (PST) 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 v2 05/12] fs/proc/vmcore: move vmcore definitions out of kcore.h Date: Wed, 4 Dec 2024 13:54:36 +0100 Message-ID: <20241204125444.1734652-6-david@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241204125444.1734652-1-david@redhat.com> References: <20241204125444.1734652-1-david@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HqQ6vWDVNfNnUy-mHNH5nCzRNxyrSATmpPlm5Z0gV8Y_1733316904 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Queue-Id: 21B062000B X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: pqc7niwqnj6ufd4gq6yoo9fqykn3o8nc X-HE-Tag: 1733316900-204922 X-HE-Meta: U2FsdGVkX1/mB+hap6BntZ7mEj2tRr8Az2sorBp8WeZkiBaJP7jgvvE122v3nFB+irs/9v/MvTusCbXEdNB44A/VX9o6pzoIPWId9AXzBXw01VqMUhQcHpeaNuDG4rjPdBv6YCISuIDJrRDpBaIVG6E7zx+qFW6bgAtUsUtF1EfBrzGd5xhNUUWXbLssBqiBvrR+m/PeoFYDlr3TSpZglX/PiNkiOxzGJJLOepLnnYMncpP0hNAzgrlUN8PNJNOt2rDWhre6RYQU/Kdbxkz7tfB2i0ibEkQLbOUagfm+EbjdQHNmoqNe7FzpesckSRJpWeeohgJ8bohGVlBPwNG7Nm3xK578Tx99x8lNEQfhsJRIZdwK71uUcnHRHuccX66JrP+RPa8Gkwdse8Q90AbnHk0VvcbhSaGUmymSLIJMzYME5y6aOFwT127ngG1j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-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: These vmcore defines are not related to /proc/kcore, move them out. We'll move "struct vmcoredd_node" to vmcore.c, because it is only used internally. While "struct vmcore" is only used internally for now, we're planning on using it from inline functions in crash_dump.h next, so move it to crash_dump.h. While at it, rename "struct vmcore" to "struct vmcore_range", which is a more suitable name and will make the usage of it outside of vmcore.c clearer. Signed-off-by: David Hildenbrand --- fs/proc/vmcore.c | 26 ++++++++++++++++---------- include/linux/crash_dump.h | 7 +++++++ include/linux/kcore.h | 13 ------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 13dfc128d07e..8d262017ca11 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -53,6 +53,12 @@ static u64 vmcore_size; static struct proc_dir_entry *proc_vmcore; #ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP +struct vmcoredd_node { + struct list_head list; /* List of dumps */ + void *buf; /* Buffer containing device's dump */ + unsigned int size; /* Size of the buffer */ +}; + /* Device Dump list and mutex to synchronize access to list */ static LIST_HEAD(vmcoredd_list); @@ -322,10 +328,10 @@ static int vmcoredd_mmap_dumps(struct vm_area_struct *vma, unsigned long dst, */ static ssize_t __read_vmcore(struct iov_iter *iter, loff_t *fpos) { + struct vmcore_range *m = NULL; ssize_t acc = 0, tmp; size_t tsz; u64 start; - struct vmcore *m = NULL; if (!iov_iter_count(iter) || *fpos >= vmcore_size) return 0; @@ -580,7 +586,7 @@ static int mmap_vmcore(struct file *file, struct vm_area_struct *vma) { size_t size = vma->vm_end - vma->vm_start; u64 start, end, len, tsz; - struct vmcore *m; + struct vmcore_range *m; start = (u64)vma->vm_pgoff << PAGE_SHIFT; end = start + size; @@ -703,16 +709,16 @@ static const struct proc_ops vmcore_proc_ops = { .proc_mmap = mmap_vmcore, }; -static struct vmcore* __init get_new_element(void) +static struct vmcore_range * __init get_new_element(void) { - return kzalloc(sizeof(struct vmcore), GFP_KERNEL); + return kzalloc(sizeof(struct vmcore_range), GFP_KERNEL); } static u64 get_vmcore_size(size_t elfsz, size_t elfnotesegsz, struct list_head *vc_list) { + struct vmcore_range *m; u64 size; - struct vmcore *m; size = elfsz + elfnotesegsz; list_for_each_entry(m, vc_list, list) { @@ -1110,11 +1116,11 @@ static int __init process_ptload_program_headers_elf64(char *elfptr, size_t elfnotes_sz, struct list_head *vc_list) { + struct vmcore_range *new; int i; Elf64_Ehdr *ehdr_ptr; Elf64_Phdr *phdr_ptr; loff_t vmcore_off; - struct vmcore *new; ehdr_ptr = (Elf64_Ehdr *)elfptr; phdr_ptr = (Elf64_Phdr*)(elfptr + sizeof(Elf64_Ehdr)); /* PT_NOTE hdr */ @@ -1153,11 +1159,11 @@ static int __init process_ptload_program_headers_elf32(char *elfptr, size_t elfnotes_sz, struct list_head *vc_list) { + struct vmcore_range *new; int i; Elf32_Ehdr *ehdr_ptr; Elf32_Phdr *phdr_ptr; loff_t vmcore_off; - struct vmcore *new; ehdr_ptr = (Elf32_Ehdr *)elfptr; phdr_ptr = (Elf32_Phdr*)(elfptr + sizeof(Elf32_Ehdr)); /* PT_NOTE hdr */ @@ -1195,8 +1201,8 @@ static int __init process_ptload_program_headers_elf32(char *elfptr, static void set_vmcore_list_offsets(size_t elfsz, size_t elfnotes_sz, struct list_head *vc_list) { + struct vmcore_range *m; loff_t vmcore_off; - struct vmcore *m; /* Skip ELF header, program headers and ELF note segment. */ vmcore_off = elfsz + elfnotes_sz; @@ -1605,9 +1611,9 @@ void vmcore_cleanup(void) /* clear the vmcore list. */ while (!list_empty(&vmcore_list)) { - struct vmcore *m; + struct vmcore_range *m; - m = list_first_entry(&vmcore_list, struct vmcore, list); + m = list_first_entry(&vmcore_list, struct vmcore_range, list); list_del(&m->list); kfree(m); } diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index acc55626afdc..788a45061f35 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h @@ -114,6 +114,13 @@ struct vmcore_cb { extern void register_vmcore_cb(struct vmcore_cb *cb); extern void unregister_vmcore_cb(struct vmcore_cb *cb); +struct vmcore_range { + struct list_head list; + unsigned long long paddr; + unsigned long long size; + loff_t offset; +}; + #else /* !CONFIG_CRASH_DUMP */ static inline bool is_kdump_kernel(void) { return false; } #endif /* CONFIG_CRASH_DUMP */ diff --git a/include/linux/kcore.h b/include/linux/kcore.h index 86c0f1d18998..9a2fa013c91d 100644 --- a/include/linux/kcore.h +++ b/include/linux/kcore.h @@ -20,19 +20,6 @@ struct kcore_list { int type; }; -struct vmcore { - struct list_head list; - unsigned long long paddr; - unsigned long long size; - loff_t offset; -}; - -struct vmcoredd_node { - struct list_head list; /* List of dumps */ - void *buf; /* Buffer containing device's dump */ - unsigned int size; /* Size of the buffer */ -}; - #ifdef CONFIG_PROC_KCORE void __init kclist_add(struct kcore_list *, void *, size_t, int type);