Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1268281ybl; Tue, 13 Aug 2019 09:51:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNvO27ZqPViQ2+qY42h3pCFnO3hQ7ILWrnDu4mkFy89N+PVxO0SbYo5Ok7rQy1VN21Utjr X-Received: by 2002:a63:dc4f:: with SMTP id f15mr17923674pgj.227.1565715084232; Tue, 13 Aug 2019 09:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565715084; cv=none; d=google.com; s=arc-20160816; b=C7G708+KpAK7HIC9LfYv3tV0CUztjtl6uGNm1H2DCWCVmVD5MTWiSwBFFt6/TDswR5 /8clTe+SY4Ucmhu8DuH0NI3cpYXqj7uPJEGnYsDAtgSRLeHT7hdSAfNUtg+5CuYM/OvP 5RSfJbebVQlIiUpf8oQzUEWggiHJanl9kID8Hvbz3GHpWQWpl0g5UvnLFoucJAyNe+OL h5ec5/HpVrIAp32rU5DwEFB2jQbKnQ9UB51ZGsEl7gYDi4ZuwZMKzuHWghK85lwJaXOJ 6fGOmdEiMrikz/60Dga6ATF5mNTWF0H25BolPCci9Un/hMPziAGJHQXvaaRyJra+3imm rDQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=N2xB392smILFuWyCq9PyjU3wgivBeueANH0RAd+gaG0=; b=F1zOxj0vfwtSkiuk/MmXtziRwUKiHz01ePOr3rBwytstY985/CkHdiIfstwBMn8z8R b1xjzGm6cdaNIgtl9J4bl48DoM8ge8Urpl1ZtRmwcNmqqprwZWX+CecOmkyQeovePrk7 6V/R6D1zq3JTAFM4Dj8Whs7rhVkIHnZHfHTOjbqmkjqC3qHtFetnOdLAY51vzBa6E6Tm ePXlDh+QqP1ykw6/UmNpgeEoQ1MXYonkRWaPLC957Chd1qrTOuUbvWn5O+kCT9gdB1M4 bGtd5V5wiwfPAK0Eoa0iP4TSx/h1Od5tbWSbdYsFv2A/2nI+owV0vpaxHw5re23uJUKz 6qSw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k98si1269615pje.41.2019.08.13.09.51.08; Tue, 13 Aug 2019 09:51:24 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727582AbfHMQtg (ORCPT + 99 others); Tue, 13 Aug 2019 12:49:36 -0400 Received: from mga18.intel.com ([134.134.136.126]:12190 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbfHMQtf (ORCPT ); Tue, 13 Aug 2019 12:49:35 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2019 09:49:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,382,1559545200"; d="scan'208";a="194231033" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga001.fm.intel.com with SMTP; 13 Aug 2019 09:49:31 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 13 Aug 2019 19:49:30 +0300 Date: Tue, 13 Aug 2019 19:49:30 +0300 From: Mika Westerberg To: Lukas Wunner Cc: linux-kernel@vger.kernel.org, Andreas Noever , Michael Jamet , Yehezkel Bernat , "Rafael J. Wysocki" , Len Brown , Mario.Limonciello@dell.com, Anthony Wong , Rajmohan Mani , Raanan Avargil , David Laight , linux-acpi@vger.kernel.org Subject: Re: [PATCH v2 7/8] thunderbolt: Add support for Intel Ice Lake Message-ID: <20190813164930.GA18281@lahna.fi.intel.com> References: <20190812123847.50802-1-mika.westerberg@linux.intel.com> <20190812123847.50802-8-mika.westerberg@linux.intel.com> <20190813161038.tip2u2z22xqnmfjl@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190813161038.tip2u2z22xqnmfjl@wunner.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 13, 2019 at 06:10:38PM +0200, Lukas Wunner wrote: > On Mon, Aug 12, 2019 at 03:38:46PM +0300, Mika Westerberg wrote: > > +static void icm_veto_begin(struct tb *tb) > > +{ > > + struct icm *icm = tb_priv(tb); > > + > > + if (!icm->veto) { > > + icm->veto = true; > > + /* Keep the domain powered while veto is in effect */ > > + pm_runtime_get(&tb->dev); > > + } > > +} > > Hm, don't you need memory barriers when accessing icm->veto? AFAICT it does not need them, it is protected under mutex where there can be concurrency. > If so, I'd suggest: > > /* Keep the domain powered while veto is in effect */ > if (cmpxchg(&icm->veto, false, true)) > pm_runtime_get(&tb->dev); > > You'll have to declare icm->veto unsigned int instead of bool > because thunderbolt.ko is compiled if CONFIG_COMPILE_TEST is > enabled and there are arches which do not support cmpxchg for > a size of 1 byte. > > The other bools in struct icm should likewise be unsigned int > per Linus' dictum: > https://lkml.org/lkml/2017/11/21/384 Yeah, it probably wastes some space but I like them because IMHO they are more readable than bitfields. We have a bunch of other bools in the driver structures so if we are going to convert struct icm we should do the same for others to keep things consistent. Probably should be a separate cleanup patch. > > --- a/drivers/thunderbolt/nhi.c > > +++ b/drivers/thunderbolt/nhi.c > > +/* Ice Lake specific NHI operations */ > > + > > Again, can't this be moved to a separate file for maintainability? Sure.