Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp601975rdb; Thu, 15 Feb 2024 09:25:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU+nSLaw4ZnNXYBB/dlawrD71rQaxJdR3eR/iUVRISDWtuf1O4/PMe4ovSWc0bxePRk64JHF3+YjE9yyZIS4oIVOpfYxLnxbaorjF504w== X-Google-Smtp-Source: AGHT+IFIn0LaBlOSsNVIwjsWYviwZtWwhAoQpuAh2hQPrGFCI+VV+fHd/ULI/ENX2sbwKVnkfyZq X-Received: by 2002:a05:620a:3888:b0:787:21d2:17f9 with SMTP id qp8-20020a05620a388800b0078721d217f9mr2239732qkn.70.1708017953161; Thu, 15 Feb 2024 09:25:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708017953; cv=pass; d=google.com; s=arc-20160816; b=GKL5woN9c7MMYmGwjKq7WjCTAbFGTR4tkN/5OKQbGW1mu0HujqrOU/8hHylifX6ueZ og5w4YCS88Fl+Bz8A5KQvvpDZforNsMAEdybJDi3sHU5MNCrwq2oqzdsVElAqrUHmxhr RnS77Dp1vNgNKVCz6fDX8I5gR+a/QQ/T5eVCsHBfnnkfZXbVzsvbhInTW6jlg3pCY4Gr maPqLjWRypSbBd4LlyqfxEa3Cibz3fKKi6O5dKhcge9rowGVQTGq7+F+X6swc4uX+RWm 7TGxMlPmXq5YNUgNlbboiX+KeYaUY5BG9Ytyd5T2UGqgzIARdTPcpIlUp3201+4+XKmq Hv8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=zaQaPX04GVXGx4EuNSfjTExmNxEJBUFZt8AtN9ccB6o=; fh=1SZlCjDK9tOd3Etv05DCwSskJmU6D5My3EqmtVgEHZw=; b=KZfO1u7/jTM52ckgNFUaM35luQmQaUTMI+lMnRsf4q8NjjvHEFAY79bgOnalTooXF0 owiLfTvZq6IbiKbzLZt5I2+6X8ZLRJCdAS8E594dzmWYvqBz5QN7qtDYUyyN/zL2MFLi swGbwmXsppZ8v9crLy9KdaCZbi4OBxnYWMsIRbR99Mk6NNzJdU3dH986x7iF0a2NtCeV XeoRD7cNJFg9Bgc72IfyJoWdp1CqGTMu0bMeT9oQdlGv/cEDtFZMjrcLvrdGJGLOfiak qj78O4pW7XGRXpZiX1dLEbjfIX6VUy88lJaI5Ce2lnIjK7rRSXheTAmRp1ycucyDH9aQ n5wQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@bell.net header.s=selector1 header.b=1VDP+dix; arc=pass (i=1 spf=pass spfdomain=bell.net dkim=pass dkdomain=bell.net); spf=pass (google.com: domain of linux-kernel+bounces-67399-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67399-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r17-20020a05620a03d100b00785db659ad7si1933509qkm.212.2024.02.15.09.25.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 09:25:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67399-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@bell.net header.s=selector1 header.b=1VDP+dix; arc=pass (i=1 spf=pass spfdomain=bell.net dkim=pass dkdomain=bell.net); spf=pass (google.com: domain of linux-kernel+bounces-67399-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67399-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4975B1C2278A for ; Thu, 15 Feb 2024 17:25:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28447136998; Thu, 15 Feb 2024 17:25:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bell.net header.i=@bell.net header.b="1VDP+dix" Received: from cmx-torrgo001.bell.net (mta-tor-005.bell.net [209.71.212.37]) (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 80BDC13698B; Thu, 15 Feb 2024 17:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.71.212.37 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708017927; cv=none; b=ACPPePT6WejiKzsUb+nf49jabthcYULm/f+zHJNdGekW/TlUuL4RtZdBSE+Ot19NaQKQRveLuNER8C05QLzGqXqn+81OLxt9V/7k6oVhQ407LV7V2GqSrq+k9kIW+etiilSc+Jcx8RjAdD7uSCAYUTiyl2pXnGqCCbJoeQJ1xA0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708017927; c=relaxed/simple; bh=YGF+xg9Zw2HpAEfB/LLNS8J3xoEcd0UnFW42VadKhTk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=L8z8VSzpyFvjV2E2E6y6eym/y3JoMgSlfVg6kq3LVXG0X6/dXKNoar8vkFzo5+ujZ+QDo8QJ39dBnqiT9pN/WgvB0hXjUWwppKwnDecdwXX4JennF/fkvgt2lTdwzbgKWpCdA+5MRDZBSfWwZZzK2vh7bAcKj8apR7kjiL3DC6k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bell.net; spf=pass smtp.mailfrom=bell.net; dkim=pass (2048-bit key) header.d=bell.net header.i=@bell.net header.b=1VDP+dix; arc=none smtp.client-ip=209.71.212.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bell.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bell.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell.net; s=selector1; t=1708017925; bh=zaQaPX04GVXGx4EuNSfjTExmNxEJBUFZt8AtN9ccB6o=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type; b=1VDP+dixUeia2IAQ9nB44o3THF6eg+UXEi6JjWzO2edlDbvoFxxbfOfXiW+tuVLSlmuHGtKqFQQ6yB3dNyPaMioiNOIjtt7blMrsiGUQ09MJPr7aptIdokZF5oNi6X82QbGL8g9HBPvjEl/eMTnRUq3t/DnEI9RYALb74/LPr7+mjj1hTuKaFgUKOOOJ32I1rG3qhXlFLvk4nqVDd24X/JwcQt1paJvGjeN4ao6gDfFJ1sP7/FRUb7kCJALj+9StLtChltJaHUE5TKgiWy9G9AjFYUbwMCpA0TrzxygBA8fRqEM/P3+JPD0Ss4hINOW7pfeBMb+ILdPMrVBKBZgjqA== X-RG-SOPHOS: Clean X-RG-VADE-SC: 0 X-RG-VADE: Clean X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 65CD68AA000FB6F2 X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvledrvddtgddutddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuuefgnffnpdfqfgfvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheplfhohhhnucffrghvihguucetnhhglhhinhcuoegurghvvgdrrghnghhlihhnsegsvghllhdrnhgvtheqnecuggftrfgrthhtvghrnhepjeelffffjeehgffgueehleegfeegueeigedtkeffgeduueetffegffejudekgfeunecukfhppedugedvrdduvdeirdduuddvrddvfeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddvrdeglegnpdhinhgvthepudegvddruddviedrudduvddrvdeffedpmhgrihhlfhhrohhmpegurghvvgdrrghnghhlihhnsegsvghllhdrnhgvthdpnhgspghrtghpthhtohepuddupdhrtghpthhtohepffgrvhhiugdrnfgrihhghhhtseetvegfnfetuedrvefqofdprhgtphhtthhopeflrghmvghsrdeuohhtthhomhhlvgihsehhrghnshgvnhhprghrthhnvghrshhhihhprdgtohhmpdhrtghpthhtoheprghkphhmsehlihhnuhigqdhfohhunhgurghtihhonhdrohhrghdprhgtphhtthhopegthhgrrhhlihgvsehrihhvohhsihhntgdrtghomhdprhgtphhtthhopegurghvvgdrrghnghhlihhnsegs vghllhdrnhgvthdprhgtphhtthhopeguvghllhgvrhesghhmgidruggv X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from [192.168.2.49] (142.126.112.233) by cmx-torrgo001.bell.net (5.8.814) (authenticated as dave.anglin@bell.net) id 65CD68AA000FB6F2; Thu, 15 Feb 2024 12:25:03 -0500 Message-ID: Date: Thu, 15 Feb 2024 12:25:03 -0500 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 v8 2/2] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests Content-Language: en-US To: Guenter Roeck , David Laight , Charlie Jenkins , Palmer Dabbelt , Andrew Morton , Helge Deller , "James E.J. Bottomley" , Parisc List , Al Viro Cc: "linux-kernel@vger.kernel.org" References: <20240214-fix_sparse_errors_checksum_tests-v8-0-36b60e673593@rivosinc.com> <20240214-fix_sparse_errors_checksum_tests-v8-2-36b60e673593@rivosinc.com> <2ec91b11-23c7-4beb-8cef-c68367c8f029@roeck-us.net> <4723822c-2acf-4c41-899c-1e3d5659d1d8@bell.net> <1e302d8f-4e94-4278-b556-b8fc54956efb@roeck-us.net> From: John David Anglin Autocrypt: addr=dave.anglin@bell.net; keydata= xsFNBFJfN1MBEACxBrfJ+5RdCO+UQOUARQLSsnVewkvmNlJRgykqJkkI5BjO2hhScE+MHoTK MoAeKwoLfBwltwoohH5RKxDSAIWajTY5BtkJBT23y0hm37fN2JXHGS4PwwgHTSz63cu5N1MK n8DZ3xbXFmqKtyaWRwdA40dy11UfI4xzX/qWR3llW5lp6ERdsDDGHm5u/xwXdjrAilPDk/av d9WmA4s7TvM/DY3/GCJyNp0aJPcLShU2+1JgBxC6NO6oImVwW07Ico89ETcyaQtlXuGeXYTK UoKdEHQsRf669vwcV5XbmQ6qhur7QYTlOOIdDT+8zmBSlqBLLe09soATDciJnyyXDO1Nf/hZ gcI3lFX86i8Fm7lQvp2oM5tLsODZUTWVT1qAFkHCOJknVwqRZ8MfOvaTE7L9hzQ9QKgIKrSE FRgf+gs1t1vQMRHkIxVWb730C0TGiMGNn2oRUV5O5QEdb/tnH0Te1l+hX540adKZ8/CWzzW9 vcx+qD9IWLRyZMsM9JnmAIvYv06+YIcdpbRYOngWPd2BqvktzIs9mC4n9oU6WmUhBIaGOGnt t/49bTRtJznqm/lgqxtE2NliJN79dbZJuJWe5HkjVa7mP4xtsG59Rh2hat9ByUfROOfoZ0dS sVHF/N6NLWcf44trK9HZdT/wUeftEWtMV9WqxIwsA4cgSHFR2QARAQABzTdKb2huIERhdmlk IEFuZ2xpbiAoRGViaWFuIFBvcnRzKSA8ZGF2ZS5hbmdsaW5AYmVsbC5uZXQ+wsF3BBMBCAAh BQJSXzdTAhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEF2/za5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e94-4278-b556-b8fc54956efb@roeck-us.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-02-15 12:06 p.m., Guenter Roeck wrote: > On 2/15/24 08:51, John David Anglin wrote: >> On 2024-02-15 10:44 a.m., Guenter Roeck wrote: >>> On 2/15/24 02:27, David Laight wrote: >>>> ... >>>>> It would be worthwhile tracking this down since there are >>>>> lots of unaligned data accesses (8-byte accesses on 4-byte aligned addresses) >>>>> when running the kernel in 64-bit mode. >>>> >>>> Hmmm.... >>>> For performance reasons you really don't want any of them. >>>> The misaligned 64bit fields need an __attribute((aligned(4)) marker. >>>> >>>> If the checksum code can do them it really needs to detect >>>> and handle the misalignment. >>>> >>>> The misaligned trap handler probably ought to contain a >>>> warn_on_once() to dump stack on the first such error. >>>> They can then be fixed one at a time. >>>> >>> >>> Unaligned LDD at unwind_once+0x4a8/0x5e0 >>> >>> Decoded: >>> >>> Unaligned LDD at unwind_once (arch/parisc/kernel/unwind.c:212 arch/parisc/kernel/unwind.c:243 arch/parisc/kernel/unwind.c:371 >>> arch/parisc/kernel/unwind.c:445) >>> >>> Source: >>> >>> static bool pc_is_kernel_fn(unsigned long pc, void *fn) >>> { >>>         return (unsigned long)dereference_kernel_function_descriptor(fn) == pc; >> This looks wrong to me.  Function descriptors should always be 8-byte aligned.  I think this >> routine should return false if fn isn't 8-byte aligned. > > Below you state "Code entry points only need 4-byte alignment." > > I think that contradicts each other. Also, the calling code is, > for example, >     pc_is_kernel_fn(pc, syscall_exit) > > I fail to see how this can be consolidated if it is ok > that syscall_exit is 4-byte aligned but, at the same time, > must be 8-byte aligned to be considered to be a kernel function. In the above call, syscall_exit is treated as a function pointer. It points to an 8-byte aligned function descriptor.  The descriptor holds the actual address of the function.  It only needs 4-byte alignment. Descriptors need 8-byte alignment for efficiency on 64-bit parisc. The pc and gp are accessed using ldd instructions. Dave -- John David Anglin dave.anglin@bell.net