Received: by 10.223.185.116 with SMTP id b49csp538826wrg; Fri, 23 Feb 2018 02:52:01 -0800 (PST) X-Google-Smtp-Source: AH8x226sLY3G9KDsXXEh1vjMFo4r4LwP7nZsN3OvJsQKYPgbxb5kB9SLyAR3UKQeUuFdsg8/4qep X-Received: by 10.98.217.211 with SMTP id b80mr1362095pfl.107.1519383121117; Fri, 23 Feb 2018 02:52:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519383121; cv=none; d=google.com; s=arc-20160816; b=fQCT0d1Yjf2C9TNHnFnXrtD8qeYF63xFzmZK3+Z0KHuK7k4J/aYp9iQkGFOkV8r1yS 0Q7MGHTj8A4ussCdTzbsv+dx74VY6/6kmkw9yUr09BUqfkDaSMyLWhWQ/fwEtbp7U/pi iMFEgY9GKeZjY78ujbqP+aauJ+ESAvx4jyozmsDIHfXPDFWZQxFIxUr/4gO56RJagthr MnOWQ9At2p6mYI2aL1nTHEur7HNkPEYJ9YMUjDD3t4mmnIuVYybEmbL4dHwsrH/IjLDQ d0RUbCqLFS7iKSu1PulVmjbxBSshgfiGfy9zKjWpgOLDJoC7nUXo+GSi9cPCd88DYHXx vkrg== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=RV6342dII/7WqjFPqL4Rc5CDUVmxXA+NJzqw1s/MFwU=; b=xps6Pqb7/u3iccXjvta/jamy5Sw+xd0B+fRDDTlx88cVT/JCw+pU9+xIzxDQFLZJuJ HPIKmAfw1KizdCJXXtu638upX7UaVhUinyeo5pvs+tGvZk+t9tATZXMXaJtZIsT2wdhr IS4JmSJntchHQX4Oe4AgW6Y41jXjsa0ml21M+qsGJ4BVpJQOZ0bRws/htwAe1hl9x4tP JkulblobMRCoGhE46xOO8XUy0dh9iGsGQgxQ3PpffxbL0TK5RAiHp2PYF/AQf2Wg3FC4 0M6jMpOaXdcE1U+Dr9ITqsIhu0lwFT8yg/ec8SxS4O7cHOqHK1gPkCIt4PEi7oClzjgG bDrA== ARC-Authentication-Results: i=1; mx.google.com; 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 w3-v6si1595652plb.441.2018.02.23.02.51.46; Fri, 23 Feb 2018 02:52:01 -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; 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 S1751387AbeBWKvJ (ORCPT + 99 others); Fri, 23 Feb 2018 05:51:09 -0500 Received: from s3.sipsolutions.net ([144.76.63.242]:55138 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750861AbeBWKvH (ORCPT ); Fri, 23 Feb 2018 05:51:07 -0500 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1epAwR-0006vt-Oz; Fri, 23 Feb 2018 11:51:03 +0100 Message-ID: <1519383062.2231.5.camel@sipsolutions.net> Subject: Re: [PATCH 2/3] mwifiex: support sysfs initiated device coredump From: Johannes Berg To: Arend van Spriel , Brian Norris Cc: Kalle Valo , Marcel Holtmann , linux-wireless@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Date: Fri, 23 Feb 2018 11:51:02 +0100 In-Reply-To: <5A8FEF68.5080900@broadcom.com> (sfid-20180223_113938_578183_0B4B09C3) 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> (sfid-20180223_113938_578183_0B4B09C3) Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey, Hadn't really followed this discussion much due to other fires elsewhere :-) 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. > > > 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. > > 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. johannes