Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3759936pxk; Tue, 22 Sep 2020 01:35:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxClReAYO5cDbt9MR+fWjm7K16XTtsDpWrT0WuE+z4B2oojoF87oSFhNglXijBT6HYxHVzT X-Received: by 2002:a17:907:2173:: with SMTP id rl19mr3628978ejb.514.1600763743170; Tue, 22 Sep 2020 01:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600763743; cv=none; d=google.com; s=arc-20160816; b=LTbcJDxV7qn9NeFy4bd4VvP9IiNoezwAy8O62jIL+j2O1WBTYP4gpgwBWJwm40l2FV qVPMPcAbumUua5lUYBMXUOg7SmgkWbn+BKEmxBUoYJLB0OoR0XM6otUF3fzsx832Fyfe tlQeGKohyfgomvW3RfrKbN5MsjB8ycSUVuy299UVEGZ1HKEzbg0OMoeLiXIItyomScGE oPZvLjfaPofuDifpb1Y/RziOhI0qX29DIK3Tu5QOKkR6DC7MBn/LROcMucr1debusgz3 VXXYs92/DAO2kFJwrDPr6MmH+opW7kqmcAIa+tWBhZ8z2VFw2qOTUNfeXLT+a8qS0dc9 WF1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=/MEkpzYPeuOXsoktGLddSr8KsCiA2y83M3TNcrOhnoE=; b=xcchSvrbVCG+JKyd7K8z/isS/tJt4/AFy6Wgo87OoWyF2q+mMqS+yzayNvBzmVNmbn VFAqZmlBBqbK3DmJ8Btn3YE33SrOGb523Fgt/67VuTDZr/zEbbKqkusa3hHUTEoyPCWb 22XyXMmtAbb23a4WhXRL4p1zvDiKJ5bj7UmL4+4UUtRrBJSfpLCJPijM0TLUWJ3Zsp4N RSM7q9qZ160y/wfmx4G/uqehqQYMN7yoDoyRyFyWhLIDTxxuXMJn730SHf0bJ1CBCyA3 O5ulUaSCYFHWUJXUO2mFP9gA06H+d4g9SoqEvFDaiB7GQzGBmUy9ydHbUNHgTbMnv1Ew jZCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si10015971eju.295.2020.09.22.01.35.19; Tue, 22 Sep 2020 01:35:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730040AbgIVHld (ORCPT + 99 others); Tue, 22 Sep 2020 03:41:33 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:33989 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729751AbgIVHld (ORCPT ); Tue, 22 Sep 2020 03:41:33 -0400 Received: from mail-qk1-f169.google.com ([209.85.222.169]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MEVFi-1kEY770C0A-00FxzM; Tue, 22 Sep 2020 09:41:31 +0200 Received: by mail-qk1-f169.google.com with SMTP id d20so18163177qka.5; Tue, 22 Sep 2020 00:41:30 -0700 (PDT) X-Gm-Message-State: AOAM530EfDl0mq76ecxKNVmlWDH+nLLJ5NYYKtnTxig3UJesG/GFuVrC j+o+YsnLQhf4VbgYBWPPR0rpYgjF76LEEbGtVgI= X-Received: by 2002:a05:620a:15a7:: with SMTP id f7mr3368890qkk.3.1600760489821; Tue, 22 Sep 2020 00:41:29 -0700 (PDT) MIME-Version: 1.0 References: <20200922023151.387447-1-warthog618@gmail.com> <20200922023151.387447-5-warthog618@gmail.com> In-Reply-To: <20200922023151.387447-5-warthog618@gmail.com> From: Arnd Bergmann Date: Tue, 22 Sep 2020 09:41:13 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 04/20] gpio: uapi: define uAPI v2 To: Kent Gibson Cc: "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski , Linus Walleij , Andy Shevchenko Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:MgJul94/STlqBONRR9G7hUEh7dJFOZ9YRjtbMyIgDeedXYjKSWf nbl2rD9b4VeYHalvWj+DjTcbjTwqnNtgCGtPcbhbzgYhKQfkPl3wcGSuLWr/3TFCjFHh3Hb ao/qOsbQvOEx2TKR+tzW40qHslRiL/kK75vP6bAUaGZmw97CU/2Mohm6MTFxkRCzDjPSt3v lBoaxYHaQbczC+h9F6R+A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:eWmhPfKqk8c=:IP0PGelGYrFnOg56Z1gXwh 8f5vuMn3qLK4FRpyj3A34YNunWVqTTn3b8/vfdteV9+FBCKyzyx5WEtq6Lj365XTj6V0Oo6Tl Z1honnEDhDjV8DOwf7NvQECZbiMqgMdtmSUTJphT+NdM3h81AcoNNtKebknbcn6jqGdDbQS2X b1Rc1JbO78OCZkjlofF1FYEI/lVGRBPwGPax7vr0dUeWsXf/ffYvwqdv4kudusdNJUhdFzZqo NrkuRtMSwTuv6YrJV7ltc7fn/t9aSZ0AN1gSd3hLMYVCI7wheklWfW/hCZOrNpLLFc9jcabnl 5Xb5qdwAY/ThQDIJwwo3fI65yoPFxx1UmvGFmOVWJioNRmlqW2fUUttC2Hd2uba8O0l4Hzh7y hEAjJsSJsMi5jndCZuqCUWa4gcb+4uLzSp2mDt7Tntqri/X1ordr433wL85/kjvVJytn16DeM Lj0Ag5WRTLfdOrsCoIoo2PZDETFl2ovwJQCyoSBae+wVYawt8toOoPkaWgt2kmx5d5Ob4Nbdw Sh7focFwlG4V6IzjgJjG0eRc6jrWZJdqZl093XQSU6VZ6fB0C2ik5cgacMhYT18vGkDOTZhR/ O2Df8bxJcaI5RDEFHN+Eix+F5OrXdhbQacgzapE+qEdJvWO9cPyDmuVkEaoskvBzCZN186Rpd VNaUBRYWYpAzaa99DE4skHfTe0MeQh65QuQ47fGXK0wtrUOt0Cg8w/9EY6GrGQ7krG9MtLCSh DoQulKdrN6iTumNjrgVArcSVgNZv0yi+aTqXC6uEGVCtQEGx1bdiOBtoUNh/tab814BjE3pVh a2V7oXFSC4msa9hZ/x/As4WzN+k3AUCDy8WSFpoKl28vpcz0OSbczw1DJETUtbFStoDd09FRx pkMaxQwcs0K2SnbSJI581IxYEx4wxLKggJ0UGqsAZTcc56ydE6iM/z1xj3q/Zk7uljCzAhyQK n/jtBq0NA8RGHqto/JS392yO+0s5BXJupi6mbaIPeCTd4yHn/xc9d Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2020 at 4:34 AM Kent Gibson wrote: > +/** > + * struct gpio_v2_line_attribute - a configurable attribute of a line > + * @id: attribute identifier with value from &enum gpio_v2_line_attr_id > + * @padding: reserved for future use and must be zero filled > + * @flags: if id is GPIO_V2_LINE_ATTR_ID_FLAGS, the flags for the GPIO > + * line, with values from enum gpio_v2_line_flag, such as > + * GPIO_V2_LINE_FLAG_ACTIVE_LOW, GPIO_V2_LINE_FLAG_OUTPUT etc, OR:ed > + * together. This overrides the default flags contained in the &struct > + * gpio_v2_line_config for the associated line. > + * @values: if id is GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES, a bitmap > + * containing the values to which the lines will be set, with each bit > + * number corresponding to the index into &struct > + * gpio_v2_line_request.offsets. > + * @debounce_period_us: if id is GPIO_V2_LINE_ATTR_ID_DEBOUNCE, the desired > + * debounce period, in microseconds > + */ > +struct gpio_v2_line_attribute { > + __u32 id; > + __u32 padding; > + union { > + __aligned_u64 flags; > + __aligned_u64 values; > + __u32 debounce_period_us; > + }; > +}; Having different-sized members in the union makes it hard for something like strace to print the contents. How about just making them all __aligned_u64 even when 32 bits are sufficient? > +struct gpio_v2_line_request { > + __u32 offsets[GPIO_V2_LINES_MAX]; > + char consumer[GPIO_MAX_NAME_SIZE]; > + struct gpio_v2_line_config config; > + __u32 num_lines; > + __u32 event_buffer_size; > + /* Pad to fill implicit padding and reserve space for future use. */ > + __u32 padding[5]; > + __s32 fd; > +}; > +struct gpio_v2_line_info { > + char name[GPIO_MAX_NAME_SIZE]; > + char consumer[GPIO_MAX_NAME_SIZE]; > + __u32 offset; > + __u32 num_attrs; > + __aligned_u64 flags; > + struct gpio_v2_line_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX]; > + /* Space reserved for future use. */ > + __u32 padding[4]; > +}; These are both several hundred bytes long, requiring a lot of data to be copied to the stack and take up space there. I see this is not actually much different for the v1 API, but I wonder if there has been any analysis of whether this has a noticeable effect on application runtime. Arnd