From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757847Ab3KNVWo (ORCPT ); Thu, 14 Nov 2013 16:22:44 -0500 Received: from usmamail.tilera.com ([12.216.194.151]:33647 "EHLO USMAMAIL.TILERA.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756160Ab3KNVWf (ORCPT ); Thu, 14 Nov 2013 16:22:35 -0500 Message-ID: <52853F18.4040605@tilera.com> Date: Thu, 14 Nov 2013 16:22:32 -0500 From: Chris Metcalf User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Pete Zaitcev CC: Evgeniy Polyakov , Erik Jacobson , Andrew Morton , Matt Helsley , , Subject: Re: [PATCH] connector: improved unaligned access error fix References: <201311141743.rAEHhuEV004998@farm-0012.internal.tilera.com> <20131114124549.7b5f3a7b@lembas.zaitcev.lan> In-Reply-To: <20131114124549.7b5f3a7b@lembas.zaitcev.lan> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/14/2013 2:45 PM, Pete Zaitcev wrote: > On Thu, 14 Nov 2013 12:09:21 -0500 > Chris Metcalf wrote: > >> - __u8 buffer[CN_PROC_MSG_SIZE]; >> + __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); >> - msg = (struct cn_msg *)buffer; >> + msg = buffer_to_cn_msg(buffer); >> ev = (struct proc_event *)msg->data; >> memset(&ev->event_data, 0, sizeof(ev->event_data)); > Why is memset(buffer,0,CN_PROC_MSG_SIZE) not acceptable? That would be fine from a correctness point of view; I'm happy either way. My patch nominally has better performance, for what that's worth, since the memset() call is for a smaller range (24 bytes instead of 60). It also avoids the need for put_unaligned(), which even on platforms that allow unaligned stores can still be slower. I can certainly do a v2 with the larger memset() instead if that's the consensus. -- Chris Metcalf, Tilera Corp. http://www.tilera.com