From owner-freebsd-arm@freebsd.org Fri Nov 27 11:09:54 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3ABA4A4BAF for ; Fri, 27 Nov 2020 11:09:54 +0000 (UTC) (envelope-from freebsd-rj@obsigna.com) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CjBjY4Jdlz4v6G for ; Fri, 27 Nov 2020 11:09:53 +0000 (UTC) (envelope-from freebsd-rj@obsigna.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1606475391; s=strato-dkim-0002; d=obsigna.com; h=References:To:Cc:In-Reply-To:Date:Subject:Message-Id:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=BWTjaQqdeJkmT7WUybdk/Evt5CflEliOAPlE6unkf9A=; b=XEFPc5FinUwEVuUbfTSocI31RdLk2zhL2k7DATSrP/w2XmBK82+ie5W0SGus6Z1Avz hvbcfWuFt0qd5S/fLZSHOYKgJ08h8YkzTcEsPm2WCj8z9bQXbn0AKzdRKhYv/HZ1/L8H QhwGIvpAvIUHYD2X04UIh7BxKHyLFBqrczir2Srvx6la9KYsfOduJvF/XU8pnndRAnCn pnOL20WJZJOAxTkBesDncRMFlDteaSXTShJYJA+OpkmKwoEXYN7GIFK7LsQU0ciFaiLh B5kIuneEdVr/8af3WApPWoNw3EEcKaCsHjr7/LslAKg4W82Q++qXFig49P7HH8k60mXH sYrQ== X-RZG-AUTH: ":O2kGeEG7b/pS1F2rRHW2isrKl4DV03XBEi+I6ZuztdvN9wS3wFGySS4Lw+ldTBio0dVbInGjc9RnD7rYRqs=" X-RZG-CLASS-ID: mo00 Received: from mail.obsigna.com by smtp.strato.de (RZmta 47.3.3 DYNA|AUTH) with ESMTPSA id U0af7bwARB9fPP0 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 27 Nov 2020 12:09:41 +0100 (CET) Received: from rolf-mini.obsigna.com (rolf-mini.obsigna.com [192.168.222.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.obsigna.com (Postfix) with ESMTPSA id 595651350F91D; Fri, 27 Nov 2020 08:09:39 -0300 (-03) From: "Dr. Rolf Jansen" Message-Id: <8655AF30-273B-48E7-98CD-007AA1D265F5@obsigna.com> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) Subject: Re: User Space GPIO Interrupt programming - GSoC-2018 Date: Fri, 27 Nov 2020 08:09:38 -0300 In-Reply-To: <8d806302-479c-ca34-3fdb-96d27f40e212@viruzzz.org> Cc: freebsd-arm@freebsd.org To: Vladimir Goncharov References: <2B01780F-D367-48A3-A827-B479030A496D@obsigna.com> <8d806302-479c-ca34-3fdb-96d27f40e212@viruzzz.org> X-Mailer: Apple Mail (2.3445.104.15) X-Rspamd-Queue-Id: 4CjBjY4Jdlz4v6G X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=obsigna.com header.s=strato-dkim-0002 header.b=XEFPc5Fi; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-rj@obsigna.com designates 85.215.255.22 as permitted sender) smtp.mailfrom=freebsd-rj@obsigna.com X-Spamd-Result: default: False [-1.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:85.215.255.0/24:c]; MV_CASE(0.50)[]; RWL_MAILSPIKE_GOOD(0.00)[85.215.255.22:from]; URI_COUNT_ODD(1.00)[7]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[obsigna.com:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[85.215.255.22:from]; ASN(0.00)[asn:6724, ipnet:85.215.255.0/24, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[obsigna.com:s=strato-dkim-0002]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[obsigna.com]; SPAMHAUS_ZRD(0.00)[85.215.255.22:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[85.215.255.22:from]; FROM_NAME_HAS_TITLE(1.00)[dr]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-arm] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2020 11:09:54 -0000 Hello Vladimir, yes please, I am interested. Please can show us your version of the = GSoC-2018 diff file? Best regards Rolf > Am 27.11.2020 um 05:02 schrieb Vladimir Goncharov = : >=20 > Hello Rolf, >=20 > I have implemented in kernel queue for generated GPIO interrupts with > timestamps, so now it's possible to catch all events even on busy > system. It's all for gpio_gsoc2018 code. In result I have no more > warnings in dmesg. Unfortunately it requires allocating memory on each > event to store pin number and timestamp. In case of unability = allocating > memory it falls back to gpio_gsoc2018 method. > Does anybody interested in such patches? >=20 >=20 > 2020-11-27 04:18, Dr. Rolf Jansen =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >>> Am 26.11.2020 um 16:56 schrieb Ian Lepore : >>>=20 >>> On Tue, 2020-11-24 at 17:14 -0300, Dr. Rolf Jansen wrote: >>>> Hello >>>>=20 >>>> Has anything of the GSoC-2018 efforts made it into the current code >>>> base? >>>>=20 >>>>=20 >>> = https://wiki.freebsd.org/SummerOfCode2018Projects/UserSpaceGPIOinterrupts >>>>=20 >>>> I installed the recent 13.0-CURRENT snapshot (2020-11-19) on a >>>> BeagleBone Black which was one of the implementation targets of = said >>>> project, but when running the test tools, I either see cannot >>>> read/kevent/poll/aio_read - Operation not supported by device or >>>> Inappropriate ioctl for device. >>>>=20 >>>> Perhaps I need to pull the project=C2=B4s changes into the kernel = by >>>> myself. However, before this I would like to ask whether it is = worth >>>> the effort. >>>>=20 >>>> Please, can anyone shed some light on this. >>>>=20 >>>> Best regards >>>>=20 >>>> Rolf >>>>=20 >>>=20 >>> I made some time this morning to review the gsoc2018 code. It turns >>> out this code is very high quality, nearly ready to commit as-is. = The >>> main thing it needs is some style cleanup in its comment blocks, and >>> documentation. I'd be inclined to commit the code first and write = the >>> documentation over the next little while and commit it separately. >>>=20 >>> If you'd like to give it a try, here's a diff that should apply and >>> build cleanly on freebsd 12 or 13: >>>=20 >>> https://people.freebsd.org/~ian/gpio_gsoc2018.diff >>>=20 >>> While there isn't any documentation yet, there is a test program (I >>> haven't run it yet) that demonstrates all the features: >>>=20 >>> = https://github.com/ckraemer/gsoc2018-utils/blob/master/src/gpioc_intr_test= .c >>>=20 >>> Right now the code will let you block waiting for a pin-change event >>> using select(), poll() or kevents, or to be notified via SIGIO, but >>> after being notified that something happened, you still have to call >>> read() to see which pin changed. I think if the pin changes state >>> multiple times between calls to read(), you'll lose track of some >>> changes (I'm not positive of that, I don't understand the kevent = stuff >>> well). >>>=20 >>> I'd like to add some features so that you can configure it to track = pin >>> changes in counting-mode and timestamping-mode. In counting mode, = when >>> you do a read() you would get back a pair of values, the pin number = and >>> how many times its interrupt fired since the last read. In >>> timestamping mode, every read would return a pin number and an >>> associated timespec giving the exact time the interrupt happened = (there >>> would need to be a way to configure how many events it could buffer, >>> but I think even allowing a thousand buffered events would only use = a >>> few kbytes of memory). >>=20 >> I got it working as well, please see my other post from yesterday. I = used gpioc_intr_test.c. >>=20 >> I see hundreds of warning messages when I press the test button a few = times. May these warnings be safely ignored. The kernel module of Oskar = Holmund works quite nice as well (for what I need), and with that one, I = don=E2=80=99t see warnings. >>=20 >> The counting- and timestamping-mode for sure would be very useful. = Perhaps by implementing this, there won=E2=80=99t be no unhandled = interrupts anymore, and hence there won=E2=80=99t be any warnings = either. >>=20 >> Best regards >>=20 >> Rolf >>=20 >>=20 > _______________________________________________ > freebsd-arm@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" Dr. Rolf Jansen - - Rua Reginaldo de Lima, 98 Parque S=C3=A3o Diogo 09732-550, S=C3=A3o Bernardo do Campo S=C3=A3o Paulo - Brazil Phone: 0055-11/4317-0974 Mobile: 0055-11/9 8141-1465 E-Mail: rj@obsigna.com BLog: obsigna.com