Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2246420rdb; Sun, 11 Feb 2024 19:53:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/zF9rL/gH9PjcJMgQDjiL7q4WIDnx6/fWGFF/DtCvF+/UbCcvtp5SzItDdaRTtXh2VekJ X-Received: by 2002:a05:6402:35cf:b0:561:caa5:c12e with SMTP id z15-20020a05640235cf00b00561caa5c12emr169457edc.34.1707710001611; Sun, 11 Feb 2024 19:53:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707710001; cv=pass; d=google.com; s=arc-20160816; b=sAb5gE9KN2yqC4IJIp4A+Ll1SNGwUOH7gr6qVu2uSIR5rRVo+f3GlNpKU/xTiJs4mu IHzcOlw0+Yky14qsOzZN1u0YFWZoWryZ8GltQhVO1I4wfRnmKh9h4IfAJ4Yeh0Z9nt9J rdWDM20lj9qEZ/fFndEWOPaaiiIlJBcIm/CNhI8ore8KV9xHGbuS7QVd7BaMIJWlEfUl NQ7R5JlzKuL8jBHjdJnAU9xNB6vuiAHWI4pFb7bAPdVtwAO1SmCPpEVDjMYzMMqgeEcq oEp15V0w2fGz5fKpYnt770buzNYNrIB0bDoKi3T5wnhA0lNGGCfvApIYNrxohUTypvoC euDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=inoYkFy02Usw5aZpIo0v9tkTLH+MA6a15+xw5EX4KZg=; fh=6xRAJ2lg4ansBZVqaFPqe8gYpKwGkMrIox2QaYj+CqU=; b=O9caoRQzdXaw8KGrq1wi8JLE3SlmKRDC6WRACDhdLsop0ulygJ98rlVUtVWTmmmyUn aNukGHwewPN+I9kVWLAiNMT+XbfcBaP14LtygoonZHBRO1hzxrCvwasx5p00fhCCzsNg vEh2iEPVRkjjv2jHhwvjOCkJaaAbPIyzv3kowsGZP27oBKNwjRsJJPdjmSfWhR5uG3f2 o714ljiBsumuHjHk8rK3c3sKpJs82X0E5CSmuq47sshXRGn/7pUv+yhMKoN2rlDJD37q PQLzG4LD2MdtLrj1HZriQCoLbyO6vll9x4sM9SIY4r5yJBS3wVqlEZ0uSh1O4PiTRTRA uLgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=FUpJaGEq; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-61086-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61086-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCV32r9/iyD7GSQYSSoyR6lPsYXnrlUndNP14EQenScpNXcr9ZVsI2Xk9j+OpE95Gu05cZx4kdiDK/pg+cvwzJTbTXahAXniLyh4eYHUVQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l6-20020a50d6c6000000b00561860930easi1541431edj.87.2024.02.11.19.53.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 19:53:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61086-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=FUpJaGEq; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-61086-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61086-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5CAD01F2472A for ; Mon, 12 Feb 2024 03:53:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18EEE46BF; Mon, 12 Feb 2024 03:53:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="FUpJaGEq" Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (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 CB99B1876 for ; Mon, 12 Feb 2024 03:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707709992; cv=none; b=kszupXv+Uwew4kDfTq+3aBBr+GfYVV2cB4kyUas3tHk8I547Y8LepU2ZBACpuvi/w3wri3Gi0ebYnMUx1Vg9ic0QbKLoIMRi6jSAeZNSCNWx7ovE9jP6ABf2Yjd8V8yQ/Z6DbhjqwN8lFikpKV3i0Q6YUCVRUtrYEqDlXV+GlF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707709992; c=relaxed/simple; bh=HkMCBw0DGHALj+SwJeNyQL3YJIfK1uCy0Bfa6T+jdJM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SxaY0BYNs2HMFbfOWFhSCDdq+4IU4yK7sqhmfnWZfX1p8mg8LOWwSZmA2zA4oeNvwIlPkSngrMFzLd8dCwMoNPK65UDhIxfItFwmLzjqnO42y/KxFDt8XezgXcdPwd6JN0NzrUWlou6VsTsEqLwa40j0D/8OggS9rG6spg5Xlv0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=FUpJaGEq; arc=none smtp.client-ip=209.85.219.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-dc742fc3b68so3141314276.2 for ; Sun, 11 Feb 2024 19:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1707709988; x=1708314788; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=inoYkFy02Usw5aZpIo0v9tkTLH+MA6a15+xw5EX4KZg=; b=FUpJaGEqWbPSkjcbaUW6SWnad7qOWndHNN/I8bBiodMsMY/j2eToFu0CSs9HohhDAO JLt/Yd7ci1YhDalR7YHAKh/fEkbGsN/TDqYnQEtSAd5x9SowRfMzFZFYK5E5bVUuZd0w 2yPkpsdFC2xFQsQXHqpiAkuGO4S4uRf5uJRUOnBvuRQ9XnWGAAfT4mA49EVbCZaPjuAo Nv8cixW4fbY5p7Mg4nB8tiOvuXL8hWrKqeiY8vD5iw3eSXXZdZZHcfx9OVujAFX7+JSj bIldEr0DZeIEuCMmcKdC9uTAHOVKp/qTq1QQa7jjm1EAB0RYRz/4eckM9flzmPpmZL0L xVeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707709988; x=1708314788; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=inoYkFy02Usw5aZpIo0v9tkTLH+MA6a15+xw5EX4KZg=; b=ffsdMxYUYJZYtMf4VQzPGAJq7fA1nNZoPJeA2j3wWqMB0AcvkUWsS9hbyTywAik6so tPp6jS96glx/qEoQI7UbFpjijlQ1j88mvYIwM8iO70qZRz//iqtuvRSQYhdQX/MDthfj DFnQzco1sLqAiuBCNnIYviNkrA6M/IiHqO4vrCI6tiCMnqr1juOayZ8QOkxqxA94wfX6 85C/cnJG2fwGVZfbnznbMnrxf8dbwdHjv54NwNJXpxfdSBLiU2UeJL90beEjbR5t9Fii zxM8+rkaERlfnioigFNfv1003CLFyNzry4ewx/ujwOEjLELpLEdLN83vX0oKfMUH5poR 6tSw== X-Gm-Message-State: AOJu0YwROVyyUM15Xxt/CHBebneMHGTsmhBYVHdRa5z3FAR231AQWwQw DPWGmYGt/bYVgIXZE9wxl+uuqI3FJosSvmbHx8JtAfp914WcMLo+IdJfTXXEIbM= X-Received: by 2002:a05:6902:1b90:b0:dc7:443d:d9da with SMTP id ei16-20020a0569021b9000b00dc7443dd9damr5276409ybb.4.1707709988724; Sun, 11 Feb 2024 19:53:08 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWxRCBA6JSrWoNOmSBHvQf6ESrYKH1hwruGLxZRxzTpi22WVw8Zh02svYy6czO+Oebs6yEURoeqiGjs2EbvjVYTaJJ7SYXcjUatOekFnR3JBPHY2vrgP8nVOcY7R74nPTohxElbXP0sRsqSbCHso925i9S5LbST0C601VGvLw== Received: from ghost ([50.146.0.2]) by smtp.gmail.com with ESMTPSA id t5-20020a25aa85000000b00dc254858399sm1117808ybi.2.2024.02.11.19.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 19:53:07 -0800 (PST) Date: Sun, 11 Feb 2024 19:53:06 -0800 From: Charlie Jenkins To: Guenter Roeck Cc: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Palmer Dabbelt Subject: Re: [PATCH] MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler Message-ID: References: <20240211160837.2436375-1-linux@roeck-us.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240211160837.2436375-1-linux@roeck-us.net> On Sun, Feb 11, 2024 at 08:08:37AM -0800, Guenter Roeck wrote: > 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 > --- > 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); > } > -- > 2.39.2 > Thank you for looking into this. It fixed the failure on my mips64el qemu setup. Reviewed-by: Charlie Jenkins