From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: "Liu, Yongxin" <Yongxin.Liu@windriver.com> Cc: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>, "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "rostedt@goodmis.org" <rostedt@goodmis.org>, "Gortmaker, Paul <Paul.Gortmaker@windriver.com>, tglx@linutronix.de" <tglx@linutronix.de> Subject: Re: [PATCH RT] nvdimm: make lane acquirement RT aware Date: Fri, 8 Mar 2019 10:41:31 +0100 [thread overview] Message-ID: <20190308094131.ge4wbsvz4p6xikdf@linutronix.de> (raw) In-Reply-To: <597B109EC20B76429F71A8A97770610D12A52669@ALA-MBD.corp.ad.wrs.com> On 2019-03-08 00:07:41 [+0000], Liu, Yongxin wrote: > The lane is critical resource which needs to be protected. One CPU can use only one > lane. If CPU number is greater than the number of total lane, the lane can be shared > among CPUs. > > In non-RT kernel, get_cpu() disable preemption by calling preempt_disable() first. > Only one thread on the same CPU can get the lane. > > In RT kernel, if we only use raw_smp_processor_id(), this doesn't protect the lane. > Thus two threads on the same CPU can get the same lane at the same time. > > In this patch, two-level lock can avoid race condition for the lane. but you still have the ndl_lock->lock which protects the resource. So in the unlikely (but possible event) that you switch CPUs after obtaining the CPU number you block on the lock. No harm is done, right? > Thanks, > Yongxin Sebastian _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: "Liu, Yongxin" <Yongxin.Liu@windriver.com> Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>, "tglx@linutronix.de" <tglx@linutronix.de>, "rostedt@goodmis.org" <rostedt@goodmis.org>, "dan.j.williams@intel.com" <dan.j.williams@intel.com>, "pagupta@redhat.com" <pagupta@redhat.com>, "Gortmaker, Paul" <Paul.Gortmaker@windriver.com>, "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org> Subject: Re: [PATCH RT] nvdimm: make lane acquirement RT aware Date: Fri, 8 Mar 2019 10:41:31 +0100 [thread overview] Message-ID: <20190308094131.ge4wbsvz4p6xikdf@linutronix.de> (raw) In-Reply-To: <597B109EC20B76429F71A8A97770610D12A52669@ALA-MBD.corp.ad.wrs.com> On 2019-03-08 00:07:41 [+0000], Liu, Yongxin wrote: > The lane is critical resource which needs to be protected. One CPU can use only one > lane. If CPU number is greater than the number of total lane, the lane can be shared > among CPUs. > > In non-RT kernel, get_cpu() disable preemption by calling preempt_disable() first. > Only one thread on the same CPU can get the lane. > > In RT kernel, if we only use raw_smp_processor_id(), this doesn't protect the lane. > Thus two threads on the same CPU can get the same lane at the same time. > > In this patch, two-level lock can avoid race condition for the lane. but you still have the ndl_lock->lock which protects the resource. So in the unlikely (but possible event) that you switch CPUs after obtaining the CPU number you block on the lock. No harm is done, right? > Thanks, > Yongxin Sebastian
next prev parent reply other threads:[~2019-03-08 9:41 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-03-06 9:57 [PATCH RT] nvdimm: make lane acquirement RT aware Yongxin Liu 2019-03-06 9:57 ` Yongxin Liu 2019-03-06 16:35 ` Dan Williams 2019-03-06 16:35 ` Dan Williams 2019-03-07 14:33 ` Sebastian Andrzej Siewior 2019-03-07 14:33 ` Sebastian Andrzej Siewior 2019-03-08 0:07 ` Liu, Yongxin 2019-03-08 0:07 ` Liu, Yongxin 2019-03-08 9:41 ` Sebastian Andrzej Siewior [this message] 2019-03-08 9:41 ` Sebastian Andrzej Siewior 2019-03-11 0:44 ` Liu, Yongxin 2019-03-11 0:44 ` Liu, Yongxin 2019-03-15 16:42 ` Sebastian Andrzej Siewior 2019-03-15 16:42 ` Sebastian Andrzej Siewior 2019-03-18 1:41 ` Liu, Yongxin 2019-03-18 1:41 ` Liu, Yongxin 2019-03-18 11:40 ` Sebastian Andrzej Siewior 2019-03-18 11:40 ` Sebastian Andrzej Siewior 2019-03-18 11:48 ` Liu, Yongxin 2019-03-18 11:48 ` Liu, Yongxin 2019-03-28 17:38 ` Sebastian Andrzej Siewior 2019-03-28 17:38 ` Sebastian Andrzej Siewior 2019-03-08 6:31 ` Pankaj Gupta 2019-03-08 6:31 ` Pankaj Gupta
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190308094131.ge4wbsvz4p6xikdf@linutronix.de \ --to=bigeasy@linutronix.de \ --cc=Yongxin.Liu@windriver.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-nvdimm@lists.01.org \ --cc=linux-rt-users@vger.kernel.org \ --cc=rostedt@goodmis.org \ --cc=tglx@linutronix.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.