From mboxrd@z Thu Jan 1 00:00:00 1970 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 A6ABFE77199 for ; Wed, 8 Jan 2025 04:54:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3530E6B0088; Tue, 7 Jan 2025 23:54:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 302516B0089; Tue, 7 Jan 2025 23:54:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A34A6B008A; Tue, 7 Jan 2025 23:54:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F04286B0088 for ; Tue, 7 Jan 2025 23:54:08 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7BA8680F47 for ; Wed, 8 Jan 2025 04:54:08 +0000 (UTC) X-FDA: 82983067776.01.D7E56EA Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf01.hostedemail.com (Postfix) with ESMTP id 01FB240017 for ; Wed, 8 Jan 2025 04:54:00 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=eBlGdr12; dmarc=none; spf=pass (imf01.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736312041; 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=NTAeASi7vVObUDW8V2zM5ksK3/uTU7NPiyOQuEofviY=; b=GBFmO3pyr7i4eqEs6pXav+mpq3Uzt714Jm9OkSmcBVdKNCJdxuyDwhx26zE+EStAyVnBk4 jbg/NeEyuPlSH6jRKL09ERQbhxa/gYRrxNkXo2xFPishgDZZcRfyfPh6fsvkDSg/XsJxlt CtgQ/ZN/IDJBijqjCWxqvlrK5LGAr+4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736312041; a=rsa-sha256; cv=none; b=H5DsDfQY/yQi50rAv6aYOzSnp2CLQ8G/uZxQxbt/5RQENv2NUmr/QHoTphirHMeb8YE9w1 igX4KrfLv6lMgH/fVWVqcFXif10D08dytTGekQoI2QGmOB62VYFDbyz7zOo7ki1yUEXblq pJrZimZJXVdKKQWA5lR38YCJmrKanlM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=eBlGdr12; dmarc=none; spf=pass (imf01.hostedemail.com: domain of akihiko.odaki@daynix.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=akihiko.odaki@daynix.com Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2ee989553c1so23664147a91.3 for ; Tue, 07 Jan 2025 20:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1736312040; x=1736916840; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=NTAeASi7vVObUDW8V2zM5ksK3/uTU7NPiyOQuEofviY=; b=eBlGdr12J9Z8vjFXSSguq3k5oRyyLbkP2FjCO7bipYugxzl5NstdFmI5CvH1DgHz7R 4+tiDH5NucG84SdLFhzRGWM/fjl+aw6MfHsTl5U916GWyAXPq2ML88d1qtlK5B9J/0iQ UdohvxRP3lzvpxhQ3RGkKs1sLyFR9vzN+bEd19WxZhjC+NMt5qR87DWjof5FxINXVyVh yRsy30yj63o4lZe9LhnXnsFrKdcKVCpIkd2P1d/gl3Uky7t6sjPB/lg0GnSkG+SKluKL q0N98kGU5pF1Dy5wZn24/ZuIflLOwE2Ceutj6QzmrhZdFbyVBPPzkvD5Hsi3OZf+wnQG cIkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736312040; x=1736916840; h=content-transfer-encoding:in-reply-to:from:content-language :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=NTAeASi7vVObUDW8V2zM5ksK3/uTU7NPiyOQuEofviY=; b=wOkGzj7lWpjHHxDjB4c8gX7oTF/fwgxaXNU8bWUFyunDhylAddaolv7JxygwnKgbFm WtzpVIYQms3X6Pkpc8e9cjiYEhKDSEm+F6mZzU2fztbTyTwuID0iJZjaIRIcKIkRInWV E32isbMh9AkgKmqXgHU3wM9aPbltgy4pJ1v7BgknA4GRmSbaYFFLAnz0qKyEEUiPyW2Z j6/jOWqJZU93rr63v054FptxenwIfQS7BmGU5Z9MekSeDJ04JhW8XugSxcAzjpZUp+IE sb688sWdiMrVGFnouXgNW7ANV9gmKvi3NCuCvW2UulUGqjiW3aa3RekdQKuUePToXyLW dMlg== X-Forwarded-Encrypted: i=1; AJvYcCW2CG5o//wrFl1VdBpneDZYSg51St4eaEHEO1LkvHIZcd9uh+NXkzo2gMgzOEColbqyIisVoWNKRQ==@kvack.org X-Gm-Message-State: AOJu0Yw/1aryBGlXww77zG00maILSTTCD1unULkDaAOSMIg0sEbeDVjY YsWs0mzhQo+fWyGlvYgjI1bpP6jjtHVqmEPkzwxnje9YZ3DuCFjovK7BIuWampc= X-Gm-Gg: ASbGncugA0aQ4gb9HGeZIvK5Fu9o+YfwwngAA3NPExdc67nEVfoHn5u0PRf1c6G8qBe PIkEBtjZW6OyOgyKIv4LVAUxKg4DmW+cA7i99C1r30GX3oz8AasPkvOek9HrZMshSQQPQ3684eU k9TAmpcNcgKeWN7q5nJL2pj2u3tlyhPMaga9f/HGo6t/8Wlq52Ll9BAduQxOPDMcnz0cGFDP/z4 BpyxzZSw3PpXojYlAH3Gibr7Fq8cK+VZIMs5ydl2kaQyFI3QQVlUG9XtpcpMvQdsws= X-Google-Smtp-Source: AGHT+IGF/lDnmbVBM65O0BZ//6tKBYkr4Hn46ySNw0SXEM+WKDuSN4ZlNc368YPeAlJVvXi3c8brJg== X-Received: by 2002:a05:6a00:1385:b0:72a:aa0f:c86e with SMTP id d2e1a72fcca58-72d21f17738mr1884512b3a.4.1736312039609; Tue, 07 Jan 2025 20:53:59 -0800 (PST) Received: from [157.82.203.37] ([157.82.203.37]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72d012b1de0sm4918303b3a.80.2025.01.07.20.53.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jan 2025 20:53:59 -0800 (PST) Message-ID: <965b73e7-d0a3-4fae-b0ec-70b5497cb6c4@daynix.com> Date: Wed, 8 Jan 2025 13:53:51 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 5/6] s390/crash: Use note name macros To: Dave Martin , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle Cc: Eric Biederman , Kees Cook , Catalin Marinas , Mark Brown , Baoquan He , Vivek Goyal , Dave Young , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kexec@lists.infradead.org, binutils@sourceware.org, devel@daynix.com References: <20250107-elf-v3-0-99cb505b1ab2@daynix.com> <20250107-elf-v3-5-99cb505b1ab2@daynix.com> Content-Language: en-US From: Akihiko Odaki In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer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HmldmI28d81XIrsgSROtaLsdRPcies+w 02wBzzyS b3T1WpNSnr2VLmVwxT/JnlYQnEPYEw+VqBx/AMiIgu12NicJsMCIhyJIgJGbsROCDgnzUiReTmi0I8Y6E33yTpS2qMtgAgsw+mEdapNpb6QMNNk9lq9mPBVPIpVMtQeIhPJY8AcZaep2DxYeyk4DOSQRdwOGC3WUKu3s0zCBjNsxyZLyJq9utP3HJM2vI+O5QIXiaK3NWBLr/ULSbEAQ4K3XBs3GQzMX5ScEG2qzKygawBYBaCLuc0BAqXq0UQNxsC5ZOzmqpZnKXyedO5G6sJr89bbuj+gsw6JS/Q5QLrznjoc4SS+b5kKkLfStkZ12zd4uLktfXfzwwF7PMFQrlM2u5qEVgLm2ZupoPp3rkUJ8lEPwQbX7u9kKHZJlhofeYO+podJNmRkjGHodCCvQzG+/4lFGiiVpx+DVt X-Bogosity: Ham, tests=bogofilter, spamicity=0.000050, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2025/01/08 1:17, Dave Martin wrote: > Hi, > > On Tue, Jan 07, 2025 at 09:45:56PM +0900, Akihiko Odaki wrote: >> Use note name macros to match with the userspace's expectation. >> >> Signed-off-by: Akihiko Odaki >> --- >> arch/s390/kernel/crash_dump.c | 62 ++++++++++++++++--------------------------- >> 1 file changed, 23 insertions(+), 39 deletions(-) >> >> diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c > > [...] > >> @@ -281,10 +272,8 @@ static void *nt_init_name(void *buf, Elf64_Word type, void *desc, int d_len, >> return PTR_ADD(buf, len); >> } >> >> -static inline void *nt_init(void *buf, Elf64_Word type, void *desc, int d_len) >> -{ >> - return nt_init_name(buf, type, desc, d_len, nt_name(type)); >> -} >> +#define NT_INIT(buf, type, desc) \ >> + (nt_init_name((buf), NT_ ## type, &(desc), sizeof(desc), NN_ ## type)) > > Nit: this macro name clashes with the naming scheme in elf.h. > > I think that there is a (weak) convention that macros with upper-case > names don't expand to a C function call; thus, a macro with an upper- > case name can be invoked in places where a C function call would not be > allowed. (This convention is not followed everywhere, though -- it's > up to the maintainer what they prefer here.) I wanted to clarify it is a macro as it concatenates tokens with ##, but I also find there are many macros that are named lower-case and performs token concatenation. S390 maintainers, please tell usr your opinion. > > (Note also, the outer parentheses and the parentheses around (buf) > appear redundant -- although harmless?) They only make a difference in trivial corner cases and may look needlessly verbose. > >> >> /* >> * Calculate the size of ELF note >> @@ -300,10 +289,7 @@ static size_t nt_size_name(int d_len, const char *name) >> return size; >> } >> >> -static inline size_t nt_size(Elf64_Word type, int d_len) >> -{ >> - return nt_size_name(d_len, nt_name(type)); >> -} >> +#define NT_SIZE(type, desc) (nt_size_name(sizeof(desc), NN_ ## type)) > > Nit: name prefix clash (again); possibly redundant parentheses. > > [...] > >> @@ -348,16 +332,16 @@ static size_t get_cpu_elf_notes_size(void) >> struct save_area *sa = NULL; >> size_t size; >> >> - size = nt_size(NT_PRSTATUS, sizeof(struct elf_prstatus)); >> - size += nt_size(NT_PRFPREG, sizeof(elf_fpregset_t)); >> - size += nt_size(NT_S390_TIMER, sizeof(sa->timer)); >> - size += nt_size(NT_S390_TODCMP, sizeof(sa->todcmp)); >> - size += nt_size(NT_S390_TODPREG, sizeof(sa->todpreg)); >> - size += nt_size(NT_S390_CTRS, sizeof(sa->ctrs)); >> - size += nt_size(NT_S390_PREFIX, sizeof(sa->prefix)); >> + size = NT_SIZE(PRSTATUS, struct elf_prstatus); >> + size += NT_SIZE(PRFPREG, elf_fpregset_t); >> + size += NT_SIZE(S390_TIMER, sa->timer); >> + size += NT_SIZE(S390_TODCMP, sa->todcmp); >> + size += NT_SIZE(S390_TODPREG, sa->todpreg); >> + size += NT_SIZE(S390_CTRS, sa->ctrs); >> + size += NT_SIZE(S390_PREFIX, sa->prefix); > > It might be worth fixing the funny spacing on these lines, since all > the affected lines are being replaced. > >> if (cpu_has_vx()) { >> - size += nt_size(NT_S390_VXRS_HIGH, sizeof(sa->vxrs_high)); >> - size += nt_size(NT_S390_VXRS_LOW, sizeof(sa->vxrs_low)); >> + size += NT_SIZE(S390_VXRS_HIGH, sa->vxrs_high); >> + size += NT_SIZE(S390_VXRS_LOW, sa->vxrs_low); >> } >> >> return size; >> @@ -373,7 +357,7 @@ static void *nt_prpsinfo(void *ptr) >> memset(&prpsinfo, 0, sizeof(prpsinfo)); >> prpsinfo.pr_sname = 'R'; >> strcpy(prpsinfo.pr_fname, "vmlinux"); >> - return nt_init(ptr, NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo)); >> + return NT_INIT(ptr, PRPSINFO, prpsinfo); >> } >> >> /* >> @@ -589,7 +573,7 @@ static size_t get_elfcorehdr_size(int phdr_count) >> /* PT_NOTES */ >> size += sizeof(Elf64_Phdr); >> /* nt_prpsinfo */ >> - size += nt_size(NT_PRPSINFO, sizeof(struct elf_prpsinfo)); >> + size += NT_SIZE(PRPSINFO, struct elf_prpsinfo); >> /* regsets */ >> size += get_cpu_cnt() * get_cpu_elf_notes_size(); >> /* nt_vmcoreinfo */ > > Otherwise, this looks sensible to me. > > Cheers > ---Dave