From patchwork Sun Feb 11 16:08:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 199484 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1993637dyd; Sun, 11 Feb 2024 08:08:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqy7Zc42yanmlsPHGGM7sbm/1jZ5vyre2/xXDfQVXUJs7Bk01lu+xL8Dw27tFlVvKt8oMu X-Received: by 2002:a05:6102:358:b0:46d:2088:70a0 with SMTP id e24-20020a056102035800b0046d208870a0mr2686645vsa.25.1707667737680; Sun, 11 Feb 2024 08:08:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707667737; cv=pass; d=google.com; s=arc-20160816; b=hb2PyNaFSyDAscVHVZJmiseYj+NuW3SgSJCTrxIYvAyKStysaeWCz35Snxe7T6kwiY Vvy8Hzjh4xLNM9AruuShN658/KGmQc2GcrRNdvLspumY8A0yHRmU0ZLPTRPy3wu2djZW G93WrCIsSgfYluOss67YTeeygnZbPVs1GANc2jlEVjbmcFQax3j01V7+TAh9CHABo70M MPISNQIeA43Aoj28ngxjinYdNWuo/FtJ7v/XABBlvZ7+/5vU6LvMWRVU3QZK7ebATPO2 WoGdOAvs302EceMdWRtFbkY1I9VYjExohXR3UnVH9ITo/+fWWmBGngtVum1ttODOpGBM fa+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:sender:dkim-signature; bh=lotKNDu5K1rKJW60VS8sQo+NyQpFqzMMO/FPKjpoA2w=; fh=0nG9fxIjoJALC0zsQcrgbqAPNJ9DfTkdZeYKQQUGlSg=; b=jYrs1PYWOXVLmEQl3L6hMKR7TyfrilV8ugIWzKH/m5nlsmjxfdVt/hpzq9zghK4/x6 hzZayFs7JeAahKMMc9QfKa4Ck8dNe05eSaAZ42Zaq+XxdRZufnPnmnUbFK0V/jS/HL7z MOR2j7RiLvm0931B5fV1Sv16VDlCRKvjxra6ZGA+SVfNWwpR3Zmwu+SqJZPT/VrTsZ1Y PemQxrbvdi8LKfAYO4vx+KPIiGZ8+RZ/pGJ/479wLRs3S6sObaCM9aFBV9M1Jgpmih+J 0qvmsppn02v0qjPxiqkq4o3RBmLtWpY/ANLJGQOBkZ382OGS9zwfRXbySpOLE6a4XzLE PJaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="chvvX/L0"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60859-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60859-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCW4qo1jddfqN1D+y8qoq4JNDMIedS4QrPzOEUDyXi6pcmLj6L9011sTd2oLnTv0BMuyU6Fk/oim8fvu0ibEXw3tmG01yQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c7-20020a0561023c8700b00466e97e375csi544018vsv.468.2024.02.11.08.08.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 08:08:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60859-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="chvvX/L0"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60859-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60859-ouuuleilei=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 668181C21CA5 for ; Sun, 11 Feb 2024 16:08:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3BF95C5FE; Sun, 11 Feb 2024 16:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="chvvX/L0" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 57D121E488; Sun, 11 Feb 2024 16:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707667723; cv=none; b=bIBCqmCNIlHIKLhepkB1+4PA8BpVr0RIY7Au7t7CUn/BE7dYK+vP/l0LYMhAVnEUEgmAV/yLm9penob2GyMukinoyI4BCVHrskpsRoVilW5T7whZXXPOG9Tr7t7YIM6YvKDfVneQOnjZfzRdYtlOIKD1CmnOPkk8QAfkNEMCDBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707667723; c=relaxed/simple; bh=N55mi/y8ytD51GnohFmYC1C7IWXhLQVa5jGRqoxECmY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=q78ZNv2gJAdhG8HhkyrmGV4+xGlZQcI6hlZ/h5Riu3GVnPOp2UzGe4UPc+EOpY/s+EYQolarVP0HnV4CmvJtHQWB2//l5BnFtZileMRNIJwuJwsTJc1Luvp3d46UfMbpBfS/6R/bnAMjrkcIvzjlf0Li6UbwK76seRf5/79NOko= 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=chvvX/L0; arc=none smtp.client-ip=209.85.214.169 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-f169.google.com with SMTP id d9443c01a7336-1d74045c463so19501245ad.3; Sun, 11 Feb 2024 08:08:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707667721; x=1708272521; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=lotKNDu5K1rKJW60VS8sQo+NyQpFqzMMO/FPKjpoA2w=; b=chvvX/L0H4FHkSzWdUv1L6H1YwjEPwAWgO4II7+wSM/sSzi1jJ4kJviUGLDymZP/sr bNGyg4FAZnE+4I2ALzsc1pzUMN75Ttmu+OAYLZNcWgxm8MtME9hlcoYM7GZp8HmspVCj 2ceY0pfmCAFA0rcw10P56vJnBHIhTmehYQOx9Y/TvhL5UkkAfujLF7o/uMM3Rjex3cCb gCO9y7w+jDCkeDktvcswVtSTK6yOA7T0VaJTng93xe3y14twDxQWUDwUbo/6l2zYGjRz uBJcYYFJzSdFn2ZRXSA8wsAWlMGst46Mo9pV20zCM5Fx5nI52+2HLh6PDdoSpHcDy3oB 2GgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707667721; x=1708272521; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lotKNDu5K1rKJW60VS8sQo+NyQpFqzMMO/FPKjpoA2w=; b=WOykkH1P/g6fY5EeAkVM8sM5e9xh2cpRbGVe5OCy5eHGhhmz5NsDt0XJN0Epb0Mxbp MkX5VgLFR3/NphtLD8z8FRvCBL/0nJl/querA0l1urUB+QDCxR9k6Gi5hJUHsdnQ6zWZ u35TpXEDgbMfxKSRY6IGffyRg0bRi7PbvjNsjgbsQyapbJQBaORFehA9RP3z1JXSEQ1e 866ocDjNGSfgsu4Lz/9a7aAskXwy8/7pyGdIit46nn57HVG4pIFeTFN4/8617a92D5wB 2JWpWYXMNbNwifBtqE2RNydRk5/35vLS6BpvbTwv8Eu2ZjTJ/92v/cXPxUdNj8tBAnCh Z6+g== X-Gm-Message-State: AOJu0YwhQm0LA38gSiDLC9qRRxMabPn0szhBGgp39uUwfAhofHIAF+Gs ppnRx9w3A1+I8e7astal5ArY9R938Qt0VNfIXRrgHsPDLDxyby7chWDvfuEU X-Received: by 2002:a17:902:f80f:b0:1d4:4df7:22ab with SMTP id ix15-20020a170902f80f00b001d44df722abmr3718138plb.55.1707667720573; Sun, 11 Feb 2024 08:08:40 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWv3UwthIijA0gLXk2GNfKrxVQMENxp7ruxwbs0m7VQKdhCL01TFfyeqgsgnvmHRNkIXdakMHlT/BOQzck7Yb1lZm5nF2H1tBEV0bw7rCgQME2D7WZLJJESjkF2xUwhaPVFOB5yzvisQWBd08e5T3PvkVS5hIZwDjbMYF0PoLvnEdDobsC6DocziUqG Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id e16-20020a170902cf5000b001d9b092bcd9sm4495980plg.148.2024.02.11.08.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 08:08:39 -0800 (PST) Sender: Guenter Roeck From: Guenter Roeck To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Charlie Jenkins , Palmer Dabbelt Subject: [PATCH] MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler Date: Sun, 11 Feb 2024 08:08:37 -0800 Message-Id: <20240211160837.2436375-1-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790619405673520710 X-GMAIL-MSGID: 1790619405673520710 After 'lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests' was applied, the test_csum_ipv6_magic unit test started failing for all mips platforms, both little and bit endian. Oddly enough, adding debug code into test_csum_ipv6_magic() made the problem disappear. The gcc manual says: "The "memory" clobber tells the compiler that the assembly code performs memory reads or writes to items other than those listed in the input and output operands (for example, accessing the memory pointed to by one of the input parameters) " This is definitely the case for csum_ipv6_magic(). Indeed, adding the 'memory' clobber fixes the problem. Cc: Charlie Jenkins Cc: Palmer Dabbelt Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Guenter Roeck Reviewed-by: Charlie Jenkins --- arch/mips/include/asm/checksum.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h index 4044eaf989ac..0921ddda11a4 100644 --- a/arch/mips/include/asm/checksum.h +++ b/arch/mips/include/asm/checksum.h @@ -241,7 +241,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, " .set pop" : "=&r" (sum), "=&r" (tmp) : "r" (saddr), "r" (daddr), - "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); + "0" (htonl(len)), "r" (htonl(proto)), "r" (sum) + : "memory"); return csum_fold(sum); }