Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2688852imu; Mon, 17 Dec 2018 06:19:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/UoJ+c2OiEnFPcV5FDQnZLW2hR6SYyJWYd8M55+7VDZP4r0A4oYiIXtUKFg3NN+MMpjHbD1 X-Received: by 2002:a17:902:2ac3:: with SMTP id j61mr12843223plb.185.1545056342047; Mon, 17 Dec 2018 06:19:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545056342; cv=none; d=google.com; s=arc-20160816; b=OAMSuoEsysSfZ7EI0udHOvH/gExcc7MFZxO/8iT3CXPI10BpOWI+xuITvxJTS0n65N qky8R3/yNe0FXXMnvB/VLq0RcB0qJugsbK7NxqImgyP1FhayHplHCjfmDu4RDUfByXHK Yj55bohnmYtLtngrxLwkuijAZr8kAHnGDAhFzkmdcOZbKTjFTOUyr+lHvZ0NgwHJLy/T 3VBcrD0H8Gecl/L+CLHZ/naX/dMFmWNXO0Et1Ys+Uz13zUBDtmrgxycz14uIbZCERIiY 7eqiPXobIzrDvVP5REymCB7CLlVkbKHf+P1oV+jioSVoPaJUVnkKe0Yx0upf6i+xvU3D 108Q== 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=/OMAstYOXq9/mHifG0nh1DT9G42qKuoQsAC7vNZo/JE=; b=lfkGeNuh5wKeEyAw6WjBPyxOlnF/nXsvoLHiaUm8XfDfXvWtT+9TW+pqC+yhAN9TaU 5fjXHu8lEVdu0r/T7+ceMXme25AjNhC6Z1xGfz80kLG70SS46oPCDmvHhYHp9EA/rlZc jqK2dADa/Lnz4jIholGCsTyyRFQ/1vTG0cBePX8LZWB24IF527laUTeFfkxqhlYoAylZ xqUHp1VgjXDbU/5+2yGPK2ruG+AyYEmmBWRY/I7zwS8t5hmTppSp2b/y4B0UPDHe6cu/ 5H5/r7uzIXgPs9a+iR80tWVzPqV0/iWV8+wnfNnkna74Sqm6mafoSk9OpXB3mYW6V8mO MpeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Y8u9JrjN; 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 e11si8993860pls.71.2018.12.17.06.18.47; Mon, 17 Dec 2018 06:19:02 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Y8u9JrjN; 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 S1732267AbeLQN7e (ORCPT + 99 others); Mon, 17 Dec 2018 08:59:34 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:40034 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732181AbeLQN7e (ORCPT ); Mon, 17 Dec 2018 08:59:34 -0500 Received: by mail-it1-f196.google.com with SMTP id h193so20005294ita.5 for ; Mon, 17 Dec 2018 05:59:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=/OMAstYOXq9/mHifG0nh1DT9G42qKuoQsAC7vNZo/JE=; b=Y8u9JrjNpaHlFdYZl49GdMNoFN464lFX7WXP0HR2oyycMsmX2zPnDo9tcAPcezI3lR FEXs1c+ZSvd/0wVmXGrTEZCs9354Stcw7kUH77UWC4vmMviKhIbsvajL8j7dd4q41Xz6 4nQaQe5ADONqLgNbU7gHKcS2EmQh6iR1T7pFQJJ41/ydRh7B4x+9kXHPR4TuOSZIUlKu oS35CzhHtdDjXuprVydgeK8dP9f8hBb4U9Er76PQ2hFu7e0Q3ImX4OrKb9ehu7sMMv7h MsRxOHBMN5pNA2jcSwMewhBFYCoRKFJ4dSYaE46fl77My62wd8dRuchTML3OujYlcr4/ axPg== 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=/OMAstYOXq9/mHifG0nh1DT9G42qKuoQsAC7vNZo/JE=; b=mujz7rBij8+nkbBmrszr75/d6RTsBsPgGJzO6LSOd/lxun6CLXitYXPlcxRkCilfWL CeibRqbybp07hetldQhqxhl/c8jHHhgK2gE0QH8ozBuS2zscW8DZvCsJPEZ7b3keum7o gT0hyYkf2iki8S0MlRSCVJRG0LE8o2mdem8fXt0OshVygYk+N/dJ58CBpUNLhh+/gaZQ RFpG4F71G1/7jwLay8al61aMtSledzth69V0KCJhL53FuDiQFelaR11Y7shy41kD0Khl tXMLE/b20qlLHcklxRhttfXNaVIJ5Mwrjp0pwb+CHgXVrRUIkDVBvX5E10IQqaom+MR8 F+IA== X-Gm-Message-State: AA+aEWarUcXEaZsxTCFoTq2+VbCgvT0gSo/AWXZAA3eHWTF5KyEJz2uL KXiFTY59rQ/qCajeHmGfxFjjiclj/BX25PK5BXxWdg== X-Received: by 2002:a02:98bb:: with SMTP id q56mr11975513jaj.24.1545055172592; Mon, 17 Dec 2018 05:59:32 -0800 (PST) MIME-Version: 1.0 References: <20181202215613.jcfrxwl4taiqgsql@pengutronix.de> <20181203104923.gcb2bcsaoczjcjhk@pengutronix.de> <20181203110654.53o3prw3qu3u2uyf@pengutronix.de> <20181217125905.fwbmipvmx4kahlge@pengutronix.de> In-Reply-To: <20181217125905.fwbmipvmx4kahlge@pengutronix.de> From: Bartosz Golaszewski Date: Mon, 17 Dec 2018 14:59:21 +0100 Message-ID: Subject: Re: [PATCH 1/2] irq/irq_sim: provide irq_sim_fire_edge() To: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Cc: Marc Zyngier , Linus Walleij , Thomas Gleixner , LKML , linux-gpio , Bartosz Golaszewski 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 pon., 17 gru 2018 o 13:59 Uwe Kleine-K=C3=B6nig napisa=C5=82(a): > > On Mon, Dec 17, 2018 at 11:32:45AM +0100, Bartosz Golaszewski wrote: > > =C5=9Br., 5 gru 2018 o 13:38 Bartosz Golaszewski > > napisa=C5=82(a): > > > > > > =C5=9Br., 5 gru 2018 o 13:20 Linus Walleij = napisa=C5=82(a): > > > > > > > > On Mon, Dec 3, 2018 at 12:06 PM Uwe Kleine-K=C3=B6nig > > > > wrote: > > > > > On Mon, Dec 03, 2018 at 11:57:26AM +0100, Bartosz Golaszewski wro= te: > > > > > > > > > > It used to live in the gpio-mockup driver and I generalized it > > > > > > precisely because there was another driver - iio evgen - which = was > > > > > > doing basically the same thing. While I don't know if there'll = be more > > > > > > users (I'd guess it would be useful for testing purposes of oth= er > > > > > > subsystems) having the same functionality implemented once is b= etter > > > > > > than twice. > > > > > > > > > > The iio testing driver only needs the trigger and relies on an ir= q that > > > > > then calls the registerd handler. The iio driver doesn't need to = tune > > > > > the edge sensitivity though and if your mockup driver just only c= alls > > > > > the fire routine if the configured sensitivity justifies that, > > > > > everything should work as expected. > > > > > > > > Simulating edges in the generic IRQ simulator codes seems > > > > generally useful to me, even if there is just one user now. > > > > > > > > Certainly for any kind of IRQ testing, it could be interesting to > > > > throw several low-to-high and high-to-low transitions > > > > on a driver and see how it reacts. > > > > > > > > But it is up to the irqchip maintainers to state whether they > > > > agree. > > > > > > > > > > All that would be great, but at this point I just want to fix broken > > > tests in user-space. After that we can think about how to > > > improve/approach simulating interrupts all we want. > > > > > > Marc: is my explanation for using an int instead of bool for > > > irq_sim_fire_edge() fine? Can Linus pick this up for fixes? > > > > > > > Ping. We have only this week left to fix the regression - can we get > > your Ack Marc? > > I don't understand the urge. The problem is that libgpiod's test is > failing. And that is because when userspace requested > IRQF_TRIGGER_FALLING the mockup driver also fires if the line rised and > with my change libgpiod now sees that and wonders about it. Apart from > the test failure both libgpiod and the gpio framework are entirely fine > (AFAICT). > > The "fix" under discussion is to modify the mockup driver to only report > a falling irq if the output is set to 0. But it also fires if the value > is already 0 and is set to 0 again. So the problem isn't addressed > completely, but only enough to make libgpiod's test suite report > success. > The problem with your approach is that you're treating gpio-mockup as a regular driver the goal of which is self-contained correctness. I treat it as a tool to test the userspace API. Of course libgpiod works correctly - it requests and receives the correct type of interrupts. So does the gpiolib in-kernel part. The problem indeed lies with the kernel testing module. But it doesn't matter - we want to make sure the uAPI works correctly i.e. it behaves the same with gpio-mockup as it would with a real driver for actual HW behind. We're not testing gpio-mockup(!) here. > In my eyes this is not how test-driven development works. Tests are > here to bring breakage into the light. That worked just fine here. And > now as a test fails, the goal is to fix the breakage, but not to change > just enough details to get the test to pass and then urge them through > because "we're already at -rc7 and userspace broke!" > The tests here are to find regressions in a) libgpiod and b) gpiolib kernel-to-userspace interface. The mockup module isn't part of either. The breakage in gpio-mockup/irq_sim is really not all that important. Whether the userspace API works is. And with a breakage like this we're now unable to check if it behaves correctly for events of specified types. So yes: for 4.20 I want to fix the gpio-mockup module just enough to keep the tests passing. > And no, the right fix isn't hard. My concerns were expressed Tuesday > last week, and the problem wasn't important enough since then to fix the > patch set. > I already told you on several occasions that I *will* address certain issues in irq_sim. It will *not* make you happy however because it will not use the mechanism you suggested in gpio-simulator as I still want to keep this relatively generic for others to use. I will fix other problems though - among others the one with multiple subsequent events of the same edge. I don't want to be in a hurry to propose something fast, so I want to patch the tests now and then have time to come up with a better solution. Linus agrees. I see no objections to that from neither Marc nor Thomas. I would really like to stop discussing this over and over again after my every e-mail in this thread. > But maybe it's just me and the Linux development process changed since I > learned about it and today the demand on quality isn't that high any > more. > First rule has always been "don't break the userspace" and everything else came after that. Best regards, Bartosz Golaszewski