Received: by 10.223.185.116 with SMTP id b49csp1203942wrg; Wed, 21 Feb 2018 14:05:05 -0800 (PST) X-Google-Smtp-Source: AH8x227dB20AVPQ8xgAFrrCHuJaJxKyZuk7QlxU4jaYRV48ofw/buUtJqsE/cMcU4s1DlKITE2nU X-Received: by 2002:a17:902:8646:: with SMTP id y6-v6mr4530085plt.406.1519250705644; Wed, 21 Feb 2018 14:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519250705; cv=none; d=google.com; s=arc-20160816; b=cHjQFblZIu2SVFUZ+s0/GeB0gXFmThOSiK9RKmUrPI+RWXEYpbrDF1SOR11HyV5MmB BRbbESamwaBH50ATrknWZ+2u+qx/GCPTtYO+IXQAUHO6QEmqUZzX3o5lMysMlarR4Mt1 yqtd0KYdf4F1iMo8TlUDibcp2SW3V8Nr3HH383ygh4if83jUy08LdJu+XDajUkeXR9/N 6YC8qkjMn6heiBIeAmOa0d71Mo+Q6E0onQsOsGWbyqts4H1+IAx9RiULJuDkh4X9cAF+ pj+/5KlxN3OrKTopNP71oAHTYYYsxCSHoEpIUCIqlqVGi3LCYgpoXHrPM/nv6mul+74h CM9A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=OQLF9yMr5Uy4RbQC8CgWDRBFTIEexQzolAq8tHIVvqY=; b=DJexs5zuqQepnP0gGkoI1vsB1QrOrKfd5bz2VZXtEdYXPGfuQocEksLE4JpFWDhSYc S5s8XO2Qwrr5APxhOtnE8l+JDO5ex8RNwvOOGhVZU19/Z2kgSnZfWbmyICUaN3zSKH+W Q9XWQprnDO7cSqnXkfRcxJti71bb4/6jS0Ij0MAx2dVHrdcoOwQtFZ1zbAorTqFdiaeV MCyRsPTAxJoOakWDuzDmDL13diOFzY12Or17n3sQjuCGPkRMk2ghLewniWtZDEyFtE+e 4EPXYa5t6nnrJ2DR8jVlbsm5t1inxbiolL5urb6h+WwlgaSG1EXML2xewC7eXzkIxKNs yy+g== 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 l4-v6si7862113plb.68.2018.02.21.14.04.48; Wed, 21 Feb 2018 14:05:05 -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 S1751165AbeBUWDq (ORCPT + 99 others); Wed, 21 Feb 2018 17:03:46 -0500 Received: from mga06.intel.com ([134.134.136.31]:54435 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbeBUWDp (ORCPT ); Wed, 21 Feb 2018 17:03:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2018 14:03:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,376,1515484800"; d="scan'208";a="206015903" Received: from yoojae-mobl1.amr.corp.intel.com (HELO [10.254.109.12]) ([10.254.109.12]) by fmsmga006.fm.intel.com with ESMTP; 21 Feb 2018 14:03:41 -0800 Subject: Re: [PATCH v2 1/8] [PATCH 1/8] drivers/peci: Add support for PECI bus driver core To: Andrew Lunn 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 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> <20180221215133.GA9056@lunn.ch> From: Jae Hyun Yoo Message-ID: <6c67978c-9283-6c8d-95b4-9900b3b9a810@linux.intel.com> Date: Wed, 21 Feb 2018 14:03:37 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180221215133.GA9056@lunn.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/21/2018 1:51 PM, Andrew Lunn wrote: >>> 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. > Thanks for the suggestion. I've learned one thing. :) >>>> +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. > This this common API in core driver of PECI bus. The hwmon is also uses it through peci_command call. >>>> +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 >