perfbook.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Huang <mmpgouride@gmail.com>
To: paulmck@kernel.org
Cc: perfbook@vger.kernel.org
Subject: Re: Question: Are there conflicts between the paragraph and the figure?
Date: Wed, 3 May 2023 12:59:08 +0800	[thread overview]
Message-ID: <1F70BB41-6621-4C6E-BB6A-340815FB0FDA@gmail.com> (raw)
In-Reply-To: <0e0bea6c-c190-4a86-80ef-e11d6f0f0e3f@paulmck-laptop>



> 2023年5月3日 12:44,Paul E. McKenney <paulmck@kernel.org> 写道:
> 
> On Wed, May 03, 2023 at 12:31:05PM +0800, Alan Huang wrote:
>> 
>> 
>>> 2023年5月3日 01:28,Paul E. McKenney <paulmck@kernel.org> 写道:
>>> 
>>> On Tue, May 02, 2023 at 11:51:33PM +0800, Alan Huang wrote:
>>>> 
>>>> 
>>>>> 2023年5月2日 03:02,Paul E. McKenney <paulmck@kernel.org> 写道:
>>>>> 
>>>>> On Mon, May 01, 2023 at 07:09:49PM +0800, Alan Huang wrote:
>>>>>> 
>>>>>>> 2023年5月1日 下午7:05,Alan Huang <mmpgouride@gmail.com> 写道:
>>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I’m reading section 9.5.4.9, in the second to the last paragraph, there is:
>>>>>>> 
>>>>>>> Before the first horizontal line, all readers see the leftmost myconfig structure,
>>>>>>> and after the second horizontal line, all readers will see the rightmost structure. 
>>>>>>> Between the two lines, that is, during the grace period, different readers might see different objects
>>>>>>> 
>>>>>>> I’m a little confused, in Figure 9.29, the xchg is before the first horizontal line, in my understanding, if the 
>>>>>>> reader’s reading is before the xchg, it will read the leftmost myconfg structure.
>>>>>> 
>>>>>> And if reader’s reading is after the xchg, it will see the rightmost structure, and because xchg is before the first horizontal line,
>>>>>> Readers before the first horizontal line may also see the rightmost structure.
>>>>>> 
>>>>>>> 
>>>>>>> So, are there some conflicts between the paragraph and the figure?
>>>>>>> 
>>>>>>> Please correct me if I’m wrong.
>>>>> 
>>>>> Consider the point in time just before the left-hand reader's
>>>>> rcu_read_unlock() and just after the right-hand reader's rcu_read_lock().
>>>>> These two readers are both running at that time, and one of those readers
>>>>> sees the old state and the other sees the new state.
>>>> 
>>>> The sentence that may lead to conflict is this one from the original text:
>>>> 
>>>> Before the first horizontal line, all readers see the leftmost myconfig structure.
>>>> 
>>>> There may be a situation where:
>>>> 
>>>>       mcp = xchg(&curconfig, mcp);
>>>> rcu_read_lock(); 
>>>> mcp = …
>>>> *cur_a = mcp->a; 
>>>> -------------------------------------------------first horizontal line-------------------------------------------------
>>>> 
>>>> So, the reader will see the rightmost myconfig structure although it is before the first horizontal line.
>>> 
>>> Ah, I understand now, good catch and thank you!  I updated that paragraph
>>> to the following, with your Reported-by:
>>> 
>>> The two horizontal grey dashed lines represent the period of time
>>> during which different readers get different results, however,
>>> each reader will see one and only one of the two objects. All
>>> readers that end before the first horizontal line will see the
>> 
>> 
>> How about this:
>> 
>>         mcp = xchg(&curconfig, mcp);
>> rcu_read_lock(); 
>> mcp = …
>> *cur_a = mcp->a; 
>> rcu_read_unlock();
>> -------------------------------------------------first horizontal line-------------------------------------------------
>> 
>> The reader above end before the first horizontal line, but still get the rightmost myconfig structure.
>> 
>> The point is that there is a time period between xchg and the first horizontal line during which a reader
>> will see the rightmost myconfig structure. 
>> 
>> One possible solution is to move xchg behind the first horizontal line, assuming that I understand correctly.
> 
> Yes, it would in some sense be more accurate to run that horizontal line
> right through the "mcp = xchg(&curconfig, mcp);".
> 
> But can you do that so that the diagram looks OK and is legible?


I will do my best to do it

Thanks,
Alan


> 
> Thanx, Paul
> 
>>> leftmost myconfig structure, and all readers that start after the
>>> second horizontal line will see the rightmost structure. Between
>>> the two lines, that is, during the grace period, different readers
>>> might see different objects, but as long as each reader loads the
>>> curconfig pointer only once, each reader will see a consistent
>>> view of its myconfig structure.
>>> 
>>> Does that help?
>>> 
>>>> BTW, the original text says that black dotted arrows pointing from an older event to a newer event, 
>>>> but there exists two black dotted arrows in the wrong direction:
>>>> 
>>>> 1.The arrow pointing from synchronize_rcu() to left-hand rcu_read_lock()
>>>> 2.The arrow pointing right-hand rcu_read_lock() to synchronize_rcu() 
>>>> 
>>>> The directions of the two arrows above may need to be adjusted. I tried to modify this, but after a few hours, I still can’t figure out the svg...
>>> 
>>> The trick is to use an SVG editor.  For better or for worse, I use
>>> inkscape.  But easy for me to change, so I did, again, with your
>>> Reported-by.
>>> 
>>> The trick is to flip each arrow horizontally and then vertically, which
>>> reverses the direction without having to test one's manual dexterity,
>>> which I lack in abundance.  ;-)
>> 
>> 
>> Thanks for the tricks, will try to use it!
>> 
>> Thanks,
>> Alan
>> 
>>> 
>>> Thanx, Paul
>>> 
>>>> Thanks,
>>>> Alan
>>>> 
>>>>> 
>>>>> Does that help, or am I missing the point of your question?
>>>>> 
>>>>> Thanx, Paul



      parent reply	other threads:[~2023-05-03  4:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01 11:05 Question: Are there conflicts between the paragraph and the figure? Alan Huang
2023-05-01 11:09 ` Alan Huang
2023-05-01 19:02   ` Paul E. McKenney
2023-05-02 15:51     ` Alan Huang
2023-05-02 17:28       ` Paul E. McKenney
2023-05-03  4:31         ` Alan Huang
2023-05-03  4:44           ` Paul E. McKenney
2023-05-03  4:57             ` Alan Huang
2023-05-03  4:59             ` Alan Huang [this message]

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=1F70BB41-6621-4C6E-BB6A-340815FB0FDA@gmail.com \
    --to=mmpgouride@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=perfbook@vger.kernel.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).