Received: by 10.223.185.116 with SMTP id b49csp4253850wrg; Mon, 26 Feb 2018 14:07:59 -0800 (PST) X-Google-Smtp-Source: AG47ELsYHB2ayHmiIcZ4ExfPyY4eqWo14QWCisDjR0jb8sq+Q6qbGdrBbLqLTy4e44tC2iSGHXHd X-Received: by 2002:a17:902:2e83:: with SMTP id r3-v6mr5441298plb.84.1519682879075; Mon, 26 Feb 2018 14:07:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519682879; cv=none; d=google.com; s=arc-20160816; b=yaTu6XrtAcu/koAxuLhTF7NadjwxPt918x3zFp4CdIQO1wqxs87iwxal8xRKsa6KYx H9K2q+Tups0BBdJd7YQFaOxPlGsj/VohilSV6nY92TFPALo6z9G+cfvPjdIx3sJt3QT7 sFh2qOMRz0ha7N05ASX+1+pVAr/9bIPpDJSTr1fp9LUQZqsSpw4eCgLI056cDNDfDTNc Was0NDfGjF/P9Njr7GWYvqFhFR0L5mBuOFylflL/i2OMi5liiAOWI+VxttN9jYtZyPzD BANfwxfRrllUa/TYPKTqNusTQAAc+7Mh117wnAIOqlPVNXaVDE6tLfIpkRgrDEoKb4yL 3UGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=6V0dmoNdnxPh5FvPMl+yKKipPuGroJsGNJqyRQKxiqw=; b=Pg80Bq2xiKfJc2ElVXcZVgKSTnCWUjxI8BI0Oo4YCPkUhuEilmDdsAooXTi2VfKO52 c9ILZYWV7C2xJtNbt1yQZHpdjmp96w0A4eXc4x9orNQ4w5DK+/OYzbvT0ZRAlGB+AfmJ syKiKZrQ8voIVOTrQN5BQlFHYwSxdhz8SQmMYvQa0+ImncootEsdMkEcezcaZVPEpxUa c3UF5vIDdBCaygQ7MuCMnrBEdouuDFwXXeHbN8UkXIHeX6hU7/65u4M+hWBLXdVkCR1W iCW4+MuoD2gm6CqnjZ4X1SPGg9LYf9miR3bMqxYJJNeMMGAD0x9x7oAPwBwtPQHj7YeY RfLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=k0lr/P/O; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u82si7362975pfg.389.2018.02.26.14.07.41; Mon, 26 Feb 2018 14:07:59 -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=@chromium.org header.s=google header.b=k0lr/P/O; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751857AbeBZWGR (ORCPT + 99 others); Mon, 26 Feb 2018 17:06:17 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38933 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751429AbeBZWGP (ORCPT ); Mon, 26 Feb 2018 17:06:15 -0500 Received: by mail-wm0-f67.google.com with SMTP id 191so20132275wmm.4 for ; Mon, 26 Feb 2018 14:06:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=6V0dmoNdnxPh5FvPMl+yKKipPuGroJsGNJqyRQKxiqw=; b=k0lr/P/OBABjlO0UjAoQa5/IGZQnwjKSKsv2PUSz+q3aGKT7uZT0+yJz6nW6qQTlbP Z+UZfLMbM2xVFYW3itafYCYe22DgO2pu8XbA4Ld6rFZSPYNZ1Ql1HP9suLSjRFN2ES/K uDl5ghe7JRKuay6lrikHaflPZ6RgmwC89UT70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=6V0dmoNdnxPh5FvPMl+yKKipPuGroJsGNJqyRQKxiqw=; b=G/rrJ6l9AKpUZ2g9QlFuyXeGdbIh9Ov1GWE9CwqZOuvo9W4WqYWhIfzUOWGiZzkcMP /8o02P5mEVJBPfp5W4GNTBywWxQog0/DeKb/XffPgrLjKs2YFq5B392VQBPgQ3kmX2+c V48ni0hlfJUQqIgfu8kj64v64+d0x29eCrEf9Pv0aq99sW0uCTYoe7cO6nUtlRVNfssa CNO4f8TfmjB+4bsVUXupedcSM6F9dUOiNuoNf1h6SmvB3OW+QOB/Oitmo1iL6x0Gtx9G ChKcUb39KSzjajwJFcDk00wEUiQ0UJpGY0tcgQu2WlV2D9CHz4MWnkUlL6My7xyBnAVT Zw/w== X-Gm-Message-State: APf1xPDAMm9akg6MBBBTP0geSsjhZiwC9FQSwQ1ktAhNSL+5Wxp88Kx6 77HbKVGnRMLfrjXl4JxiYIIcCMXPe1A= X-Received: by 10.80.178.227 with SMTP id p90mr15668497edd.74.1519682774168; Mon, 26 Feb 2018 14:06:14 -0800 (PST) Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com. [74.125.82.44]) by smtp.gmail.com with ESMTPSA id p14sm8789114edj.46.2018.02.26.14.06.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 14:06:13 -0800 (PST) Received: by mail-wm0-f44.google.com with SMTP id t6so11794746wmt.5 for ; Mon, 26 Feb 2018 14:06:12 -0800 (PST) X-Received: by 10.80.217.141 with SMTP id w13mr16052939edj.193.1519682772382; Mon, 26 Feb 2018 14:06:12 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.133.201 with HTTP; Mon, 26 Feb 2018 14:06:11 -0800 (PST) In-Reply-To: <1519383062.2231.5.camel@sipsolutions.net> References: <1519210220-22437-1-git-send-email-arend.vanspriel@broadcom.com> <1519210220-22437-3-git-send-email-arend.vanspriel@broadcom.com> <20180221225903.GA42395@rodete-desktop-imager.corp.google.com> <5A8EB4F4.2030103@broadcom.com> <20180222193547.GA78462@rodete-desktop-imager.corp.google.com> <5A8FEF68.5080900@broadcom.com> <1519383062.2231.5.camel@sipsolutions.net> From: Brian Norris Date: Mon, 26 Feb 2018 14:06:11 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] mwifiex: support sysfs initiated device coredump To: Johannes Berg Cc: Arend van Spriel , Kalle Valo , Marcel Holtmann , linux-wireless@vger.kernel.org, Linux Bluetooth mailing list , Linux Kernel , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Feb 23, 2018 at 2:51 AM, Johannes Berg wrote: > On Fri, 2018-02-23 at 11:39 +0100, Arend van Spriel wrote: > > > > > Well, that depends on the eye of the beholder I guess. From user-space > > > > perspective it is asynchronous regardless. A write access to the coredump > > > > sysfs file eventually results in a uevent when the devcoredump entry is > > > > created, ie. after driver has made a dev_coredump API call. Whether the > > > > driver does that synchronously or asynchronously is irrelevant as far as > > > > user-space is concerned. > > > > > > Is it really? The driver infrastructure seems to guarantee that the > > > entirety of a driver's ->coredump() will complete before returning from > > > the write. So it might be reasonable for some user to assume (based on > > > implementation details, e.g., of brcmfmac) that the devcoredump will be > > > ready by the time the write() syscall returns, absent documentation that > > > says otherwise. But then, that's not how mwifiex works right now, so > > > they might be surprised if they switch drivers. > > I can see how you might want to have that kind of behaviour, but you'd > have to jump through some hoops to see if the coredump you saw is > actually the right one - you probably want an asynchronous coredump > "collector" and then wait for it to show up (with some reasonable > timeout) on the actual filesystem, not on sysfs? > > Otherwise you have to trawl sysfs for the right coredump I guess, which > too is possible. It's not that I want that interface. It's that I want the *lack* of such an interface to be guaranteed in the documentation. When the questions like "where? when?" are not answered in the doc, users are totally allowed to speculate ;) Perhaps the "where" can be deferred to other documentation (which should probably exist someday), but the "when" should be listed as "eventually; or not at all; listen for a uevent." > > > > You are right. Clearly I did not reach the end my learning curve here. I > > > > assumed referring to the existing dev_coredump facility was sufficient, but > > > > maybe it is worth a patch to be more explicit and mention the uevent > > > > behavior. Also dev_coredump facility may be disabled upon which the trigger > > > > will have no effect in sysfs. In the kernel the data passed by the driver is > > > > simply freed by dev_coredump facility. > > > > > > Is there any other documentation for the coredump feature? I don't > > > really see much. > > > > Any other than the code itself you mean? I am not sure. Maybe Johannes > > knows. > > There isn't really, it originally was really simple, but then somebody > (Kees perhaps?) requested a way to turn it off forever for security or > privacy concerns and it became more complicated. Then I don't think when adding a new sysfs ABI, we should be deferring to "existing dev_coredump facility [documentation]" (which doesn't exist). And just a few words about the user-facing interface would be nice for the documentation. There previously wasn't any official way to trigger a dump from userspace -- only from random debugfs files, I think, or from unspecified device failures. > > > static ssize_t coredump_store(struct device *dev, struct device_attribute *attr, > > > const char *buf, size_t count) > > > { > > > device_lock(dev); > > > if (dev->driver->coredump) > > > dev->driver->coredump(dev); > > > device_unlock(dev); > > > > > > return count; > > > } > > > static DEVICE_ATTR_WO(coredump); > > > > > > Is that a bug or a feature? > > > > Yeah. Let's call it a bug. Just not sure what to go for. Return the > > error or change coredump callback to void return type. > > I'm not sure it matters all that much - the underlying devcoredump > calls all have no return value (void), and given the above complexities > with the ability to turn off devcoredumping entirely you cannot rely on > this return value to tell you if a dump was created or not, at least > not without much more infrastructure work. Then perhaps it makes sense to remove the return code before you create users of it. Brian