Received: by 10.223.185.116 with SMTP id b49csp1192552wrg; Wed, 21 Feb 2018 13:52:56 -0800 (PST) X-Google-Smtp-Source: AH8x2274bBdQRpt9qCe/jHZvCjR9GfmE1k7YuseY7G9kDdonF/jrnsfgsy/MKoYho7Eo25PBC0sL X-Received: by 10.98.12.1 with SMTP id u1mr4668585pfi.192.1519249976788; Wed, 21 Feb 2018 13:52:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519249976; cv=none; d=google.com; s=arc-20160816; b=rGqNF1advsnR/eIk2lw4m4jI+B+1uHJcN9hOt4l8+Kbq6DmAsoxOuI1JaAqz6C1KW2 IfHFQWOj+q0RdNqXbKtVAy2ZjeKwQ+7yyGssk3j5D7JW1MpvBaSXKX6zSGjRfQJqMaAD oqPtliCufeRsih3rNNGyAQr42Ei8wbar1fH++/p7hQsfvlusftPl2BwdAkK4rQaLFRvv QWLJ9Te22dbx9JnG5fbckPy7gmYMBlKDRXAoPPxQvsg79glXfMVkE2nUoxuuL7GiiliA 8REpS2SoFqoT0OcGs/32OfZM70liG2tK5AZuzLZyC2fVYSjO8WvrnQfmd5B8X3rrZBsd ttjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=r8TPYTs1rOkRZu+orI+C1rCg5uvWYtr1dh90MUMj8z0=; b=St0mR1L6BbGKkczXxFj5C+09tOgpjZH8sjRWpCXCGFT7bE1kD6Ub3+3f/7bCqOOOyW bEO79wIrPCc3nM/oCqsUDM/x8gRBUw+EvESM5MHOsRmOFhq1J6+kxMHrKMu1sv2YRoZf vhlLYdNBnotJ3z4TB0hYQCzRWrGsfN2qa/jr8dL6au/FT4DZUOzOoIVFjwB5B5lbGArQ fCETH2522OcJ/Asyu/mogPvCwnakzqb/KagzFBrTvcvxEn0WaUs69rIpN/GTZUIJQQa9 hoO/GBo4UW8xdzl0q6GsD+ll9aXDvpi0fT2QW2DI4CmCCF5UlKbamsmfjUqV7WjUNe1b edKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=dmycADH4; 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 n8-v6si267251pls.231.2018.02.21.13.52.41; Wed, 21 Feb 2018 13:52:56 -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=@lunn.ch header.s=20171124 header.b=dmycADH4; 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 S1751155AbeBUVwD (ORCPT + 99 others); Wed, 21 Feb 2018 16:52:03 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:33431 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbeBUVwB (ORCPT ); Wed, 21 Feb 2018 16:52:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=r8TPYTs1rOkRZu+orI+C1rCg5uvWYtr1dh90MUMj8z0=; b=dmycADH4gIxQPcnggeboAjP4nqeOvl5hZtRpA/UIaHIdDihbKaNrNtnOf4oiphWgHX4pEQ0TEttZEZxWsNr18rHEdv5Inv/Rzj3cAH4X9JrC0GFpuf5iyPnyF/cgPPRaZDJXQ68JqCWeK2P/6Dkyf3vyCzQ/amKjEwGDBmvSuq8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1eocIX-0002xG-Fm; Wed, 21 Feb 2018 22:51:33 +0100 Date: Wed, 21 Feb 2018 22:51:33 +0100 From: Andrew Lunn To: Jae Hyun Yoo Cc: joel@jms.id.au, andrew@aj.id.au, arnd@arndb.de, gregkh@linuxfoundation.org, jdelvare@suse.com, linux@roeck-us.net, benh@kernel.crashing.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org Subject: Re: [PATCH v2 1/8] [PATCH 1/8] drivers/peci: Add support for PECI bus driver core Message-ID: <20180221215133.GA9056@lunn.ch> References: <20180221161606.32247-1-jae.hyun.yoo@linux.intel.com> <20180221161606.32247-2-jae.hyun.yoo@linux.intel.com> <20180221170434.GF29204@lunn.ch> <650488e8-8516-1329-b35b-88d628d21cc2@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <650488e8-8516-1329-b35b-88d628d21cc2@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > >Is there a real need to do transfers in atomic context, or with > >interrupts disabled? > > > > Actually, no. Generally, this function will be called in sleep-able context > so this code is for an exceptional case handling. > > I'll rewrite this code like below: > if (in_atomic() || irqs_disabled()) { > dev_dbg(&adapter->dev, > "xfer in non-sleepable context is not supported\n"); > return -EWOULDBLOCK; > } I would not even do that. Just add a call to might_sleep(). CONFIG_DEBUG_ATOMIC_SLEEP will then find bad calls. > >>+static int peci_ioctl_get_temp(struct peci_adapter *adapter, void *vmsg) > >>+{ > >>+ struct peci_get_temp_msg *umsg = vmsg; > >>+ struct peci_xfer_msg msg; > >>+ int rc; > >>+ > > > >Is this getting the temperature? > > > > Yes, this is getting the 'die' temperature of a processor package. So the hwmon driver provides this. No need to have both. > >>+static long peci_ioctl(struct file *file, unsigned int iocmd, unsigned long arg) > >>+{ > >>+ struct peci_adapter *adapter = file->private_data; > >>+ void __user *argp = (void __user *)arg; > >>+ unsigned int msg_len; > >>+ enum peci_cmd cmd; > >>+ u8 *msg; > >>+ int rc = 0; > >>+ > >>+ dev_dbg(&adapter->dev, "ioctl, cmd=0x%x, arg=0x%lx\n", iocmd, arg); > >>+ > >>+ switch (iocmd) { > >>+ case PECI_IOC_PING: > >>+ case PECI_IOC_GET_DIB: > >>+ case PECI_IOC_GET_TEMP: > >>+ case PECI_IOC_RD_PKG_CFG: > >>+ case PECI_IOC_WR_PKG_CFG: > >>+ case PECI_IOC_RD_IA_MSR: > >>+ case PECI_IOC_RD_PCI_CFG: > >>+ case PECI_IOC_RD_PCI_CFG_LOCAL: > >>+ case PECI_IOC_WR_PCI_CFG_LOCAL: > >>+ cmd = _IOC_TYPE(iocmd) - PECI_IOC_BASE; > >>+ msg_len = _IOC_SIZE(iocmd); > >>+ break; > > > >Adding new ioctl calls is pretty frowned up. Can you export this info > >via /sysfs? > > > > Most of these are not simple IOs so ioctl is better suited, I think. Lets see what other reviewers say, but i think ioctls are wrong. Andrew