From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (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 3F06E10EA for ; Mon, 17 Oct 2022 07:38:49 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 0BC38320090B; Mon, 17 Oct 2022 03:38:47 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute3.internal (MEProxy); Mon, 17 Oct 2022 03:38:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1665992327; x=1666078727; bh=zbjFXoy9ah NSpk7XfIRFOe6vIEM/swg042Zyz7dwIhc=; b=STyWlc5pFOLM4Fqu7Qsbcu8XpO J3iw3DP6idXN3jEIXxRbe2lS2MhA0LHDX7HzN404PTmEYKnnW5YSQ+itreGF6msA H9zX+uSuDrTS7BuwStw52gcIQ1aOg0Zsxn0yqTndNey7OMTFgg65uC2BH/huMNpE DgiTfEa6T8NKAiLejxDmVx6EOW5GkweiJbbf6oOPJfJnTZgZaBAOLq6Myu+6rjeE MXVFnhOawO/WLvWNd3Df1U6FNkMwNymB8grdyj42ywWvkRA64dYTl3zkkxBczGSq k7F8AZFfNLLyCPHFPbxEpK+1h/fByXivj1thkhwY5WAgFcPh5JuFkTGL58Ug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1665992327; x=1666078727; bh=zbjFXoy9ahNSpk7XfIRFOe6vIEM/ swg042Zyz7dwIhc=; b=Qd6SvW9zmWEnD4/tbkg1fmUUJbeyZ0+wxvnl7RFFJRu0 sP/AEYdF9tHwSpnjtSj/gyHmGfPMnJxWlZDlkVCRp4ZDw2MR/ldfG9P7+RMK96Of pL8Kg0ApG2Sr9PdNLI1kvFYzOU0iyAKpzS/oSTvwc97Ss+9RsJP9hbnxm42GBS3c U4Cnb/mhjTkthnKQ4f6YvQ0VkRqCN54SjhiSeObeLftGVAbqJH2kGUeNeDQ2Hbsa YWGpxKCyjbjQEuJSWIJ1hVEtO8L1csy28O1+u4D5Prg36O4fsmLHGyvzLZJ5tX5b wbpviAYIXyLU/xISPCuthPIGjlFGimzY7oarEg5Aqw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeekkedguddvvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedt keetffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id B9A7DB60086; Mon, 17 Oct 2022 03:38:46 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1047-g9e4af4ada4-fm-20221005.001-g9e4af4ad Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20221016133418.2122777-1-chenhuacai@loongson.cn> <506fe4e5-a203-48e6-84a6-f70133be15dd@app.fastmail.com> Date: Mon, 17 Oct 2022 09:38:26 +0200 From: "Arnd Bergmann" To: "Huacai Chen" Cc: "Huacai Chen" , loongarch@lists.linux.dev, "Xuefeng Li" , "Tiezhu Yang" , guoren , "WANG Xuerui" , "Jiaxun Yang" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] LoongArch: Add unaligned access support Content-Type: text/plain On Mon, Oct 17, 2022, at 9:31 AM, Huacai Chen wrote: > Hi, Arnd, > > On Mon, Oct 17, 2022 at 3:12 PM Arnd Bergmann wrote: >> >> On Sun, Oct 16, 2022, at 3:34 PM, Huacai Chen wrote: >> > Loongson-2 series (Loongson-2K500, Loongson-2K1000) don't support >> > unaligned access in hardware, while Loongson-3 series (Loongson-3A5000, >> > Loongson-3C5000) are configurable whether support unaligned access in >> > hardware. This patch add unaligned access emulation for those LoongArch >> > processors without hardware support. >> > >> > Signed-off-by: Huacai Chen >> >> What does the Loongarch ELF ABI say about this? On most architectures, >> C compilers are not allowed to produce unaligned accesses for standard >> compliant source code, the only way you'd get this is when casting >> a an unaligned (e.g. char*) pointer to another type with higher alignment >> requirement. > Some unaligned accesses are observed from the kernel network stack, it > seems related to whether the packet aligns to IP header or MAC header. This is usually a bug in the device driver. It's a fairly common bug since the network driver has to ensure the alignment is correct, but it's usually fixable, and fixing it results in better performance on machines that support unaligned access as well. Which driver did you observe this with? > And, gcc has a -mstrict-align parameter, if without this, there are > unaligned instructions. Does this default to strict or non-strict mode? Usually gcc does not allow to turn this off on architectures that have no hardware support for unaligned access. >> > +/* sysctl hooks */ >> > +int unaligned_enabled __read_mostly = 1; /* Enabled by default */ >> > +int no_unaligned_warning __read_mostly = 1; /* Only 1 warning by default */ >> >> The comment says 'sysctl', the implementation has a debugfs interface. > Originally "enabled", "warning" and "counters" are all debugfs > interfaces, then you told me to use sysctl. Now in this version > "enabled" and "warning" are converted to sysctl, but there are no > existing "counters" sysctl. I don't see the sysctl interface in the patch, what am I missing? Arnd