Skip to contentSkip to conversation

Always generate perfbook.synctex.gz

PATCH In review Akira Yokosawa 2 participants 12 messages Oct 19, 2019 – Oct 22, 2019 2 messages not in the archive

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive
Quoted 29 lines · Akira Yokosawa

From 41473d36c8bfaf96c4d0d0b3ca04f688ae6d4739 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Fri, 18 Oct 2019 00:12:24 +0900
Subject: [PATCH v2] Always generate perfbook.synctex.gz

Commit 8458f7572335 ("Add optional flag 'LATEX_OPT' in run{first}latex.sh") was ment to support optinal generation of .synctex files.
It turns out that evince and gedit pair supports both the forward (.tex -> PDF) and the inverse (PDF -> .tex) searches [1].
I find this mechanism helps a lot in perfbook, because of its nested LaTeX source structure.

For forward search (.tex -> PDF) to work, each sub-sources needs to have a pointer to main file in the first/last 3 lines. This commit therefor adds the pointers to top level perfbook.tex.

Also add an entry in FAQ-BUILD.txt as an introduction of the capability.

Note: As SyncTeX search will work only for perfbook.pdf, other targets do not generate .synctex.gz.

[1]: https://help.gnome.org/users/evince/stable/synctex-search.html.en

---
Changes from v1:

Quoted 6 lines

o Simplify setting of LATEX_OPT in Makefile. The behavior is the same as v1.
o Add Cc: to Balbir.

I'd like to know this change has no regression with Balbir's workflow. I'm assuming Balbir's viewer and editor combination is something other than evince and gedit.

Paul, this change does have regression in that the inverse search (PDF -> .tex) stops working other than perfbook.pdf.

Current master allows inverse search from any of perfbook*.pdf.

So, please hold off this one.

Let me try another round to enable forward search of SyncTeX.

Thanks, Akira

Quoted 72 lines

Thanks, Akira
--

 FAQ-BUILD.txt                             | 21 +++++++++++++++++++++
 Makefile                                  |  5 +++++
 SMPdesign/SMPdesign.tex                   |  2 ++
 SMPdesign/beyond.tex                      |  4 +++-
 SMPdesign/criteria.tex                    |  1 +
 SMPdesign/partexercises.tex               |  2 ++
 advsync/advsync.tex                       |  2 ++
 advsync/rcu.tex                           |  2 ++
 advsync/rt.tex                            |  2 ++
 appendix/ack/ack.tex                      |  1 +
 appendix/appendix.tex                     |  1 +
 appendix/questions/after.tex              |  2 ++
 appendix/questions/concurrentparallel.tex |  1 +
 appendix/questions/questions.tex          |  1 +
 appendix/questions/time.tex               |  1 +
 appendix/styleguide/styleguide.tex        |  1 +
 appendix/toyrcu/toyrcu.tex                |  2 ++
 appendix/whymb/whymemorybarriers.tex      |  2 ++
 count/count.tex                           |  2 ++
 cpu/cpu.tex                               |  1 +
 cpu/hwfreelunch.tex                       |  1 +
 cpu/overheads.tex                         |  1 +
 cpu/overview.tex                          |  2 ++
 cpu/swdesign.tex                          |  1 +
 datastruct/datastruct.tex                 |  2 ++
 debugging/debugging.tex                   |  2 ++
 defer/defer.tex                           |  1 +
 defer/hazptr.tex                          |  1 +
 defer/rcu.tex                             |  3 ++-
 defer/rcuapi.tex                          |  4 +++-
 defer/rcuexercises.tex                    |  1 +
 defer/rcufundamental.tex                  |  2 ++
 defer/rcuintro.tex                        |  2 ++
 defer/rcurelated.tex                      |  2 ++
 defer/rcuusage.tex                        |  2 ++
 defer/refcnt.tex                          |  2 ++
 defer/seqlock.tex                         |  2 ++
 defer/updates.tex                         |  3 ++-
 defer/whichtochoose.tex                   |  1 +
 easy/easy.tex                             |  1 +
 formal/axiomatic.tex                      |  2 ++
 formal/dyntickrcu.tex                     |  2 ++
 formal/formal.tex                         |  1 +
 formal/ppcmem.tex                         |  4 +++-
 formal/sat.tex                            |  1 +
 formal/spinhint.tex                       |  2 ++
 formal/stateless.tex                      |  1 +
 future/cpu.tex                            |  1 +
 future/formalregress.tex                  |  1 +
 future/future.tex                         |  1 +
 future/htm.tex                            |  2 ++
 future/tm.tex                             |  2 ++
 glossary.tex                              |  1 +
 howto/howto.tex                           |  2 ++
 intro/intro.tex                           |  1 +
 legal.tex                                 |  1 +
 locking/locking-existence.tex             |  4 +++-
 locking/locking.tex                       |  2 ++
 memalloc/memalloc.tex                     |  1 +
 memorder/memorder.tex                     |  2 ++
 owned/owned.tex                           |  2 ++
 together/applyrcu.tex                     |  2 ++
 together/count.tex                        |  1 +
 together/hash.tex                         |  1 +
 together/refcnt.tex                       |  2 ++
 together/together.tex                     |  1 +
 toolsoftrade/toolsoftrade.tex             |  2 ++
 67 files changed, 131 insertions(+), 6 deletions(-)

[...]

#3 lore raw
Quoted 37 lines · Akira Yokosawa
Quoted 29 lines · Akira Yokosawa

From 41473d36c8bfaf96c4d0d0b3ca04f688ae6d4739 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Fri, 18 Oct 2019 00:12:24 +0900
Subject: [PATCH v2] Always generate perfbook.synctex.gz

Commit 8458f7572335 ("Add optional flag 'LATEX_OPT' in run{first}latex.sh") was ment to support optinal generation of .synctex files.
It turns out that evince and gedit pair supports both the forward (.tex -> PDF) and the inverse (PDF -> .tex) searches [1].
I find this mechanism helps a lot in perfbook, because of its nested LaTeX source structure.

For forward search (.tex -> PDF) to work, each sub-sources needs to have a pointer to main file in the first/last 3 lines. This commit therefor adds the pointers to top level perfbook.tex.

Also add an entry in FAQ-BUILD.txt as an introduction of the capability.

Note: As SyncTeX search will work only for perfbook.pdf, other targets do not generate .synctex.gz.

[1]: https://help.gnome.org/users/evince/stable/synctex-search.html.en

---
Changes from v1:

Quoted 6 lines

o Simplify setting of LATEX_OPT in Makefile. The behavior is the same as v1.
o Add Cc: to Balbir.

I'd like to know this change has no regression with Balbir's workflow. I'm assuming Balbir's viewer and editor combination is something other than evince and gedit.

Quoted 6 lines

Paul, this change does have regression in that the inverse search (PDF -> .tex) stops working other than perfbook.pdf.

Current master allows inverse search from any of perfbook*.pdf.

So, please hold off this one.

Will do, especially given that this email reached me and the one that it replies to did not. ;-)

Quoted 1 line

Let me try another round to enable forward search of SyncTeX.

Sounds good!

Thanx, Paul

Quoted 75 lines

Thanks, Akira

Quoted 72 lines

Thanks, Akira
--

 FAQ-BUILD.txt                             | 21 +++++++++++++++++++++
 Makefile                                  |  5 +++++
 SMPdesign/SMPdesign.tex                   |  2 ++
 SMPdesign/beyond.tex                      |  4 +++-
 SMPdesign/criteria.tex                    |  1 +
 SMPdesign/partexercises.tex               |  2 ++
 advsync/advsync.tex                       |  2 ++
 advsync/rcu.tex                           |  2 ++
 advsync/rt.tex                            |  2 ++
 appendix/ack/ack.tex                      |  1 +
 appendix/appendix.tex                     |  1 +
 appendix/questions/after.tex              |  2 ++
 appendix/questions/concurrentparallel.tex |  1 +
 appendix/questions/questions.tex          |  1 +
 appendix/questions/time.tex               |  1 +
 appendix/styleguide/styleguide.tex        |  1 +
 appendix/toyrcu/toyrcu.tex                |  2 ++
 appendix/whymb/whymemorybarriers.tex      |  2 ++
 count/count.tex                           |  2 ++
 cpu/cpu.tex                               |  1 +
 cpu/hwfreelunch.tex                       |  1 +
 cpu/overheads.tex                         |  1 +
 cpu/overview.tex                          |  2 ++
 cpu/swdesign.tex                          |  1 +
 datastruct/datastruct.tex                 |  2 ++
 debugging/debugging.tex                   |  2 ++
 defer/defer.tex                           |  1 +
 defer/hazptr.tex                          |  1 +
 defer/rcu.tex                             |  3 ++-
 defer/rcuapi.tex                          |  4 +++-
 defer/rcuexercises.tex                    |  1 +
 defer/rcufundamental.tex                  |  2 ++
 defer/rcuintro.tex                        |  2 ++
 defer/rcurelated.tex                      |  2 ++
 defer/rcuusage.tex                        |  2 ++
 defer/refcnt.tex                          |  2 ++
 defer/seqlock.tex                         |  2 ++
 defer/updates.tex                         |  3 ++-
 defer/whichtochoose.tex                   |  1 +
 easy/easy.tex                             |  1 +
 formal/axiomatic.tex                      |  2 ++
 formal/dyntickrcu.tex                     |  2 ++
 formal/formal.tex                         |  1 +
 formal/ppcmem.tex                         |  4 +++-
 formal/sat.tex                            |  1 +
 formal/spinhint.tex                       |  2 ++
 formal/stateless.tex                      |  1 +
 future/cpu.tex                            |  1 +
 future/formalregress.tex                  |  1 +
 future/future.tex                         |  1 +
 future/htm.tex                            |  2 ++
 future/tm.tex                             |  2 ++
 glossary.tex                              |  1 +
 howto/howto.tex                           |  2 ++
 intro/intro.tex                           |  1 +
 legal.tex                                 |  1 +
 locking/locking-existence.tex             |  4 +++-
 locking/locking.tex                       |  2 ++
 memalloc/memalloc.tex                     |  1 +
 memorder/memorder.tex                     |  2 ++
 owned/owned.tex                           |  2 ++
 together/applyrcu.tex                     |  2 ++
 together/count.tex                        |  1 +
 together/hash.tex                         |  1 +
 together/refcnt.tex                       |  2 ++
 together/together.tex                     |  1 +
 toolsoftrade/toolsoftrade.tex             |  2 ++
 67 files changed, 131 insertions(+), 6 deletions(-)

[...]

#4 lore raw

v3 cover Enable SyncTeX forward (.tex -> .pdf) search

In reply to a message not in the archive

Hi Paul,

Here is another attempt to enable SyncTeX forward search in perfbook.

This time, perfbook.synctex.gz will be generated only if you set the environment variable LATEX_OPT=-synctex=1. The behavior is not changed from current master.

I said in my reply to v2:

... this change does have regression in that the inverse search (PDF -> .tex) stops working other than perfbook.pdf.

It tuned out this was my misconception. Inverse search works from other than perfbook.pdf with the "% mainfile: ...perfbook.tex" lines added to sub .tex files.

So, patch #1 adds the "mainfile:" tags (pointing perfbook.tex) in sub .tex files.
Patch #2 adds a script to retarget the destination of forward search by modifying the "mainfile:" tags. It does nothing when LATEX_OPT has no "synctex" setting. For the details of the script, please refer to the update of FAQ-BUILD.txt in patch #4.
Patch #3 adds "mainfile:" lines in extracted .tex files (qqz.tex, origpub.tex, and contrib.tex).
Patch #4 updates FAQ-BUILD.txt to mention SyncTeX support in perfbook.

Patches #5 and #6 update minor issues I noticed during the test of SyncTeX search with perfbook-1c.pdf.

I don't think gedit is your choice of editor, but SyncTeX surely helps in locating a particular .tex file you'd like to see.

Forward search is not complete in that it doesn't work in .fcv files. It looks like gedit's SyncTeX support is sensitive to suffix of .tex. I tried to add "mainfile" tags in .fcv files on the fly, but ended up in vain. Inverse search to .fcv files works as expected. There is a room of improvement to show where those .fcv files come from. I'll see what can be done.

Thanks, Akira
--
Akira Yokosawa (6):
treewide: Add '% mainfile:' tags in headers in sub .tex files Add synctex-forward.sh
Add output of '% mainfile: perfbook.tex' tags in extraction scripts
FAQ-BUILD: Mention how to enable SyncTeX support defer/rcuintro: Convert snippet to new scheme defer/rcuapi: Tweak horizontal spacing of wide tables in 1c layout

 FAQ-BUILD.txt                             | 39 ++++++++++
 SMPdesign/SMPdesign.tex                   |  2 +
 SMPdesign/beyond.tex                      |  4 +-
 SMPdesign/criteria.tex                    |  1 +
 SMPdesign/partexercises.tex               |  2 +
 advsync/advsync.tex                       |  2 +
 advsync/rcu.tex                           |  2 +
 advsync/rt.tex                            |  2 +
 appendix/ack/ack.tex                      |  1 +
 appendix/appendix.tex                     |  1 +
 appendix/questions/after.tex              |  2 +
 appendix/questions/concurrentparallel.tex |  1 +
 appendix/questions/questions.tex          |  1 +
 appendix/questions/time.tex               |  1 +
 appendix/styleguide/styleguide.tex        |  1 +
 appendix/toyrcu/toyrcu.tex                |  2 +
 appendix/whymb/whymemorybarriers.tex      |  2 +
 count/count.tex                           |  2 +
 cpu/cpu.tex                               |  1 +
 cpu/hwfreelunch.tex                       |  1 +
 cpu/overheads.tex                         |  1 +
 cpu/overview.tex                          |  2 +
 cpu/swdesign.tex                          |  1 +
 datastruct/datastruct.tex                 |  2 +
 debugging/debugging.tex                   |  2 +
 defer/defer.tex                           |  1 +
 defer/hazptr.tex                          |  1 +
 defer/rcu.tex                             |  3 +-
 defer/rcuapi.tex                          |  6 +-
 defer/rcuexercises.tex                    |  1 +
 defer/rcufundamental.tex                  |  2 +
 defer/rcuintro.tex                        | 58 +++++++--------
 defer/rcurelated.tex                      |  2 +
 defer/rcuusage.tex                        |  2 +
 defer/refcnt.tex                          |  2 +
 defer/seqlock.tex                         |  2 +
 defer/updates.tex                         |  3 +-
 defer/whichtochoose.tex                   |  1 +
 easy/easy.tex                             |  1 +
 formal/axiomatic.tex                      |  2 +
 formal/dyntickrcu.tex                     |  2 +
 formal/formal.tex                         |  1 +
 formal/ppcmem.tex                         |  4 +-
 formal/sat.tex                            |  1 +
 formal/spinhint.tex                       |  2 +
 formal/stateless.tex                      |  1 +
 future/cpu.tex                            |  1 +
 future/formalregress.tex                  |  1 +
 future/future.tex                         |  1 +
 future/htm.tex                            |  2 +
 future/tm.tex                             |  2 +
 glossary.tex                              |  1 +
 howto/howto.tex                           |  2 +
 intro/intro.tex                           |  1 +
 legal.tex                                 |  1 +
 locking/locking-existence.tex             |  4 +-
 locking/locking.tex                       |  2 +
 memalloc/memalloc.tex                     |  1 +
 memorder/memorder.tex                     |  2 +
 owned/owned.tex                           |  2 +
 together/applyrcu.tex                     |  2 +
 together/count.tex                        |  1 +
 together/hash.tex                         |  1 +
 together/refcnt.tex                       |  2 +
 together/together.tex                     |  1 +
 toolsoftrade/toolsoftrade.tex             |  2 +
 utilities/extractcontrib.sh               |  1 +
 utilities/extractorigpub.sh               |  1 +
 utilities/extractqqz.sh                   |  1 +
 utilities/synctex-forward.sh              | 91 +++++++++++++++++++++++
 70 files changed, 266 insertions(+), 36 deletions(-)
 create mode 100755 utilities/synctex-forward.sh
Signature · 1 line
2.17.1
#5 lore raw

PATCH v3 1/6 treewide: Add '% mainfile:' tags in headers in sub .tex files

From f27c8e9ab71a7f6a6f12ac21e2469d26330de36c Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 19 Oct 2019 20:44:40 +0900
Subject: [PATCH v3 1/6] treewide: Add '% mainfile:' tags in headers in sub .tex files

These tags enable SyncTeX forward search from gedit to evince. Also fill in missing sub-directory names and SPDX License Identifiers.

---
 SMPdesign/SMPdesign.tex                   | 2 ++
 SMPdesign/beyond.tex                      | 4 +++-
 SMPdesign/criteria.tex                    | 1 +
 SMPdesign/partexercises.tex               | 2 ++
 advsync/advsync.tex                       | 2 ++
 advsync/rcu.tex                           | 2 ++
 advsync/rt.tex                            | 2 ++
 appendix/ack/ack.tex                      | 1 +
 appendix/appendix.tex                     | 1 +
 appendix/questions/after.tex              | 2 ++
 appendix/questions/concurrentparallel.tex | 1 +
 appendix/questions/questions.tex          | 1 +
 appendix/questions/time.tex               | 1 +
 appendix/styleguide/styleguide.tex        | 1 +
 appendix/toyrcu/toyrcu.tex                | 2 ++
 appendix/whymb/whymemorybarriers.tex      | 2 ++
 count/count.tex                           | 2 ++
 cpu/cpu.tex                               | 1 +
 cpu/hwfreelunch.tex                       | 1 +
 cpu/overheads.tex                         | 1 +
 cpu/overview.tex                          | 2 ++
 cpu/swdesign.tex                          | 1 +
 datastruct/datastruct.tex                 | 2 ++
 debugging/debugging.tex                   | 2 ++
 defer/defer.tex                           | 1 +
 defer/hazptr.tex                          | 1 +
 defer/rcu.tex                             | 3 ++-
 defer/rcuapi.tex                          | 2 ++
 defer/rcuexercises.tex                    | 1 +
 defer/rcufundamental.tex                  | 2 ++
 defer/rcuintro.tex                        | 2 ++
 defer/rcurelated.tex                      | 2 ++
 defer/rcuusage.tex                        | 2 ++
 defer/refcnt.tex                          | 2 ++
 defer/seqlock.tex                         | 2 ++
 defer/updates.tex                         | 3 ++-
 defer/whichtochoose.tex                   | 1 +
 easy/easy.tex                             | 1 +
 formal/axiomatic.tex                      | 2 ++
 formal/dyntickrcu.tex                     | 2 ++
 formal/formal.tex                         | 1 +
 formal/ppcmem.tex                         | 4 +++-
 formal/sat.tex                            | 1 +
 formal/spinhint.tex                       | 2 ++
 formal/stateless.tex                      | 1 +
 future/cpu.tex                            | 1 +
 future/formalregress.tex                  | 1 +
 future/future.tex                         | 1 +
 future/htm.tex                            | 2 ++
 future/tm.tex                             | 2 ++
 glossary.tex                              | 1 +
 howto/howto.tex                           | 2 ++
 intro/intro.tex                           | 1 +
 legal.tex                                 | 1 +
 locking/locking-existence.tex             | 4 +++-
 locking/locking.tex                       | 2 ++
 memalloc/memalloc.tex                     | 1 +
 memorder/memorder.tex                     | 2 ++
 owned/owned.tex                           | 2 ++
 together/applyrcu.tex                     | 2 ++
 together/count.tex                        | 1 +
 together/hash.tex                         | 1 +
 together/refcnt.tex                       | 2 ++
 together/together.tex                     | 1 +
 toolsoftrade/toolsoftrade.tex             | 2 ++
 65 files changed, 104 insertions(+), 5 deletions(-)
SMPdesign/SMPdesign.tex +2 -0
index 045cd50e..0d351678 100644
@@ -1,4 +1,6 @@
 % SMPdesign/SMPdesign.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{cha:Partitioning and Synchronization Design}{Partitioning and Synchronization Design}
 %
SMPdesign/beyond.tex +3 -1
index 40968c5a..0c0f9cb5 100644
@@ -1,4 +1,6 @@
-% beyond.tex
+% SMPdesign/beyond.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Beyond Partitioning}
 \label{sec:SMPdesign:Beyond Partitioning}
SMPdesign/criteria.tex +1 -0
index 0b8f4a96..56657fca 100644
@@ -1,4 +1,5 @@
 % SMPdesign/criteria.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Design Criteria}
SMPdesign/partexercises.tex +2 -0
index e56f8eeb..5ac0ac30 100644
@@ -1,4 +1,6 @@
 % SMPdesign/partexercises.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Partitioning Exercises}
 \label{sec:SMPdesign:Partitioning Exercises}
advsync/advsync.tex +2 -0
index 304cf85b..f1a19ccc 100644
@@ -1,4 +1,6 @@
 % advsync/advsync.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{sec:advsync:Advanced Synchronization}{Advanced Synchronization}
 %
advsync/rcu.tex +2 -0
index ac5357ec..33335235 100644
@@ -1,4 +1,6 @@
 % advsync/rcu.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Read-Copy Update}
 \label{sec:advsync:Read-Copy Update}
advsync/rt.tex +2 -0
index 16f4d2ef..c55ad3dc 100644
@@ -1,4 +1,6 @@
 % advsync/rt.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Parallel Real-Time Computing}
 \label{sec:advsync:Parallel Real-Time Computing}
appendix/ack/ack.tex +1 -0
index de06eb38..3a84bb36 100644
@@ -1,4 +1,5 @@
 % appendix/ack/ack.tex
+% mainfile: ../../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \chapter{Credits}
appendix/appendix.tex +1 -0
index 7b0d5c76..bb73e813 100644
@@ -1,4 +1,5 @@
 % appendix/appendix.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \include{appendix/questions/questions}
appendix/questions/after.tex +2 -0
index 5e83fc43..c56621bd 100644
@@ -1,4 +1,6 @@
 % appendix/questions/after.tex
+% mainfile: ../../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{What Does ``After'' Mean?}
 \label{sec:app:questions:What Does ``After'' Mean?}
appendix/questions/concurrentparallel.tex +1 -0
index 76b3d8ae..d10f544d 100644
@@ -1,4 +1,5 @@
 % appendix/questions/concurrentparallel.tex
+% mainfile: ../../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{What is the Difference Between ``Concurrent'' and ``Parallel''?}
appendix/questions/questions.tex +1 -0
index 54d9df12..6d7dc5ff 100644
@@ -1,4 +1,5 @@
 % appendix/questions/questions.tex
+% mainfile: ../../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{cha:app:Important Questions}{Important Questions}
appendix/questions/time.tex +1 -0
index 017d44e0..39bdf9cc 100644
@@ -1,4 +1,5 @@
 % appendix/questions/time.tex
+% mainfile: ../../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{What Time Is It?}
appendix/styleguide/styleguide.tex +1 -0
index 1fdf6e11..91064b1e 100644
@@ -1,4 +1,5 @@
 % appendix/styleguide/styleguide.tex
+% mainfile: ../../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \chapter{Style Guide}
appendix/toyrcu/toyrcu.tex +2 -0
index 3bb1f1e4..7b53ebab 100644
@@ -1,4 +1,6 @@
 % appendix/toyrcu/toyrcu.tex
+% mainfile: ../../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:app:``Toy'' RCU Implementations}{``Toy'' RCU Implementations}
 
appendix/whymb/whymemorybarriers.tex +2 -0
index 803aebac..7d5e1f5c 100644
@@ -1,4 +1,6 @@
 % appendix/whymb/whymemorybarriers.tex
+% mainfile: ../../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:app:whymb:Why Memory Barriers?}{Why Memory Barriers?}
 
count/count.tex +2 -0
index 61a11f5e..484c69af 100644
@@ -1,4 +1,6 @@
 % count/count.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Counting}{Counting}
 %
cpu/cpu.tex +1 -0
index c3dd9fa7..401f7132 100644
@@ -1,4 +1,5 @@
 % cpu/cpu.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Hardware and its Habits}{Hardware and its Habits}
cpu/hwfreelunch.tex +1 -0
index ca814b48..e0be6e0e 100644
@@ -1,4 +1,5 @@
 % cpu/hwfreelunch.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Hardware Free Lunch?}
cpu/overheads.tex +1 -0
index dbe73bfc..99abee89 100644
@@ -1,4 +1,5 @@
 % cpu/overheads.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Overheads}
cpu/overview.tex +2 -0
index 73ed2909..12be1158 100644
@@ -1,4 +1,6 @@
 % cpu/overview.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Overview}
 \label{sec:cpu:Overview}
cpu/swdesign.tex +1 -0
index 869c0f25..3c127b61 100644
@@ -1,4 +1,5 @@
 % cpu/swdesign.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Software Design Implications}
datastruct/datastruct.tex +2 -0
index 2cb698b6..c4d0817d 100644
@@ -1,4 +1,6 @@
 % datastruct/datastruct.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Data Structures}{Data Structures}
 %
debugging/debugging.tex +2 -0
index fc5e16e3..20436845 100644
@@ -1,4 +1,6 @@
 % debugging/debugging.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Validation}{Validation}
 %
defer/defer.tex +1 -0
index e67e024f..8323de6b 100644
@@ -1,4 +1,5 @@
 % defer/defer.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Deferred Processing}{Deferred Processing}
defer/hazptr.tex +1 -0
index f384e804..8c9ac7e4 100644
@@ -1,4 +1,5 @@
 % defer/hazptr.tex
+% mainfile: ../perfbook.tex
 % From an C++ Standards Committee meeting:  "Can I hazptr cheezeberger?"
 
 \section{Hazard Pointers}
defer/rcu.tex +2 -1
index ac982aaa..d7b7418d 100644
@@ -1,4 +1,5 @@
-% rcu.tex
+% defer/rcu.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Read-Copy Update (RCU)}
defer/rcuapi.tex +2 -0
index ae0e3e2b..47bb2da2 100644
@@ -1,4 +1,6 @@
 % defer/rcuAPI.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \subsection{RCU Linux-Kernel API}
 \label{sec:defer:RCU Linux-Kernel API}
defer/rcuexercises.tex +1 -0
index c4592454..3dfa514e 100644
@@ -1,4 +1,5 @@
 % defer/rcuexercises.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \subsection{RCU Exercises}
defer/rcufundamental.tex +2 -0
index 3e341950..562333f4 100644
@@ -1,4 +1,6 @@
 % defer/rcufundamental.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \subsection{RCU Fundamentals}
 \label{sec:defer:RCU Fundamentals}
defer/rcuintro.tex +2 -0
index 5633818e..b9b9400e 100644
@@ -1,4 +1,6 @@
 % defer/rcuintro.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \subsection{Introduction to RCU}
 \label{sec:defer:Introduction to RCU}
defer/rcurelated.tex +2 -0
index 32fd3457..dba9000e 100644
@@ -1,4 +1,6 @@
 % defer/rcurelated.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \subsection{RCU Related Work}
 \label{sec:defer:RCU Related Work}
defer/rcuusage.tex +2 -0
index 16bf8603..9ccc0c92 100644
@@ -1,4 +1,6 @@
 % defer/rcuusage.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \subsection{RCU Usage}
 \label{sec:defer:RCU Usage}
defer/refcnt.tex +2 -0
index f3853897..91a2f346 100644
@@ -1,4 +1,6 @@
 % defer/refcnt.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Reference Counting}
 \label{sec:defer:Reference Counting}
defer/seqlock.tex +2 -0
index 6c48fd3b..0e9b74e8 100644
@@ -1,4 +1,6 @@
 % defer/seqlock.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Sequence Locks}
 \label{sec:defer:Sequence Locks}
defer/updates.tex +2 -1
index d3ab0f2f..df52d124 100644
@@ -1,4 +1,5 @@
-% updates.tex
+% defer/updates.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{What About Updates?}
defer/whichtochoose.tex +1 -0
index 15df46a3..5c54e6c8 100644
@@ -1,4 +1,5 @@
 % defer/whichtochoose.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Which to Choose?}
easy/easy.tex +1 -0
index daee76fb..aaf48d89 100644
@@ -1,4 +1,5 @@
 % easy/easy.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Ease of Use}{Ease of Use}
formal/axiomatic.tex +2 -0
index 230fa9ce..e681a84e 100644
@@ -1,4 +1,6 @@
 % formal/axiomatic.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Axiomatic Approaches}
 \label{sec:formal:Axiomatic Approaches}
formal/dyntickrcu.tex +2 -0
index 7f0c6ac2..c2b9569f 100644
@@ -1,4 +1,6 @@
 % formal/dyntickrcu.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 % Disable frame around VerbatimN in two-column layout
 \IfTwoColumn{
formal/formal.tex +1 -0
index 80ea5bd3..d0ea4bcb 100644
@@ -1,4 +1,5 @@
 % formal/formal.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Formal Verification}{Formal Verification}
formal/ppcmem.tex +3 -1
index 67b59572..2e9264fc 100644
@@ -1,4 +1,6 @@
-% ppcmem.tex
+% formal/ppcmem.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Special-Purpose State-Space Search}
 \label{sec:formal:Special-Purpose State-Space Search}
formal/sat.tex +1 -0
index 8cb00886..30d19746 100644
@@ -1,4 +1,5 @@
 % formal/sat.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{SAT Solvers}
formal/spinhint.tex +2 -0
index bae4ddaf..0356d1bf 100644
@@ -1,4 +1,6 @@
 % formal/spinhint.html
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{State-Space Search}
 \label{sec:formal:State-Space Search}
formal/stateless.tex +1 -0
index 62734c27..17c63e67 100644
@@ -1,4 +1,5 @@
 % formal/stateless.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Stateless Model Checkers}
future/cpu.tex +1 -0
index be97b68a..a503989c 100644
@@ -1,4 +1,5 @@
 % future/cpu.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{The Future of CPU Technology Ain't What it Used to Be}
future/formalregress.tex +1 -0
index b827a56c..7ce585e4 100644
@@ -1,4 +1,5 @@
 % future/formalregress.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Formal Regression Testing?}
future/future.tex +1 -0
index 7e256ac0..7c7f03c2 100644
@@ -1,4 +1,5 @@
 % future/future.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Conflicting Visions of the Future}{Conflicting Visions of the Future}
future/htm.tex +2 -0
index 03d8de1e..ca9d3bb0 100644
@@ -1,4 +1,6 @@
 % future/htm.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Hardware Transactional Memory}
 \label{sec:future:Hardware Transactional Memory}
future/tm.tex +2 -0
index 1a4f1b1b..a5081762 100644
@@ -1,4 +1,6 @@
 % future/tm.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Transactional Memory}
 \label{sec:future:Transactional Memory}
glossary.tex +1 -0
index 9bd40248..532c8a16 100644
@@ -1,4 +1,5 @@
 % glossary.tex
+% mainfile: perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \chapter{Glossary and Bibliography}
howto/howto.tex +2 -0
index 3bdec595..bbdacbf1 100644
@@ -1,4 +1,6 @@
 % howto/howto.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:How To Use This Book}{How To Use This Book}
 %
intro/intro.tex +1 -0
index 5eb6976a..5cde0b6b 100644
@@ -1,4 +1,5 @@
 % intro/intro.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Introduction}{Introduction}
legal.tex +1 -0
index d589d31e..7c827795 100644
@@ -1,4 +1,5 @@
 % legal.tex
+% mainfile: perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section*{Legal Statement}
locking/locking-existence.tex +3 -1
index 0be581a2..294e5176 100644
@@ -1,4 +1,6 @@
-% locking-existence.tex
+% locking/locking-existence.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Lock-Based Existence Guarantees}
 \label{sec:locking:Lock-Based Existence Guarantees}
locking/locking.tex +2 -0
index c069b458..c088d051 100644
@@ -1,4 +1,6 @@
 % locking/locking.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Locking}{Locking}
 %
memalloc/memalloc.tex +1 -0
index dfbb14a0..efd2776b 100644
@@ -1,4 +1,5 @@
 % memalloc/memalloc.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \chapter{Memory Allocation}
memorder/memorder.tex +2 -0
index c686beb9..ffb8c796 100644
@@ -1,4 +1,6 @@
 % memorder/memorder.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Advanced Synchronization: Memory Ordering}{Advanced Synchronization: Memory Ordering}
 \OriginallyPublished{Chapter}{chp:Advanced Synchronization: Memory Ordering}{Advanced Synchronization: Memory Ordering}{the Linux kernel}{Howells2009membartxt}
owned/owned.tex +2 -0
index 989fc067..6960f68e 100644
@@ -1,4 +1,6 @@
 % owned/owned.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Data Ownership}{Data Ownership}
 %
together/applyrcu.tex +2 -0
index 9cb733bf..6f5c04dc 100644
@@ -1,4 +1,6 @@
 % together/applyrcu.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{RCU Rescues}
 \label{sec:together:RCU Rescues}
together/count.tex +1 -0
index 50766cad..0374d396 100644
@@ -1,4 +1,5 @@
 % together/count.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Counter Conundrums}
together/hash.tex +1 -0
index d98f0ec3..e3ca7f81 100644
@@ -1,4 +1,5 @@
 % together/hash.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Hashing Hassles}
together/refcnt.tex +2 -0
index aaecad4e..26e053a3 100644
@@ -1,4 +1,6 @@
 % together/refcnt.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \section{Refurbish Reference Counting}
 \label{sec:together:Refurbish Reference Counting}
together/together.tex +1 -0
index 81475678..88eb9568 100644
@@ -1,4 +1,5 @@
 % together/together.tex
+% mainfile: ../perfbook.tex
 % SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Putting It All Together}{Putting It All Together}
toolsoftrade/toolsoftrade.tex +2 -0
index 1c755d48..b4c1e044 100644
@@ -1,4 +1,6 @@
 % toolsoftrade/toolsoftrade.tex
+% mainfile: ../perfbook.tex
+% SPDX-License-Identifier: CC-BY-SA-3.0
 
 \QuickQuizChapter{chp:Tools of the Trade}{Tools of the Trade}
 %
Signature · 1 line
2.17.1
#6 lore raw

PATCH v3 2/6 Add synctex-forward.sh

In reply to Akira Yokosawa

From 967beab61d94f966c06f245b9c22e1e702d6c785 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 20 Oct 2019 00:51:00 +0900
Subject: [PATCH v3 2/6] Add synctex-forward.sh

This script sets up "% mainfile:" tags in sub .tex files with a suitable "perfbook-xx.tex" file name.
They enable SyncTeX forward search to perfbook-xx.pdf.

---
 utilities/synctex-forward.sh | 89 ++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100755 utilities/synctex-forward.sh
utilities/synctex-forward.sh new file +89 -0
new file mode 100755
index 00000000..312f9cc3
@@ -0,0 +1,89 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Set "% mainfile:" lines with proper "% mainfile: <...>" tags in
+# sub .tex files.
+#
+# With no argument, the main file will be "perfbook.tex",
+# which will do nothing by default.
+# With abbrev target such as "1c", "hb", and so on, the main file
+# will be "perfbook-1c.tex", perfbook-hb.tex", and so on.
+#
+# Depth of subdirectory is deduced from the path of each sub .tex file.
+#
+# Changes made by this script can be reverted by running without
+# argument.
+#
+# WARNING: By runnig this script, your working tree will be modified.
+# It is highly recommented to commit your changes before running
+# this script.
+
+# If LATEX_OPT does not have "synctex", do nothing
+if ! echo $LATEX_OPT | grep -q synctex ; then
+	echo "LATEX_OPT has no synctex option. Exiting..."
+	exit 1
+fi
+
+# warn if git status is not clean later
+gitstatus=`git status --porcelain | wc -l`
+if [ $gitstatus != "0" ] ; then
+	wasnotclean=1
+else
+	wasnotclean=0
+fi
+
+if [ $# -eq 0 ] ; then
+	main="perfbook.tex"
+	change="reverted"
+else
+	case $1 in
+	2c)
+		main="perfbook.tex"
+		change="reverted"
+		;;
+	1c|hb|tcb|msnt|mstx|msr|msn|1csf|msns|mss)
+		main="perfbook-$1.tex"
+		change="modified"
+		;;
+	*)
+		echo "Unknown target!!"
+		exit 1
+		;;
+	esac
+fi
+
+tmpf=`mktemp`
+texfiles=`find . -name '*.tex' -print`
+modified=0
+for i in $texfiles
+do
+	c=$(expr `echo $i | grep -o "/" | wc -l` - 1)
+	x=
+	for j in $(seq 1 $c)
+	do
+		x=..\\/$x
+	done
+	mainpath=$x$main
+	pattern="s/% mainfile: .*perfbook.*\.tex/% mainfile: $mainpath/"
+	cat $i | sed -e "$pattern" > $tmpf
+	if ! diff -q $i $tmpf >/dev/null ; then
+		echo "$i $change."
+		cp -f $tmpf $i
+		modified=1
+	fi
+done
+
+if [ $modified -eq 0 ] ; then
+	echo "No modification."
+else
+	if [ $main != "perfbook.tex" -a $wasnotclean -eq 1 ] ; then
+		echo "### Git status was not clean."
+		echo "### To revert the changes, just run '$0'."
+	fi
+fi
+
+# check if synctex database exists
+mainbase="${main%.tex}"
+if [ `ls -1 perfbook* | grep -c $mainbase.synctex` -eq 0 ] ; then
+	echo "### $mainbase.synctex*: file not found."
+fi
Signature · 1 line
2.17.1
#7 lore raw

PATCH v3 3/6 Add output of '% mainfile: perfbook.tex' tags in extraction scripts

In reply to Akira Yokosawa

From 448d26cb10c9e31408431762302e299d655f7521 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 20 Oct 2019 14:09:21 +0900
Subject: [PATCH v3 3/6] Add output of '% mainfile: perfbook.tex' tags in extraction scripts

---
 utilities/extractcontrib.sh | 1 +
 utilities/extractorigpub.sh | 1 +
 utilities/extractqqz.sh     | 1 +
 3 files changed, 3 insertions(+)
utilities/extractcontrib.sh +1 -0
index ae978ea0..8fc4b681 100644
@@ -22,5 +22,6 @@
 #
 # Authors: Paul E. McKenney <[email protected]>
 
+echo "% mainfile: perfbook.tex"
 sed -n -e '/^\\ContributedBy{/p' |
 sed -e 's/^\\ContributedBy{/\\ContribItem{/'
utilities/extractorigpub.sh +1 -0
index 1fad230c..71154f96 100644
@@ -22,6 +22,7 @@
 #
 # Authors: Paul E. McKenney <[email protected]>
 
+echo "% mainfile: perfbook.tex"
 sed -n -e '/^\\OriginallyPublished{/p' \
        -e '/^\\RangeOriginallyPublished{/p' |
 sed -e 's/^\\OriginallyPublished{/\\OrigPubItem{/' \
utilities/extractqqz.sh +1 -0
index 921c78e8..5d54d31f 100644
@@ -21,6 +21,7 @@
 #
 # Authors: Paul E. McKenney <[email protected]>
 
+echo "% mainfile: perfbook.tex"
 sed -n -e '/^\\QuickQuizChapter{/p' \
        -e '/^\\QuickQuiz{/,/^} \\QuickQuizEnd/p' |
 sed -e 's/^\\QuickQuizChapter{/\\QuickQAC{/' \
Signature · 1 line
2.17.1
#8 lore raw

PATCH v3 4/6 FAQ-BUILD: Mention how to enable SyncTeX support

In reply to Akira Yokosawa

From b24d7992fef7dd5534b24465a4129071dcc5b556 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 20 Oct 2019 14:11:31 +0900
Subject: [PATCH v3 4/6] FAQ-BUILD: Mention how to enable SyncTeX support

---
 FAQ-BUILD.txt                | 39 ++++++++++++++++++++++++++++++++++++
 utilities/synctex-forward.sh |  2 ++
 2 files changed, 41 insertions(+)
FAQ-BUILD.txt +39 -0
index b3f04e67..4cab43b0 100644
@@ -159,3 +159,42 @@
 
 	    2.	Install it by following instructions at:
 		https://help.ubuntu.com/community/LaTeX#Installing_packages_manually
+
+11.	Is it possible to generate SyncTeX database file?
+
+	A.	Yes, it is. Setting an environment variable:
+
+		    $ export LATEX_OPT="-synctex=1"
+
+		and doing "make clean; make" will generate
+		perfbook.synctex.gz. This will enable SyncTeX search
+		(.pdf <-> .tex) with a SyncTeX-supporting combination of
+		pdf viewer and editor.
+
+	    Notes:
+	      -	For an introduction of SyncTeX search (gedit <-> evince), see:
+
+		    https://help.gnome.org/users/evince/stable/index.html.en#synctex
+
+		Other combinations of SyncTeX-supporting viewers and editors
+		may work.
+
+	      - You need to install gedit-plugins and enable SyncTeX plugin
+		in gedit's preference.
+
+	      - You need to open one of LaTeX sources (e.g. perfbook.tex)
+		in gedit before doing inverse search from evince.
+
+	      - The environment variable LATEX_OPT works for other build
+		targets such as perfbook-1c.pdf, perfbook-hb.pdf, etc.
+		To enable forward search from gedit, run e.g.:
+
+		    $ utilities/synctex-forward.sh 1c
+
+	      - Changes made by utilities/synctex-forward.sh can be
+		reverted by running:
+
+		    $ utilitied/synctex-forward.sh
+
+		Please make sure to revert the changes before doing
+		"git commit" of the other updates you've made.
utilities/synctex-forward.sh +2 -0
index 312f9cc3..e08d87fa 100755
@@ -21,6 +21,7 @@
 # If LATEX_OPT does not have "synctex", do nothing
 if ! echo $LATEX_OPT | grep -q synctex ; then
 	echo "LATEX_OPT has no synctex option. Exiting..."
+	echo "See #11 in FAQ-BUILD.txt for SyncTeX support."
 	exit 1
 fi
 
@@ -86,4 +87,5 @@ fi
 mainbase="${main%.tex}"
 if [ `ls -1 perfbook* | grep -c $mainbase.synctex` -eq 0 ] ; then
 	echo "### $mainbase.synctex*: file not found."
+	echo "### See #11 in FAQ-BUILD.txt for how to generate one."
 fi
Signature · 1 line
2.17.1
#9 lore raw

PATCH v3 5/6 defer/rcuintro: Convert snippet to new scheme

In reply to Akira Yokosawa

From f4ecbf9683111d67e70fc32bfed737ac556bfaf5 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 22 Oct 2019 12:53:00 +0900
Subject: [PATCH v3 5/6] defer/rcuintro: Convert snippet to new scheme

This snippet was added using the verbatimbox scheme. Convert it using VerbatimL.

---
 defer/rcuintro.tex | 56 ++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 29 deletions(-)
defer/rcuintro.tex +27 -29
index b9b9400e..000c61a7 100644
@@ -370,49 +370,47 @@ has executed a context switch, which in turn guarantees that
 all pre-existing reader threads have completed.
 
 \begin{listing}[tbp]
-{ \scriptsize
-\begin{verbbox}[\LstLineNo]
+\begin{linelabel}[ln:defer:Insertion and Deletion With Concurrent Readers]
+\begin{VerbatimL}[commandchars=\\\[\]]
 struct route *gptr;
 
 int access_route(int (*f)(struct route *rp))
 {
-  int ret = -1;
-  struct route *rp;
-
-  rcu_read_lock();
-  rp = rcu_dereference(gptr);
-  if (rp)
-  	ret = f(rp);
-  rcu_read_unlock();
-  return ret;
+	int ret = -1;
+	struct route *rp;
+
+	rcu_read_lock();
+	rp = rcu_dereference(gptr);
+	if (rp)
+		ret = f(rp);
+	rcu_read_unlock();
+	return ret;
 }
 
 struct route *ins_route(struct route *rp)
 {
-  struct route *old_rp;
+	struct route *old_rp;
 
-  spin_lock(&route_lock);
-  old_rp = gptr;
-  rcu_assign_pointer(gptr, rp);
-  spin_unlock(&route_lock);
+	spin_lock(&route_lock);
+	old_rp = gptr;
+	rcu_assign_pointer(gptr, rp);
+	spin_unlock(&route_lock);
 }
 
 int del_route(void)
 {
-  struct route *old_rp;
-
-  spin_lock(&route_lock);
-  old_rp = gptr;
-  RCU_INIT_POINTER(gptr, NULL);
-  spin_unlock(&route_lock);
-  synchronize_rcu();
-  free(old_rp);
-  return !!old_rp;
+	struct route *old_rp;
+
+	spin_lock(&route_lock);
+	old_rp = gptr;
+	RCU_INIT_POINTER(gptr, NULL);
+	spin_unlock(&route_lock);
+	synchronize_rcu();
+	free(old_rp);
+	return !!old_rp;
 }
-\end{verbbox}
-}
-\centering
-\theverbbox
+\end{VerbatimL}
+\end{linelabel}
 \caption{Insertion and Deletion With Concurrent Readers}
 \label{lst:defer:Insertion and Deletion With Concurrent Readers}
 \end{listing}
Signature · 1 line
2.17.1
#10 lore raw

PATCH v3 6/6 defer/rcuapi: Tweak horizontal spacing of wide tables in 1c layout

In reply to Akira Yokosawa

From cdc88c7afb93f5c9c867b474e3be14d8e9161657 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 22 Oct 2019 12:57:05 +0900
Subject: [PATCH v3 6/6] defer/rcuapi: Tweak horizontal spacing of wide tables in 1c layout

---
 defer/rcuapi.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
defer/rcuapi.tex +2 -2
index 47bb2da2..1c9d0365 100644
@@ -26,7 +26,7 @@ presents concluding remarks.
 \centering
 \caption{RCU Wait-to-Finish APIs}
 \label{tab:defer:RCU Wait-to-Finish APIs}
-\footnotesize
+\footnotesize\OneColumnHSpace{-.9in}
 \begin{tabularx}{6.5in}{>{\raggedright\arraybackslash}p{1.08in}
     >{\raggedright\arraybackslash}X
     >{\raggedright\arraybackslash}X
@@ -423,7 +423,7 @@ that Linux supports~\cite{Spraul01}.
 \begin{table*}[tb]
 \renewcommand*{\arraystretch}{1.15}
 \footnotesize
-\centering
+\centering\OneColumnHSpace{-.4in}
 \begin{tabular}{llp{2.2in}}
 \toprule
 Category &
Signature · 1 line
2.17.1
#11 lore raw

Re: [PATCH v3 0/6] Enable SyncTeX forward (.tex -> .pdf) search

In reply to Akira Yokosawa
Quoted 41 lines · Akira Yokosawa

Hi Paul,

Here is another attempt to enable SyncTeX forward search in perfbook.

This time, perfbook.synctex.gz will be generated only if you set the environment variable LATEX_OPT=-synctex=1. The behavior is not changed from current master.

I said in my reply to v2:

... this change does have regression in that the inverse search (PDF -> .tex) stops working other than perfbook.pdf.

It tuned out this was my misconception. Inverse search works from other than perfbook.pdf with the "% mainfile: ...perfbook.tex" lines added to sub .tex files.

So, patch #1 adds the "mainfile:" tags (pointing perfbook.tex) in sub .tex files.
Patch #2 adds a script to retarget the destination of forward search by modifying the "mainfile:" tags. It does nothing when LATEX_OPT has no "synctex" setting. For the details of the script, please refer to the update of FAQ-BUILD.txt in patch #4.
Patch #3 adds "mainfile:" lines in extracted .tex files (qqz.tex, origpub.tex, and contrib.tex).
Patch #4 updates FAQ-BUILD.txt to mention SyncTeX support in perfbook.

Patches #5 and #6 update minor issues I noticed during the test of SyncTeX search with perfbook-1c.pdf.

I don't think gedit is your choice of editor, but SyncTeX surely helps in locating a particular .tex file you'd like to see.

Forward search is not complete in that it doesn't work in .fcv files. It looks like gedit's SyncTeX support is sensitive to suffix of .tex. I tried to add "mainfile" tags in .fcv files on the fly, but ended up in vain. Inverse search to .fcv files works as expected. There is a room of improvement to show where those .fcv files come from. I'll see what can be done.

Quoted 8 lines

Thanks, Akira
--
Akira Yokosawa (6):
treewide: Add '% mainfile:' tags in headers in sub .tex files Add synctex-forward.sh
Add output of '% mainfile: perfbook.tex' tags in extraction scripts
FAQ-BUILD: Mention how to enable SyncTeX support defer/rcuintro: Convert snippet to new scheme

Very nice, applied and queued, thank you!

With the exception of defer/rcuintro.tex, which collided with one of my cleanups. I believe that the fix is straightforward, just accounting for the line I added, but I figured that I should check.

Thanx, Paul

Quoted 79 lines

defer/rcuapi: Tweak horizontal spacing of wide tables in 1c layout

 FAQ-BUILD.txt                             | 39 ++++++++++
 SMPdesign/SMPdesign.tex                   |  2 +
 SMPdesign/beyond.tex                      |  4 +-
 SMPdesign/criteria.tex                    |  1 +
 SMPdesign/partexercises.tex               |  2 +
 advsync/advsync.tex                       |  2 +
 advsync/rcu.tex                           |  2 +
 advsync/rt.tex                            |  2 +
 appendix/ack/ack.tex                      |  1 +
 appendix/appendix.tex                     |  1 +
 appendix/questions/after.tex              |  2 +
 appendix/questions/concurrentparallel.tex |  1 +
 appendix/questions/questions.tex          |  1 +
 appendix/questions/time.tex               |  1 +
 appendix/styleguide/styleguide.tex        |  1 +
 appendix/toyrcu/toyrcu.tex                |  2 +
 appendix/whymb/whymemorybarriers.tex      |  2 +
 count/count.tex                           |  2 +
 cpu/cpu.tex                               |  1 +
 cpu/hwfreelunch.tex                       |  1 +
 cpu/overheads.tex                         |  1 +
 cpu/overview.tex                          |  2 +
 cpu/swdesign.tex                          |  1 +
 datastruct/datastruct.tex                 |  2 +
 debugging/debugging.tex                   |  2 +
 defer/defer.tex                           |  1 +
 defer/hazptr.tex                          |  1 +
 defer/rcu.tex                             |  3 +-
 defer/rcuapi.tex                          |  6 +-
 defer/rcuexercises.tex                    |  1 +
 defer/rcufundamental.tex                  |  2 +
 defer/rcuintro.tex                        | 58 +++++++--------
 defer/rcurelated.tex                      |  2 +
 defer/rcuusage.tex                        |  2 +
 defer/refcnt.tex                          |  2 +
 defer/seqlock.tex                         |  2 +
 defer/updates.tex                         |  3 +-
 defer/whichtochoose.tex                   |  1 +
 easy/easy.tex                             |  1 +
 formal/axiomatic.tex                      |  2 +
 formal/dyntickrcu.tex                     |  2 +
 formal/formal.tex                         |  1 +
 formal/ppcmem.tex                         |  4 +-
 formal/sat.tex                            |  1 +
 formal/spinhint.tex                       |  2 +
 formal/stateless.tex                      |  1 +
 future/cpu.tex                            |  1 +
 future/formalregress.tex                  |  1 +
 future/future.tex                         |  1 +
 future/htm.tex                            |  2 +
 future/tm.tex                             |  2 +
 glossary.tex                              |  1 +
 howto/howto.tex                           |  2 +
 intro/intro.tex                           |  1 +
 legal.tex                                 |  1 +
 locking/locking-existence.tex             |  4 +-
 locking/locking.tex                       |  2 +
 memalloc/memalloc.tex                     |  1 +
 memorder/memorder.tex                     |  2 +
 owned/owned.tex                           |  2 +
 together/applyrcu.tex                     |  2 +
 together/count.tex                        |  1 +
 together/hash.tex                         |  1 +
 together/refcnt.tex                       |  2 +
 together/together.tex                     |  1 +
 toolsoftrade/toolsoftrade.tex             |  2 +
 utilities/extractcontrib.sh               |  1 +
 utilities/extractorigpub.sh               |  1 +
 utilities/extractqqz.sh                   |  1 +
 utilities/synctex-forward.sh              | 91 +++++++++++++++++++++++
 70 files changed, 266 insertions(+), 36 deletions(-)
 create mode 100755 utilities/synctex-forward.sh
Signature · 1 line
2.17.1
#12 lore raw

PATCH v4 5/6 defer/rcuintro: Convert snippet to new scheme

From 6a9e5e96a0dd94b6f20052ab741d2606e79dc80f Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Tue, 22 Oct 2019 23:23:42 +0900
Subject: [PATCH v4 5/6] defer/rcuintro: Convert snippet to new scheme

This snippet was added using the verbatimbox scheme. Convert it using VerbatimL.

---
Hi Paul,

Quoted 3 lines

With the exception of defer/rcuintro.tex, which collided with one of my cleanups. I believe that the fix is straightforward, just accounting for the line I added, but I figured that I should check.

FWIW, this is the result of my rebase of the patch.

Thanks, Akira

Quoted 2 lines

Thanx, Paul

--

 defer/rcuintro.tex | 58 ++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 30 deletions(-)
defer/rcuintro.tex +28 -30
index ed7ff0b0..dc750326 100644
@@ -375,50 +375,48 @@ has executed a context switch, which in turn guarantees that
 all pre-existing reader threads have completed.
 
 \begin{listing}[tbp]
-{ \scriptsize
-\begin{verbbox}[\LstLineNo]
+\begin{linelabel}[ln:defer:Insertion and Deletion With Concurrent Readers]
+\begin{VerbatimL}[commandchars=\\\[\]]
 struct route *gptr;
 
 int access_route(int (*f)(struct route *rp))
 {
-  int ret = -1;
-  struct route *rp;
-
-  rcu_read_lock();
-  rp = rcu_dereference(gptr);
-  if (rp)
-  	ret = f(rp);
-  rcu_read_unlock();
-  return ret;
+	int ret = -1;
+	struct route *rp;
+
+	rcu_read_lock();
+	rp = rcu_dereference(gptr);
+	if (rp)
+		ret = f(rp);
+	rcu_read_unlock();
+	return ret;
 }
 
 struct route *ins_route(struct route *rp)
 {
-  struct route *old_rp;
+	struct route *old_rp;
 
-  spin_lock(&route_lock);
-  old_rp = gptr;
-  rcu_assign_pointer(gptr, rp);
-  spin_unlock(&route_lock);
-  return old_rp;
+	spin_lock(&route_lock);
+	old_rp = gptr;
+	rcu_assign_pointer(gptr, rp);
+	spin_unlock(&route_lock);
+	return old_rp;
 }
 
 int del_route(void)
 {
-  struct route *old_rp;
-
-  spin_lock(&route_lock);
-  old_rp = gptr;
-  RCU_INIT_POINTER(gptr, NULL);
-  spin_unlock(&route_lock);
-  synchronize_rcu();
-  free(old_rp);
-  return !!old_rp;
+	struct route *old_rp;
+
+	spin_lock(&route_lock);
+	old_rp = gptr;
+	RCU_INIT_POINTER(gptr, NULL);
+	spin_unlock(&route_lock);
+	synchronize_rcu();
+	free(old_rp);
+	return !!old_rp;
 }
-\end{verbbox}
-}
-\centering
-\theverbbox
+\end{VerbatimL}
+\end{linelabel}
 \caption{Insertion and Deletion With Concurrent Readers}
 \label{lst:defer:Insertion and Deletion With Concurrent Readers}
 \end{listing}
Signature · 1 line
2.17.1
#13 lore raw

Re: [PATCH v4 5/6] defer/rcuintro: Convert snippet to new scheme

Quoted 9 lines · Akira Yokosawa
Quoted 1 line

From 6a9e5e96a0dd94b6f20052ab741d2606e79dc80f Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Tue, 22 Oct 2019 23:23:42 +0900
Subject: [PATCH v4 5/6] defer/rcuintro: Convert snippet to new scheme

This snippet was added using the verbatimbox scheme. Convert it using VerbatimL.

Quoted 8 lines

---
Hi Paul,

Quoted 3 lines

With the exception of defer/rcuintro.tex, which collided with one of my cleanups. I believe that the fix is straightforward, just accounting for the line I added, but I figured that I should check.

FWIW, this is the result of my rebase of the patch.

Queued and pushed, thank you!

Thanx, Paul

Quoted 95 lines

Thanks, Akira

Quoted 2 lines

Thanx, Paul

--

 defer/rcuintro.tex | 58 ++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 30 deletions(-)
defer/rcuintro.tex +28 -30
index ed7ff0b0..dc750326 100644
@@ -375,50 +375,48 @@ has executed a context switch, which in turn guarantees that
 all pre-existing reader threads have completed.
 
 \begin{listing}[tbp]
-{ \scriptsize
-\begin{verbbox}[\LstLineNo]
+\begin{linelabel}[ln:defer:Insertion and Deletion With Concurrent Readers]
+\begin{VerbatimL}[commandchars=\\\[\]]
 struct route *gptr;
 
 int access_route(int (*f)(struct route *rp))
 {
-  int ret = -1;
-  struct route *rp;
-
-  rcu_read_lock();
-  rp = rcu_dereference(gptr);
-  if (rp)
-  	ret = f(rp);
-  rcu_read_unlock();
-  return ret;
+	int ret = -1;
+	struct route *rp;
+
+	rcu_read_lock();
+	rp = rcu_dereference(gptr);
+	if (rp)
+		ret = f(rp);
+	rcu_read_unlock();
+	return ret;
 }
 
 struct route *ins_route(struct route *rp)
 {
-  struct route *old_rp;
+	struct route *old_rp;
 
-  spin_lock(&route_lock);
-  old_rp = gptr;
-  rcu_assign_pointer(gptr, rp);
-  spin_unlock(&route_lock);
-  return old_rp;
+	spin_lock(&route_lock);
+	old_rp = gptr;
+	rcu_assign_pointer(gptr, rp);
+	spin_unlock(&route_lock);
+	return old_rp;
 }
 
 int del_route(void)
 {
-  struct route *old_rp;
-
-  spin_lock(&route_lock);
-  old_rp = gptr;
-  RCU_INIT_POINTER(gptr, NULL);
-  spin_unlock(&route_lock);
-  synchronize_rcu();
-  free(old_rp);
-  return !!old_rp;
+	struct route *old_rp;
+
+	spin_lock(&route_lock);
+	old_rp = gptr;
+	RCU_INIT_POINTER(gptr, NULL);
+	spin_unlock(&route_lock);
+	synchronize_rcu();
+	free(old_rp);
+	return !!old_rp;
 }
-\end{verbbox}
-}
-\centering
-\theverbbox
+\end{VerbatimL}
+\end{linelabel}
 \caption{Insertion and Deletion With Concurrent Readers}
 \label{lst:defer:Insertion and Deletion With Concurrent Readers}
 \end{listing}
Signature · 1 line
2.17.1