Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2196521imu; Tue, 6 Nov 2018 10:29:35 -0800 (PST) X-Google-Smtp-Source: AJdET5f5z1R00RGax/aKr98LRn2H5cQvqtBhRGcYG3kxUADQOFuuvfEAndibSNi51CGFHT03s85n X-Received: by 2002:a63:aa48:: with SMTP id x8-v6mr24203572pgo.87.1541528975742; Tue, 06 Nov 2018 10:29:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541528975; cv=none; d=google.com; s=arc-20160816; b=MYyjRvmIo6zZojRbGqqnFsI2h/SNYQWnt2Dq8JbPteyP0oPYOFIHEAgAuqQyw7JBol gk5QWd6kuPmHYIwrOxyvdJftL/FLdoZpNFT47hsc+UG5CTExD4yr4DG7CAfmUexjJHeJ dmO42FO6JF89R7ovbYvfZ12AiIDd2S5I9yiRQsXQ+vTWSGKEQlp+cXyvnRMHCLUrDcF6 sS3yHWPuJ9mb2ooGUCS4ysrE6iEnOzcG2SYL2fzH860pWmaB9xBv+yqUBZhoMyYrA9G7 HwD12ZStD8zCX2c3UFavZHquEysHe84ES4OImSYEgCqST97KNzC/gm1OXjqDAnugVo2M +3wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=XCoyKV9h4dfBApMljkhqb2DEK2yMB8T5aVpJejWYcvg=; b=Gmhw1ahifPvdtxiczpQ9+LwRB64uYR2zRy09EAKM59dvCFpTnBSSVK/Xhgnllq+cG9 gL2MjRbuM1jCvYnPYOXVO4tnpUlKPhz9eYAhKba5RE8fQlXcF7vf7yKWFjoKSn0U7Q76 u3+sMYJHit+0aKHJMHSDxDiVMkee50FRAavSf+X6qaxKcUBFRzLno1QnX150TW0KtThZ K6kkD8UZ0+XF3j/LQezeEfZlYQp/VNtlp6CMWG4LNA881Ndr8ee/d6TnKiCYDjhqNMkL 2eTiGcKqlIfs/0+Bizdim/qIvG3iHZciR6O04CCiePmf4KBXEZi6iOgXL2wQPT4Vh6zf 8+qA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2-v6si47919866plz.427.2018.11.06.10.29.19; Tue, 06 Nov 2018 10:29:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388467AbeKGDyt (ORCPT + 99 others); Tue, 6 Nov 2018 22:54:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:33054 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729711AbeKGDyt (ORCPT ); Tue, 6 Nov 2018 22:54:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 42930AB64; Tue, 6 Nov 2018 18:28:16 +0000 (UTC) Message-ID: Subject: Re: [PATCH RFC 09/18] staging: vchiq_core: do not initialize semaphores twice From: Nicolas Saenz Julienne To: Stefan Wahren Cc: linux-rpi-kernel@lists.infradead.org, eric@anholt.net, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, dave.stevenson@raspberrypi.org Date: Tue, 06 Nov 2018 19:28:14 +0100 In-Reply-To: <9366d835-a291-2770-4409-b88ea1a155e2@i2se.com> References: <20181026134813.7775-1-nsaenzjulienne@suse.de> <20181026134813.7775-10-nsaenzjulienne@suse.de> <1781917429.4071.1540759539282@email.ionos.de> <9366d835-a291-2770-4409-b88ea1a155e2@i2se.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-WqekaYXIPv/ojeE/YGns" User-Agent: Evolution 3.30.1 Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-WqekaYXIPv/ojeE/YGns Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2018-11-06 at 17:06 +0100, Stefan Wahren wrote: > Am 06.11.18 um 16:41 schrieb Nicolas Saenz Julienne: > > Hi Stefan, > > thanks for spending the time reviewing the code. I took note of the > > rest of comments. > >=20 > > On Sun, 2018-10-28 at 21:45 +0100, Stefan Wahren wrote: > > > Hi Nicolas, > > >=20 > > > > Nicolas Saenz Julienne hat am 26. > > > > Oktober > > > > 2018 um 15:48 geschrieben: > > > >=20 > > > >=20 > > > > vchiq_init_state() initialises a series of semaphores to then > > > > call > > > > remote_event_create() on the same semaphores, which initializes > > > > them > > > > again. > > > i would prefer to have all init stuff at one place in > > > vchiq_init_state() and drop this ugliness from > > > remote_event_create() > > > instead. Is this possible? > > As I'm sure you're aware of, REMOTE_EVENT_T is shared between the > > CPU > > and VC4, which can't be expanded. And since storing a pointer is > > out of > > question because of arm64, I can only think of storing an index to > > an > > array of completions in the shared structure instead of the pointer > > magic implemented right now. It would be a little more explicit. > > Then > > we could completely decouple both initializations. I'm not sure if > > it's > > similar to what you had in mind.=20 >=20 > I don't think so, this was my intention: >=20 > static inline void > remote_event_create(VCHIQ_STATE_T *state, REMOTE_EVENT_T *event) > { > event->armed =3D 0; > /* Don't clear the 'fired' flag because it may already have been > set > ** by the other side. */ > - sema_init((struct semaphore *)((char *)state + event->event), > 0); > } Fair enough, even simpler. >=20 >=20 > > On a semi-related topic, I'm curious to know why these shared > > structures aren't set with the "__packed" preprocessor macro. Any > > ideas? As fas as I've been told, in general, the compiler may > > reorder > > or add unexpected padding to any structure. Which would be very bad > > in > > this case. >=20 > This would be better, but i assume the firmware side uses the same > source code. So using __packed only on ARM side could also break :-( True. Yet in that case, aren't we still relying on the fact that both compilers are going to behave the same way? =20 >=20 > > Regards, > > Nicolas --=-WqekaYXIPv/ojeE/YGns Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAlvh3T4ACgkQlfZmHno8 x/63zwf8CvW316YEQjlQeaiyn8pznuqFdHXIqmca9QjngCSoAvFzeRXs50PIHuXP IuXP6v7fqvT+I12rtbGa25rW/3IYH0sIbYG0Voqf7w5K33NTzNDFZVB34zy2g1YT Qv9z5xJYYg0fVc1tlIVyGZCr3UsXzkKPUFeMZK4oz0XFs25s9er3TqqSN091kag3 BKhSspiBOBm2CS8VE0ZeRm5i6QtBkcwWH77bR7SecQbqnFyAlrztqzudmqK2eWah ySZQOwR9qlghGw32ds5UBoSuwMUIfH4TEgUwKAwt1mmA8k2xrgmJYQOFFd5tquwM DCo+mihFFD3nHzpyi/POHhdpit++Aw== =cZwc -----END PGP SIGNATURE----- --=-WqekaYXIPv/ojeE/YGns--