From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 821CAC433DF for ; Tue, 13 Oct 2020 19:00:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FE5E208D5 for ; Tue, 13 Oct 2020 19:00:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mi0OVvzQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lvVK1TFw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FE5E208D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IbvKSRY5wXtgblKrgC0RqgWJh0MGruwfkdk/3MlM+Yc=; b=mi0OVvzQUZ5Gbk7NwKumKEhUE QaNwysRmBmziSuK/2fSdttpYeyzwTQ8LgnQNnjbX9AbKQOsoB6gUrUTicg4PSQckC+TLD9nZVIKqH rE5rd0C9wsTnD8gDne1T4tpjjVeRFDgJw0VLiCCI/qHOYgE3s42DcZsXXAqV5rfnxr0BPyKIyO71q GSCdQ3EbZPTgGACIZAY9wyDx1d0YglJ0nppDnQNV5yOPsOp5ilxnKfMqP+0G7Q9b9qX9Nx/N4XgUL hriDqLmFyN7iarEoZIaYpKRGtvOaN1HlALM3HM6Y4vC8CqjVul35EJJmrVdpFIo4BKsEgEdCI0YhR +fZI6kIIA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSPVm-0004I8-5f; Tue, 13 Oct 2020 18:59:02 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSPVj-0004HZ-KQ for linux-arm-kernel@lists.infradead.org; Tue, 13 Oct 2020 18:59:00 +0000 Received: by mail-qk1-x741.google.com with SMTP id a23so692107qkg.13 for ; Tue, 13 Oct 2020 11:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iyujXSr66H0LW5PmWT8T15/LcpIBTSbnFu/C1AlCOfc=; b=lvVK1TFwKfNxF9xc4iZvsVlMWxR8Ae1ozwz1kQ5q+CJA6Xovr0KfDAeWJlRkLtUc3t BsdUdShrBeXn71nnu70CBOV5V1GsNEwmipJIvP/J07pHPyEOYxev9xLCfOf1rXxZKltb SlLI2EMczm1fB2Z1pXoK1I/ey2VEL76TjNwCjUYuLmWJWV9ER/RSqp5Ph+S/FBvqjxrG gpdQtYGcFFLqiChAEPCkaBbOl/fUeo9lSSFVK2K7uCfNECJZjUP+cNAixm/UklURrORN XQ5nn7ULklwfzPxE3AiMdlR9iorZCwxXXvq1ai5Aw/Z83DXd376JDnNwddF2B2xDjcrx CgxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iyujXSr66H0LW5PmWT8T15/LcpIBTSbnFu/C1AlCOfc=; b=TZP0G7/5ATM7qph8fddX1YAveG23g1w011jk+7cFKgyJc9f+ncL0s2oVQApwDCGFGH l1RTL4uTKjRNGY+CxQFZjdHh8dzxd+C/5kLzYZbY/Q4eqfqvGZ4v4iGzB2ln9y68tCQH wBL7hlVCXY3iefQZK2sCRJZ31SXEKRCAViYuA6UCUvbbtuYmTZ0msej0oWCwsac6e3vy YD06jIZ4AMHxWF+SXT6W/3yLp1SusdLbfzt36r8RiXyFQ4zL6k7H0fa6OHBvnlW8wAZO 6ml3rhI4102GsX0/jjVXBh9OPPAH9Bnb/avTjei5ENp9Pm1QM1iF5V+/nznX+nVvyCRn yLwA== X-Gm-Message-State: AOAM531WYL1ltiRaELbbLK07oy+vRc8fy9lUlazUQnWgB8tNW/y28tiQ 0uKGS5eTYuSP57eJXOE4/+s= X-Google-Smtp-Source: ABdhPJy21mJYiy7EaIls91cnRuzM/Lzc2HQ3ui5v5MtOMTOQcn9pm1msGFmuwGrb8IVsLmZedddmjA== X-Received: by 2002:a37:8d82:: with SMTP id p124mr1436426qkd.371.1602615535426; Tue, 13 Oct 2020 11:58:55 -0700 (PDT) Received: from shinobu (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id k15sm336858qtk.64.2020.10.13.11.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 11:58:54 -0700 (PDT) Date: Tue, 13 Oct 2020 14:58:51 -0400 From: William Breathitt Gray To: David Lechner Subject: Re: [PATCH v5 4/5] docs: counter: Document character device interface Message-ID: <20201013185851.GB32722@shinobu> References: <54190f9875b81b6aa5483a7710b084053a44abb8.1601170670.git.vilhelm.gray@gmail.com> <20201008080909.GA31561@amd> <20201008122845.GA3314@shinobu> MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201013_145859_675211_C53D090C X-CRM114-Status: GOOD ( 24.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, gwendal@chromium.org, mcoquelin.stm32@gmail.com, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Pavel Machek , syednwaris@gmail.com, linux-stm32@st-md-mailman.stormreply.com, jic23@kernel.org, alexandre.torgue@st.com Content-Type: multipart/mixed; boundary="===============3933814113857955143==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3933814113857955143== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5/uDoXvLw7AC5HRs" Content-Disposition: inline --5/uDoXvLw7AC5HRs Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 12, 2020 at 12:04:10PM -0500, David Lechner wrote: > On 10/8/20 7:28 AM, William Breathitt Gray wrote: > > On Thu, Oct 08, 2020 at 10:09:09AM +0200, Pavel Machek wrote: > >> Hi! > >> > >>> + int main(void) > >>> + { > >>> + struct pollfd pfd =3D { .events =3D POLLIN }; > >>> + struct counter_event event_data[2]; > >>> + > >>> + pfd.fd =3D open("/dev/counter0", O_RDWR); > >>> + > >>> + ioctl(pfd.fd, COUNTER_SET_WATCH_IOCTL, watches); > >>> + ioctl(pfd.fd, COUNTER_SET_WATCH_IOCTL, watches + 1); > >>> + ioctl(pfd.fd, COUNTER_LOAD_WATCHES_IOCTL); > >>> + > >>> + for (;;) { > >>> + poll(&pfd, 1, -1); > >> > >> Why do poll, when you are doing blocking read? > >> > >>> + read(pfd.fd, event_data, sizeof(event_data)= ); > >> > >> Does your new chrdev always guarantee returning complete buffer? > >> > >> If so, should it behave like that? > >> > >> Best regards, > >> Pavel > >> --=20 > >> (english) http://www.livejournal.com/~pavelmachek > >> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horse= s/blog.html > >=20 > > I suppose you're right: a poll() should be redundant now with this > > version of the character device implementation because buffers will > > always return complete; so a blocking read() should achieve the same > > behavior that a poll() with read() would. > >=20 > > I'll give some more time for additional feedback to come in for this > > version of the patchset, and then likely remove support for poll() in > > the v6 submission. > >=20 > > William Breathitt Gray > >=20 >=20 > I hope that you mean that you will just remove it from the example > and not from the chardev. Otherwise it won't be possible to > integrate this with an event loop. Would you elaborate a bit further on this? My thought process is that because users must set the Counter Events they want to watch, and only those Counter Events show up in the character device node, a blocking read() would effectively behave the same as poll() with read(); if none of the Counter Events occur, the read() just blocks until one does, thus making the use of a poll() call redundant. William Breathitt Gray --5/uDoXvLw7AC5HRs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAl+F+OsACgkQhvpINdm7 VJJ1lg//TGZtaRf3xh7whlm0NHwwiJSzE2fLZr/QnuqTM2TtBfQz/Y0yV9tC4HW4 7OVcoyo3UwgjT93XmEaEJ13iTxYl0szn5s+5mBShLwlOB/4jHyXOLY+9EKdxhmWl O801nR0pZuaIXM8BkiVMRWIMF7N2LHioVn4b0iRCeUidF5hVX9aSV1tvLuib+eW7 X9i6o16OUQcaaiSJlWKJhFfW1MnVTuEa4+h3IqfQQFN4Aq4gr34s5sJWOYiqEuSJ NKSpA5Dl/MnTWEEVoTlvfdrBKKidHNGjNmagKfn9RRoh14b4s6PFTgR9/Pn1Xjjj 6e+odPB2i8AYiST6VCRdSYbDN0ExgS79aEDjW+jAdr7IzyYn9Ht7gkUnpBNO6WP4 QulAaXpuJbF9qUZx+iUK4ZRT5RJO9/d4HJLi96K5E38RAqdOX9OYXF0jikXFXTbG ZrQFtlpKZQXNqNEMKkKf0/OqLJcSEUSNIRW+132Dhfe08Z72kpf9du2ez7bxK1w9 W8EYp27aq9LVbd1SZ4Bdv5WaEy5sJ2dhT6EVFjtFpZHvQXZusKscorXvDegY1fq1 4nqmg54U/w3TEKiL+J9TJGHsFd1OnB5yfQt8jWEff/HU5866byKuyT8+PtaB+hUA VOHCJRXVah2sDh/js/6jgxQ8ZLW236o4SqHJDPlTeN0FfkDAAVg= =bg3S -----END PGP SIGNATURE----- --5/uDoXvLw7AC5HRs-- --===============3933814113857955143== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3933814113857955143==--