Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1463773ybl; Thu, 5 Dec 2019 01:43:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxu6cBWlxy69QNjJjIFgSd/VgC92DwsVVrec/7TRmFjRaSfnuCD7ZUiFhMQgbJUlRfPlMqi X-Received: by 2002:a9d:6216:: with SMTP id g22mr4344034otj.260.1575538988029; Thu, 05 Dec 2019 01:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575538988; cv=none; d=google.com; s=arc-20160816; b=om2Mnii5lRo8Gfcw/BArkTiG4Ao5GzS/r4/nteCG9N3kTTJojaVLU/B9utJ5OZuS5l M6ITMq7Hl9qorH9QGf+jqlLs+gtCuhFMTYrNCO/Pq61oQFCMiLX7UAWzziJAb+DHeqYa HRcehwnJz49+PrcEEKaTjk5Vul7VZPrvYrUZcLt99GutmnRZfnMflN1W1YpA2LLENMxp 0d8Dtmmq6rRv5atZXcg0APRDDwbU7sq2sPK6fG59/Vlr2cBwBBb++cbfolamACyGEMi+ iGtR936QpA3L3odpefbxfLbCHAOkcvYIFViQkVCWgMBD7jfqgVeL23wbQtfP+dGnFvi+ OyLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=M16yxDpYn9UDJVCbvQS7s+4Ht1K+4/sjQn4ed+gQl2Y=; b=1KXnS9ooOJRb1hZkrREDXlW4+IgNnL/aIoXBgTRmjxoqeKDpBaWFKYVIKlFuJazarr 2M39dMERcIfCkR5lLitoq8XCOaZ+Fty+gLmuNY1jsOrJbMI+p3M9G3SFU64AdtSGO0Ip MXiFOf3xJCTf7r89lOzYPeBmeJjabQhtFlNSHBSX3jwGEHMB0Ri9w1leCocVMvV+3kSa vMzWXLfHO/okaMAPbL3g9tzeC56yUyMkDjHudT4ESOVCKLC3G7diSD1XtSgVWdBA8NZF oVVAYEQgJPryOjspfL0dfOBO9CgvaRl3EshRtu8IxDus2b/EjjTnLDcE7cFM1C7k2JLt tRPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="rhn/I2qa"; 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 w23si4696635oti.39.2019.12.05.01.42.55; Thu, 05 Dec 2019 01:43:08 -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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="rhn/I2qa"; 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 S1729024AbfLEJm0 (ORCPT + 99 others); Thu, 5 Dec 2019 04:42:26 -0500 Received: from mail-oi1-f195.google.com ([209.85.167.195]:40199 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728707AbfLEJm0 (ORCPT ); Thu, 5 Dec 2019 04:42:26 -0500 Received: by mail-oi1-f195.google.com with SMTP id 6so2143792oix.7 for ; Thu, 05 Dec 2019 01:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=M16yxDpYn9UDJVCbvQS7s+4Ht1K+4/sjQn4ed+gQl2Y=; b=rhn/I2qa1MOMrpA2jbedpqL1tIIkOjS6IZsW9SCXqYXSIXfSxK2fCzNv4LJZbQOPit vzJk9FfH+ckrPw0lH80ugedcjaYpw3ZYIY5d7izcmyx5kKGDCYUIa5gU5NncXs9JDn8e +6J1ULTl8FvvSnlt5CQxoRq50E9UjLlNPlBztpHXoVBpGH8Ckmow3zzwDoX9urNCUoSu ftfE4f7+x9OnEf3UJ5nm1NqBzx4SS/OL5KDIjEHwROKAsI22nWu1st8MIodz/JlFpk5T V6OUFIi9NhnCzMsZNdGJJJ/ksfA/WU53cYOVMYla7qehd7gnEQIhoTJPXRvuqVPQvgLs sZ3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=M16yxDpYn9UDJVCbvQS7s+4Ht1K+4/sjQn4ed+gQl2Y=; b=Weo7Tr7hTB3NQeRpyt/I9OZmUBbpxQLSA/y/i+2U8VgrQ4xwjdMUvpoUoLvgwYQ2yi U5XO4AlOzB0oHZ3lw2hlsoSjTSF2n9+kcTdCWM2tk8cJl9oWMOHxlrE43F5kU1j/X05w lxj0W6a/IURgAvME9Y1E66e4BoIU60bEdCbvVD8Z9Kn1zgjCavZJyNSzEdiskITrwfOm ouXQ6hKLRkcmI6PV9kcd+Cz7gn8+Y3t3ue2OUBMaN8BqDQA5nd+9qYm8cHoXX1etH88B DNaSneNCZu3iqowmMnI/UBF6xFik7yWJMivUvnxg2lFLlGAGGno7Rp30WxHWxUgcRL6v wqNQ== X-Gm-Message-State: APjAAAUn0Jcc5+0ShQUXl3943UQOqhnWAinBV1ETzN8UY5miRdtu5ft9 AGWzATzpIHVHvGOOCF7BR/HQYHgSalI/m9D1vhQaFA== X-Received: by 2002:aca:3182:: with SMTP id x124mr6518859oix.170.1575538944954; Thu, 05 Dec 2019 01:42:24 -0800 (PST) MIME-Version: 1.0 References: <20191204155941.17814-1-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Thu, 5 Dec 2019 10:42:14 +0100 Message-ID: Subject: Re: [PATCH v2 10/11] gpiolib: add new ioctl() for monitoring changes in line info To: Andy Shevchenko Cc: Bartosz Golaszewski , Kent Gibson , Linus Walleij , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org =C5=9Br., 4 gru 2019 o 23:34 Andy Shevchenko na= pisa=C5=82(a): > > On Wed, Dec 4, 2019 at 6:03 PM Bartosz Golaszewski wrote: > > > > From: Bartosz Golaszewski > > > > Currently there is no way for user-space to be informed about changes > > in status of GPIO lines e.g. when someone else requests the line or its > > config changes. We can only periodically re-read the line-info. This > > is fine for simple one-off user-space tools, but any daemon that provid= es > > a centralized access to GPIO chips would benefit hugely from an event > > driven line info synchronization. > > > > This patch adds a new ioctl() that allows user-space processes to reuse > > the file descriptor associated with the character device for watching > > any changes in line properties. Every such event contains the updated > > line information. > > > > Currently the events are generated on three types of status changes: wh= en > > a line is requested, when it's released and when its config is changed. > > The first two are self-explanatory. For the third one: this will only > > happen when another user-space process calls the new SET_CONFIG ioctl() > > as any changes that can happen from within the kernel (i.e. > > set_transitory() or set_debounce()) are of no interest to user-space. > > > +/** > > + * struct gpioline_info_changed - Information about a change in status > > + * of a GPIO line > > + * @timestamp: estimate of time of status change occurrence, in nanose= conds > > + * @event_type: one of GPIOLINE_CHANGED_REQUESTED, GPIOLINE_CHANGED_RE= LEASED > > + * and GPIOLINE_CHANGED_CONFIG > > + * @info: updated line information > > + */ > > +struct gpioline_info_changed { > > + __u64 timestamp; > > + __u32 event_type; > > + struct gpioline_info info; > > + __u32 padding[4]; /* for future use */ > > +}; > > Has this been tested against 64-bit kernel / 32-bit userspace case? > No. Since this is a new thing - do you think it's possible to simply arrange the fields or add padding such that the problem doesn't even appear in the first place? Bart