From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965042AbbDJNgq (ORCPT ); Fri, 10 Apr 2015 09:36:46 -0400 Received: from mail.kernel.org ([198.145.29.136]:40705 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933256AbbDJNgm (ORCPT ); Fri, 10 Apr 2015 09:36:42 -0400 Date: Fri, 10 Apr 2015 15:36:10 +0200 From: Sebastian Reichel To: Arnd Bergmann Cc: Kai Vehmanen , Aaro Koskinen , Pavel Machek , linux-kernel@vger.kernel.org Subject: Re: [RFC, PATCH] HSI: cmt_speech: fix timestamp interface Message-ID: <20150410133609.GA8029@earth> References: <49891497.PNlYVWnWxN@wuerfel> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline In-Reply-To: <49891497.PNlYVWnWxN@wuerfel> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --J/dobhs11T7y2rNN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Arnd, [CC'd Kai's new mail address] On Fri, Apr 10, 2015 at 01:59:19PM +0200, Arnd Bergmann wrote: > The user interface for timestamps in the new cms_speech > driver is broken in multiple ways: ow :( Thanks for the report. > - The layout is incompatible between 32-bit and 64-bit user > space, because of the size differences in 'struct timespec'. > This means that the driver can not work when used with 32-bit > user space on a 64-bit kernel. >=20 > - As there are plans to change 32-bit user space to use > a 64-bit time_t type in the future, it will also be > incompatible with new 32-bit user space. >=20 > As the driver is not yet widely used, now would be a good time > to change it to just use a 64-bit nanosecond value, which also > happens to be more efficient. In order to make the layout > non-ambiguous, we have to also add extra padding so the 64-bit > value is naturally aligned. >=20 > The change requires the respective update to user space tools > using it. If that is for some reason not possible any more, > another solution would be to replace the timespec structure > with two __u32 values to avoid incompatibilities later. > > Signed-off-by: Arnd Bergmann I think updating to two __u32 values is the better solution here. While the driver is new in the mainline kernel it has been used for multiple years downstream in the Maemo/MeeGo/Mer communities and I would prefer to keep userspace compatibility. -- Sebastian > diff --git a/drivers/hsi/clients/cmt_speech.c b/drivers/hsi/clients/cmt_s= peech.c > index 4983529a9c6c..568dbc117f2e 100644 > --- a/drivers/hsi/clients/cmt_speech.c > +++ b/drivers/hsi/clients/cmt_speech.c > @@ -451,9 +451,7 @@ static void cs_hsi_read_on_control_complete(struct hs= i_msg *msg) > dev_dbg(&hi->cl->device, "Read on control: %08X\n", cmd); > cs_release_cmd(msg); > if (hi->flags & CS_FEAT_TSTAMP_RX_CTRL) { > - struct timespec *tstamp =3D > - &hi->mmap_cfg->tstamp_rx_ctrl; > - do_posix_clock_monotonic_gettime(tstamp); > + hi->mmap_cfg->tstamp_rx_ctrl =3D ktime_get_ns(); > } > spin_unlock(&hi->lock); > =20 > diff --git a/include/uapi/linux/hsi/cs-protocol.h b/include/uapi/linux/hs= i/cs-protocol.h > index 4957bba57cbe..fce633c7c649 100644 > --- a/include/uapi/linux/hsi/cs-protocol.h > +++ b/include/uapi/linux/hsi/cs-protocol.h > @@ -90,12 +90,12 @@ struct cs_mmap_config_block { > __u32 tx_offsets[CS_MAX_BUFFERS]; > __u32 rx_ptr; > __u32 rx_ptr_boundary; > - __u32 reserved3[2]; > + __u32 reserved3[3]; > /* > * if enabled with CS_FEAT_TSTAMP_RX_CTRL, monotonic > * timestamp taken when the last control command was received > */ > - struct timespec tstamp_rx_ctrl; > + __u64 tstamp_rx_ctrl; > }; > =20 > #define CS_IO_MAGIC 'C' --J/dobhs11T7y2rNN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJVJ9HHAAoJENju1/PIO/qaJsEQAIvpc0+ZgoxHf7Ab3wcHo+lX jxItnk5a++eUMgpHwOvRdAHC+GrXvm1JPq20UIhqGEAFGDvC8nyKKPVQZxTIHTky rly38AqyaLWRBSvBIaggFj9gK+KN7nU5lRjuMt5IX+kn4dXDSirlJ+bxmpr37iar FtWTEF1eGWlrwODCIvKDXFrxwtlhqBGUgBd5deoBPwN46nrHjIIAmdQJJkbGI7D2 ZR4D51tDFpdXthKnSrDSomxRBuy/krnJzMIaG1Y+d4vS7dlfRLc/H+7F/psbJLfK xn/2vHyCdYM8hMnweXTCc6OuQsomg36ZC9pi4eA/Iah9KxQnjrx/iuKvzvgIj5ao y7z4hlZDyVS99jL+oOq0iVT/ECJQbpHjJ70swR9kQUCqsTzQHZATY8EnSbsd2etb gYCrw0+pb+S2rMEJJfYk5TS5E7IBIpyGye+DN44xDLWLI8/Phn8JG3YFWGP+i5yN /yXDQivQzj4a+LqeLbNO8acYbsE/tNJA04Spr1u9E9tTjdg0BFKIb697cENjA4Eg EFf6ypHQRQcZaVZ3aUk/nk/Y29RXusFo/8/VFPd2PJ+JKMoD72jrgzndy15GoSmz sUM/hCAACqb1rDb72qeI9Y9HhkUcpMaEzFGPuaBLHxXGLqPBKQgOGBr2gt2uNxxS ijATKuHl9RzNppcMumSx =ymRt -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN--