Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp568564rdb; Thu, 15 Feb 2024 08:30:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWuuwfRclpaIym+6Tr6vu4VI1yWxZGTm0iwkMZ3oUsFzKLqAT5o3AHxA4ejr5ARvjEHLyQ2t3vfEj//c2s9faNE7IUfP+HLm01TzAdsvw== X-Google-Smtp-Source: AGHT+IHtJqu7AcuvzooD+gyxrDAXPiFqm8scwpsMKlKxFTtVjjNnv/WqWrqwkLNuTtC5yYp0EiTk X-Received: by 2002:a62:d452:0:b0:6e1:e25:73f9 with SMTP id u18-20020a62d452000000b006e10e2573f9mr2554318pfl.7.1708014634595; Thu, 15 Feb 2024 08:30:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708014634; cv=pass; d=google.com; s=arc-20160816; b=VuayFl9CKktbPs9DM2w9cup23nhF6Lzv76Pkn4yOMgUq+8lr/6oXESckGmShLbZKMK KU60Sw2c3NtoY/WlWjOoVeiQuiUyDd9xNQRLq2zLsyBX31IdgKtEwbO/aAGVJhV31QfX lsXm04XOix1FhQ263kPa0Iq9t4HJ0Pzif3z+13MFSFZocNzIuhshxPghycl9dQbK9NIq gaALKf5yKmC3/hYrqz9Q1KBE0XNq7fXtSVqbgNBQ7IMlHmitbSO9bGB4Pw2hewah0bp6 B+4hclHRLNK9IPmhT0DeiHncXDbxM3NvzTHZYS/tw9D2zqPY/oASMgIziCpwgYXJ9QFd 2cBw== 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 :sender:dkim-signature; bh=ayerQMBhM1U86A9++70+9riJj0G7Pkbo3k+9s9+t700=; fh=5bZFXSiwNLAlYarmVm7n9h1vd/owTvpuwEZUGu4+1gI=; b=ooE/KFwk+RzHFeA05YEOzuQS8QoFB79BkFfMnxkjNRU4/VJ7DRoKcqpTQ/K0QaLvfC p/005we/apoO4ifxJtvHaU+oisPvLVObRAVhYFbVqLpIZ4kCyIV+LjEHhGcGeEEpPl7t 1tFVTuz7dhYEKJoY6dMbhGGVhbF3IsA0JvrlqdnOto0nYt1p5z4u1mVoQtKhjXF1muwx V9buhSAiv+JAamplKi4IMv9opd249ffrMGFq/FP/LXbmCSndZSJkHdT+0GNWBwWV9LLh pubnB5ON+lPYUX4JmXFSPccOuYIxICpHO8ot8OTp/7gqVoiPjh0ypWK+jGpqOnC6ylNt m7JA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QThizXhO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67311-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67311-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b18-20020aa78112000000b006dbe30aeb1dsi1362101pfi.112.2024.02.15.08.30.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:30:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67311-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QThizXhO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67311-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67311-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 293132927F3 for ; Thu, 15 Feb 2024 16:30:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67D30135410; Thu, 15 Feb 2024 16:30:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QThizXhO" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9854B1353FB; Thu, 15 Feb 2024 16:30:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708014629; cv=none; b=BhjYf/7WK1VTaYW9Z7TEEqSufvkxGTx7/GsUSUaEmFrWn27GJXp8zxXGwIUZ8EfFp2nIqard0oFi5Q9tzpiuvWTgF7bN3l9PZK6hO5n4KUJDHY3uDbL7SoPOqqONi2aetmfglxGXiWvJ8wjZLsgQuEWHfMTnUFLmsA6cRQX0CMY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708014629; c=relaxed/simple; bh=vFqF9N1EzbJYqmh428i581vtsdh+Mio0PRFpoThYTuU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jkrlUGminAdwWlgfzftiWVijXRk4ycuQU+I5aRcBUmWZIOYTcfCJffMHKqd4muEZbZyDByeONRfzmjTjgT9Nu5obN117i63WfILT5WnwqkYHkVSJapgVMBPvyw0mGiPTr61Z9fiEJSgjJL1JzxeCzk+JY0wkoKH2dE4itL21sJw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QThizXhO; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1dba177c596so309385ad.0; Thu, 15 Feb 2024 08:30:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708014627; x=1708619427; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=ayerQMBhM1U86A9++70+9riJj0G7Pkbo3k+9s9+t700=; b=QThizXhOJsjpMDFqrZVW5j+fyYLKhfpyNkmrPcCn0cTQRjq/qduOpItDOotxFbqHGN xLTwo9IKThdyV8oFCZ904+RyG+a6/gH1atK0xvMQtPFeMz8XDDuXngth03/rfBhJtBeA xZKEmVL/A8CtSnZaEH70IJfxYP0LNUuOEB1J7t/8ppfcfNC6bu2JT921PwQoCoAosn61 FPH5jg2OD8+N2mwUCxjjvIPbgtN1pNsmaucq5xnb35YoSTz1NZT3yYLvjJpLNgfsogop csZBVqMjhyYtGbRW8slROT+WINrZ+dApSDco44Ft8nOKlWU23RBUJPyjV6RapDNR9Ou9 Ydww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708014627; x=1708619427; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ayerQMBhM1U86A9++70+9riJj0G7Pkbo3k+9s9+t700=; b=uwqhZ0TO+Xb4N6PNn4ejs1NHf1bsIDbPIwuZ4dpXD8varxC0hIa3GZqj0j4CvJI0D+ t614NuO6/KWTZsbQV4rVDyhEDkSbctkkjTFfUS9NzMWKlarJxb8e6H5kP06BZheoCS+s jY/mjd33eP9zu9oSVX5Nh8yFdfqZdJBgNxqjcAauGlCEJVyZxjRRVj08C10KOpD+MOnc pc13RJA6Ve2Vln04Q+0EpUJ+jR6/FLUlbDCs4bsmhciIVLhmc9fAu9zY89hvtgOW/QqB bRm92fPtkFBNxBkmL6ZFtYbii12kklkEWYphfKW8qgVqhWGke7sM1TbsarEkyPERUcPm luQg== X-Forwarded-Encrypted: i=1; AJvYcCUpHDJlMvqKg45u5mXxpEnky9zAgy83QVS0smkX2/dndijeehijx0oHX5c3GTb6xifLjOZkg8cmdtySaDnZcJqAb1pyjjXWUEx8MEA4KhNOPuU3VtY+5qOChSyj8LWoD9xNsn47YC12YBP3 X-Gm-Message-State: AOJu0YzWOd/3dLrqZhZ3UhKXhyfGsgcyMfqGqmGi0xWfF+mp/V/NpdE4 TvQgzk0P1tUUQqYNF08BpfF6kWcFJbW0DRqECTmBrqoP3fWlaV7B X-Received: by 2002:a17:902:f7d1:b0:1d8:ff72:eef8 with SMTP id h17-20020a170902f7d100b001d8ff72eef8mr6350878plw.18.1708014625357; Thu, 15 Feb 2024 08:30:25 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id jd22-20020a170903261600b001da2951a788sm940094plb.304.2024.02.15.08.30.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Feb 2024 08:30:24 -0800 (PST) Sender: Guenter Roeck Message-ID: <0fa4d53a-6ce7-4f44-81b2-86282f0b9451@roeck-us.net> Date: Thu, 15 Feb 2024 08:30:22 -0800 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: Charlie Jenkins Cc: John David Anglin , David Laight , Palmer Dabbelt , Andrew Morton , Helge Deller , "James E.J. Bottomley" , Parisc List , Al Viro , 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> <1d5e059e-5b31-415d-ae41-593415812e94@bell.net> <11fff7fe-ec4c-4340-a67f-d1d54d0712d8@roeck-us.net> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB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DnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/15/24 07:36, Charlie Jenkins wrote: > On Thu, Feb 15, 2024 at 12:56:13AM -0800, Guenter Roeck wrote: >> On 2/14/24 19:35, Charlie Jenkins wrote: >>> On Wed, Feb 14, 2024 at 10:00:37PM -0500, John David Anglin wrote: >>>> On 2024-02-14 8:58 p.m., Guenter Roeck wrote: >>>>> Specifically: Yes, the carry/borrow bits should be restored. Question is >>>>> if the Linux kernel's interrupt handler doesn't restore the carry bits >>>>> or if the problem is on the qemu side. >>>> The carry/borrow bits in the PSW should be saved and restored by the save_specials >>>> and rest_specials macros.  They are defined in arch/parisc/include/asm/assembly.h. >>> >>> Why would they be needed to be restored in linux? The manual says "The >>> PSW is set to the contents of the IPSW by the RETURN FROM INTERRUPTION >>> instruction". This means that the PSW must be restored by the hardware. >>> >>> We can see the QEMU implementation in: >>> >>> rfi: >>> https://github.com/qemu/qemu/blob/v8.2.1/target/hppa/sys_helper.c#L93 >>> >>> handling interrupt: >>> https://github.com/qemu/qemu/blob/v8.2.1/target/hppa/int_helper.c#L109 >>> >>> However the implementation appears to be faulty. During an RFI, the PSW >>> is always set to 0x804000e (regardless of what the PSW was before the >>> interrupt). >>> >> >> Not sure if I agree. The interrupt handler in Linux is the one which needs to set >> IPSW. Looking into the code, I agree with Dave that the tophys macro seems to >> clobber the carry bits before psw is saved, so they can not really be restored. >> The only issue with that idea is that I can only reproduce the problem with >> an interrupted ldd instruction but not, for example, with ldw. This is why it >> would be really important to have someone with real hardware test this. >> >> Thanks, >> Guenter > > Yes, we definitely feedback from somebody with access to hardware, but I > do not understand how "The PSW is set to the contents of the IPSW by the > RETURN FROM INTERRUPTION" could be interpreted as anything except that > the hardware is expected to over-write the contents of the PSW during > the rfi. > Sure, I absolutely agree. But that assumes that IPSW is set correctly in the Linux interrupt handler. We do know that something odd happens when an unaligned ldd is encountered. At least for my part I don't know if the problem is in emulate_ldd() in the Linux kernel or in the ldd implementation and trap handling in qemu. I do know (from my logs) that qemu does see the correct PSW/IPSW values, because they do show up correctly in the Linux kernel when running the qemu emulation. Only it somehow gets lost when the Linux interrupt handler returns. Thanks. Guenter