Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4353206imb; Wed, 6 Mar 2019 11:15:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxFM8sJ/8dUNH3RUif+aX8kOGAuSysq2Q1XUII0lCegqCa0PRj1K+WqYeWKIwb88iHFDLTP X-Received: by 2002:a65:63c1:: with SMTP id n1mr7578731pgv.339.1551899746545; Wed, 06 Mar 2019 11:15:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551899746; cv=none; d=google.com; s=arc-20160816; b=VF3npyoJyuIOZ5IWgc6dQnsuAvJYnC9u9JB81EbgQG2F+JJVrSpJecoSRlRoHxhxZ7 yc7jjEHZhfrKsCWdqTh5lW70UKEVoxL6HjnK8z9yfQTRhEG5PV3F3p67ZiIdGMhNUs3f 0V8h1u7fWlhyhJ/Z6goBZbXXMdEO4u89LrIsu83XqyLrybuk4exIlyu9MGx++paF8dD3 6BusQ42+X555o2yI2Ik4cKWuxt05cRBQIa2FYlF/OtqOab5XYmUJeQAz+nvqWlMIAOdL xiVupROfwTZJ+441zVB1TR7OvtwcaDhMVu3dIgff3m5WZAj7sH857OvRBhChcTl/Eb9v GMzw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=foh1KeCRhfMylUuRDzfDprJeF5O+H3d0DU7HYjOcXk8=; b=sRRHdFgWbJI49/HNB3079GBw+HYtWGrFgpWRDkqukigIIgzrI0aGH6SKUb6j46oFe7 vMhUMwVW/ufLaVmNn3VkPA5gVTVJdWSq/Go0NMtmeMZoFDFjO8MEY4C30lvjdxqOL/el kBhJCG5nZ5AqfPvYZzk5o7B/xOjmhD41BIA1ThwSa6+b46fJiz86PXp8Q8NV4vC9GiuB PCcrllxA3UslbODrHjQmgfASJM23WPWyHgH37pGkCA3dXV8nurPqlikDUx7RsewEdMNy wBpSPt+ls3WehsZL3sahJe/dVCqCJHqVezrbaGzq1d8stCAQVX8n+Nynb+GUqPgQBB5p 62LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=K4E5Pm7K; 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 61si2204106plz.177.2019.03.06.11.15.31; Wed, 06 Mar 2019 11:15:46 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=K4E5Pm7K; 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 S1729847AbfCFQfd (ORCPT + 99 others); Wed, 6 Mar 2019 11:35:33 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:40588 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727436AbfCFQfc (ORCPT ); Wed, 6 Mar 2019 11:35:32 -0500 Received: by mail-ot1-f65.google.com with SMTP id v20so11302662otk.7 for ; Wed, 06 Mar 2019 08:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=foh1KeCRhfMylUuRDzfDprJeF5O+H3d0DU7HYjOcXk8=; b=K4E5Pm7KZyz8SdpPtqPCFgcwK6u1PWJSezWdpIOfuoovj51j5Q8Xe9T2p6vs+uih7G +rhy0aCfE81hZax3MaD+jHhZPJqNN5v5y3Y+W1QpWOm5S0VjJ2khP1GMDWYoUmr9+UHB V1kmIMhRwrQSw6tK4Z+BPzwvU684/q6xRPt45xHD7SH5M5ngl7IRuduuiaMn7oaGCliJ q8bKDsJXNra7kudCwFUSeR0ShPUAy84v7F6qGoy3Tp9hDL20JPU43/M1UnWwrk6+wNri Tcn3GiRdva+KJTsyjomRXAVIdl9zPzNFfXJsfnZ+fPK2ZTOX9uDyWU6kMOZROhA0OXgS GG9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=foh1KeCRhfMylUuRDzfDprJeF5O+H3d0DU7HYjOcXk8=; b=AdgH/R//nVOwhn24LerP6XNeHwaKrHmp9U6ks3AsqSsXJUF8bfGfYpxZ89dxF7xGgj wcMrrYkJAu4PHWs5SWG4Bw0xY9SX7HxuPf4c+nLhCE6SmXKibMzIwKIaYra6mxVv3tH2 tQRhwEPxkQ9onWLy32DIscDV6K8tYl26jv8LICWZwRtOcFA0wPdU5fDxIR0EtbVNS8MU sQVH6X29l2xqNE5b6FcxbqW9z4saDYs1HAmkQDQUMUVRFQKBa1c6cHMpXg4Ajdo6OFQL f9Ov0ov6Ra7wOO4x336Tn+WIadfoHv/u3F72SYP2bfoiQaajhAHY5I+kHuet4Mp+8Q7h bWGA== X-Gm-Message-State: APjAAAVrrtx5cNXgLSUOe1VAatqfKabtK/VS7DMeNSrqB8L9MxtMbb+8 bBqgi5xjOjfdLTioK2TtPcfF5uDCxmsuE9s/UW45CQ== X-Received: by 2002:a9d:224a:: with SMTP id o68mr5216791ota.214.1551890132048; Wed, 06 Mar 2019 08:35:32 -0800 (PST) MIME-Version: 1.0 References: <20190306095709.23138-1-yongxin.liu@windriver.com> In-Reply-To: <20190306095709.23138-1-yongxin.liu@windriver.com> From: Dan Williams Date: Wed, 6 Mar 2019 08:35:21 -0800 Message-ID: Subject: Re: [PATCH RT] nvdimm: make lane acquirement RT aware To: Yongxin Liu Cc: Linux Kernel Mailing List , linux-rt-users@vger.kernel.org, Sebastian Andrzej Siewior , Thomas Gleixner , Steven Rostedt , Pankaj Gupta , Paul Gortmaker , linux-nvdimm 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 On Wed, Mar 6, 2019 at 2:05 AM Yongxin Liu wrote: > > Currently, nvdimm driver isn't RT compatible. > nd_region_acquire_lane() disables preemption with get_cpu() which > causes "scheduling while atomic" spews on RT, when using fio to test > pmem as block device. > > In this change, we replace get_cpu/put_cpu with local_lock_cpu/ > local_unlock_cpu, and introduce per CPU variable "ndl_local_lock". > Due to preemption on RT, this lock can avoid race condition for the > same lane on the same CPU. When CPU number is greater than the lane > number, lane can be shared among CPUs. "ndl_lock->lock" is used to > protect the lane in this situation. > > This patch is derived from Dan Williams and Pankaj Gupta's proposal from > https://www.mail-archive.com/linux-nvdimm@lists.01.org/msg13359.html > and https://www.spinics.net/lists/linux-rt-users/msg20280.html. > Many thanks to them. > > Cc: Dan Williams > Cc: Pankaj Gupta > Cc: linux-rt-users > Cc: linux-nvdimm > Signed-off-by: Yongxin Liu Looks ok to me in concept. Acked-by: Dan Williams