Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2714403rdb; Mon, 12 Feb 2024 14:12:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWioxw3JOSp/d07013HC/yQtPJXxPZQcL4NVkElWZ8dmE4bSOR7qsaGT/T4iD4GiFswMJO X-Received: by 2002:a05:6402:2d6:b0:561:b603:6c4e with SMTP id b22-20020a05640202d600b00561b6036c4emr2416361edx.3.1707775939124; Mon, 12 Feb 2024 14:12:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707775939; cv=pass; d=google.com; s=arc-20160816; b=mAoBH4bC3M98zQ/dJVx4wB7yFzBXwW+3Cf+RzQcui4uqHrnFbyXfJKFpHEjMJQSGGj /yPJgVdsuWzLUPhN2GqrP67xs8N6X+XHeWmISaSNuT4Ye2cgUVxXHgMUBIphivMbnYEY G4ZQcAOMXCq9bBiv0GH0txwvIwCPYMoDIHMSJP4oQxIivIGTTWRCMFiquaPMjR7EYVTq JcuzqEYwYpnet4RXdsA10HQwwY+MFwTbMfV5Amzlcjl/zWYLP48jL1llhb6p8yfxownE dFYiEhgy6jmIWfPAxl5rY1dFuD2JdPFCRxLXFkJAOZknj45OdNMibO5NKaVdZHlpKpul mEYw== 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; bh=1ITBLlzqh3/fZmScS3ZnASwvQIG87ZKmJH9Z+KF8WhA=; fh=I2mHS7RhsXhfbktScBuo3WlUfco9vz5nqVgOHDk3Tcs=; b=cJSPLw/9lbU1GSrsBO062yoA1KVBO6+IeKddJfT0wnROeQd9IkKlu357JHZH9E9KHX vFY/lxvs9HYZNYJl3bdE5eKrKJodBEpOT+HffzLe+OYHLRl4MWR5IwNyjGFYZymuj1x5 77oeKzX+d7jOmOg0vVTpTU4Rer0fqiN1IiX7PSkMANSpEMgH3phQbWuF8MLy9IF8BllW +zZeBA+pKpf4vFuG3Pdwd6cuEGsnJn2rqDYhRC8ZcUDYZC4OtftwbkE6GzIPqdwE0cAn hgPrf9XnCcAWiM+L9FUvFJQr/KDzcvMYXfDrxunv6U7dBgRdCw/ZXeyDBcojVK26mC4t RpRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=alpha.franken.de); spf=pass (google.com: domain of linux-kernel+bounces-62460-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62460-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUdEHkttqZf2xpY+S8YQQfH4AxYq3iz9xbUM004sTPNxxnFclBc9vqggmrHULKJoaXjfdibY7byIL787PxYfgWVRk8RGGnsW85l19qc2A== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i16-20020a0564020f1000b005618049960esi2481765eda.140.2024.02.12.14.12.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 14:12:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62460-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; arc=pass (i=1 spf=pass spfdomain=alpha.franken.de); spf=pass (google.com: domain of linux-kernel+bounces-62460-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62460-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 D90231F21CE5 for ; Mon, 12 Feb 2024 22:12:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07F654D5B5; Mon, 12 Feb 2024 22:12:12 +0000 (UTC) Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7433A4D59C; Mon, 12 Feb 2024 22:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.175.24.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707775931; cv=none; b=CVeFCrg5ciYFc0ds2+LtLvwDMOFTUPNmIhFkMcRAk8eeVXx27W1gQwx80rQQbR7GVI334r5X4G6bXsRmdeeF5togJciDLyoHy+SKxetIlnOPs226vwNuBQuj38m3jRX58ne1zEg6PValUtGbmLhUgdxkeWuJqKAhy0cY7svYkgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707775931; c=relaxed/simple; bh=RhuxBaFv9+X6IjUPB1x+8s2diCNbvkSPrmzjHzBrDh0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=evBLGbEzzcU7nZm+SvgdwEj0oAvYPA4et/pGXHoIxyKFNW8/n1oFqvnJAzscEc8UW9ZdoJER7TmMlwTG/9jhQAEsEOgyB9j6xqNAhximtVUEKsDvIqQcc5GNSYm6oUFfY5s8EOWEe/N57YxUdMfwDWXVZYwkvpwsigWVCE3Zy9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=alpha.franken.de; spf=pass smtp.mailfrom=alpha.franken.de; arc=none smtp.client-ip=193.175.24.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=alpha.franken.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alpha.franken.de Received: from uucp by elvis.franken.de with local-rmail (Exim 3.36 #1) id 1rZeWs-0002fx-00; Mon, 12 Feb 2024 23:11:58 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 96BCEC0267; Mon, 12 Feb 2024 23:08:45 +0100 (CET) Date: Mon, 12 Feb 2024 23:08:45 +0100 From: Thomas Bogendoerfer To: Guenter Roeck Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Charlie Jenkins , 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 applied to mips-fixes. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]