Fix lack of locking in file system code (!).
[pintos-anon] / TODO
1 -*- text -*-
2
3 * Bochs is not fully reproducible.
4
5 Godmar says:
6
7 - In Project 2, we're missing tests that pass arguments to system calls
8 that span multiple pages, where some are mapped and some are not. 
9 An implementation that only checks the first page, rather than all pages 
10 that can be touched during a call to read()/write() passes all tests.
11
12 - In Project 2, we're missing a test that would fail if they assumed
13 that contiguous user-virtual addresses are laid out contiguously 
14 in memory.  The loading code should ensure that non-contiguous 
15 physical pages are allocated for the data segment (at least.)
16
17 - Need some tests that test that illegal accesses lead to process
18 termination. I have written some, will add them. In P2, obviously, 
19 this would require that the students break this functionality since 
20 the page directory is initialized for them, still it would be good 
21 to have.
22
23 - There does not appear to be a test that checks that they close all
24 fd's on exit.  Idea: add statistics & self-diagnostics code to palloc.c
25 and malloc.c.  Self-diagnostics code could be used for debugging.
26 The statistics code would report how much kernel memory is free.
27 Add a system call "get_kernel_memory_information".  User programs
28 could engage in a variety of activities and notice leaks by checking
29 the kernel memory statistics.
30
31 ---
32
33 From: "Godmar Back" <godmar@gmail.com>
34 Subject: priority donation tests
35 To: "Ben Pfaff" <blp@cs.stanford.edu>
36 Date: Fri, 3 Mar 2006 11:02:08 -0500
37
38 Ben,
39
40 it seems the priority donation tests are somewhat incomplete and allow
41 incorrect implementations to pass with a perfect score.
42
43 We are seeing the following wrong implementations pass all tests:
44
45 - Implementations that assume locks are released in the opposite order
46 in which they're acquired. The students implement this by
47 popping/pushing on the donation list.
48
49 - Implementations that assume that the priority of a thread waiting on
50 a semaphore or condition variable cannot change between when the
51 thread was blocked and when it is unblocked. The students implement
52 this by doing an insert into an ordered list on block, rather than
53 picking the maximum thread on unblock.
54
55 Neither of these two cases is detected; do you currently check for
56 these mistakes manually?
57
58 I wrote a test that checks for the first case; it is here:
59 http://people.cs.vt.edu/~gback/pintos/priority-donate-multiple-2.patch
60
61 [...]
62
63 I also wrote a test case for the second scenario:
64 http://people.cs.vt.edu/~gback/pintos/priority-donate-sema.c
65 http://people.cs.vt.edu/~gback/pintos/priority-donate-sema.ck
66
67 I put the other tests up here:
68 http://people.cs.vt.edu/~gback/pintos/priority-donate-multiple2.c
69 http://people.cs.vt.edu/~gback/pintos/priority-donate-multiple2.ck
70
71 From: "Godmar Back" <godmar@gmail.com>
72 Subject: multiple threads waking up at same clock tick
73 To: "Ben Pfaff" <blp@cs.stanford.edu>
74 Date: Wed, 1 Mar 2006 08:14:47 -0500
75
76 Greg Benson points out another potential TODO item for P1.
77
78 ----
79 One thing I recall:
80
81 The alarm tests do not test to see if multiple threads are woken up if
82 their timers have expired.  That is, students can write a solution
83 that just wakes up the first thread on the sleep queue rather than
84 check for additional threads.  Of course, the next thread will be
85 woken up on the next tick.  Also, this might be hard to test.
86
87 ---
88 Way to test this: (from Godmar Back)
89
90 Thread A with high priority spins until 'ticks' changes, then calls to
91 timer_sleep(X), Thread B with lower priority is then resumed, calls
92 set_priority to make its priority equal to that of thread A, then
93 calls timer_sleep(X), all of that before the next clock interrupt
94 arrives.
95
96 On wakeup, each thread records wake-up time and calls yield
97 immediately, forcing the scheduler to switch to the other
98 equal-priority thread. Both wake-up times must be the same (and match
99 the planned wake-up time.)
100
101 PS:
102 I actually tested it and it's hard to pass with the current ips setting.
103 The bounds on how quickly a thread would need to be able to return after
104 sleep appear too tight.  Need another idea.
105
106 From: "Godmar Back" <godmar@gmail.com>
107
108 For reasons I don't currently understand, some of our students seem
109 hesitant to include each thread in a second "all-threads" list and are
110 looking for ways to implement the advanced scheduler without one.
111
112 Currently, I believe, all tests for the mlfqs are such that all
113 threads are either ready or sleeping in timer_sleep(). This allows for
114 an incorrect implementation in which recent-cpu and priorities are
115 updated only for those threads that are on the alarm list or the ready
116 list.
117
118 The todo item would be a test where a thread is blocked on a
119 semaphore, lock or condition variable and have its recent_cpu decay to
120 zero, and check that it's scheduled right after the unlock/up/signal.
121
122 From: "Godmar Back" <godmar@gmail.com>
123 Subject: set_priority & donation - a TODO item
124 To: "Ben Pfaff" <blp@cs.stanford.edu>
125 Date: Mon, 20 Feb 2006 22:20:26 -0500
126
127 Ben,
128
129 it seems that there are currently no tests that check the proper
130 behavior of thread_set_priority() when called by a thread that is
131 running under priority donation.  The proper behavior, I assume, is to
132 temporarily drop the donation if the set priority is higher, and to
133 reassume the donation should the thread subsequently set its own
134 priority again to a level that's lower than a still active donation.
135
136  - Godmar
137
138 From: Godmar Back <godmar@gmail.com>
139 Subject: project 4 question/comment regarding caching inode data
140 To: Ben Pfaff <blp@cs.stanford.edu>
141 Date: Sat, 14 Jan 2006 15:59:33 -0500
142
143 Ben,
144
145 in section 6.3.3 in the P4 FAQ, you write:
146
147 "You can store a pointer to inode data in struct inode, if you want,"
148
149 Should you point out that if they indeed do that, they likely wouldn't
150 be able to support more than 64 open inodes systemwide at any given
151 point in time.
152
153 (This seems like a rather strong limitation; do your current tests
154 open more than 64 files?
155 It would also point to an obvious way to make the projects harder by
156 specifically disallowing that inode data be locked in memory during
157 the entire time an inode is kept open.)
158
159  - Godmar
160
161 From: Godmar Back <godmar@gmail.com>
162 Subject: on caching in project 4
163 To: Ben Pfaff <blp@cs.stanford.edu>
164 Date: Mon, 9 Jan 2006 20:58:01 -0500
165
166 here's an idea for future semesters.
167
168 I'm in the middle of project 4, I've started by implementing a buffer
169 cache and plugging it into the existing filesystem.  Along the way I
170 was wondering how we could test the cache.
171
172 Maybe one could adopt a similar testing strategy as in project 1 for
173 the MLQFS scheduler: add a function that reads "get_cache_accesses()"
174 and a function "get_cache_hits()".  Then create a version of pintos
175 that creates access traces for a to-be-determined workload.  Run an
176 off-line analysis that would determine how many hits a perfect cache
177 would have (MAX), and how much say an LRU strategy would give (MIN).
178 Then add a fudge factor to account for different index strategies and
179 test that the reported number of cache hits/accesses is within (MIN,
180 MAX) +/- fudge factor.
181
182 (As an aside - I am curious why you chose to use a clock-style
183 algorithm rather than the more straightforward LRU for your buffer
184 cache implementation in your sample solution. Is there a reason for
185 that?  I was curious to see if it made a difference, so I implemented
186 LRU for your cache implementation and ran the test workload of project
187 4 and printed cache hits/accesses.
188 I found that for that workload, the clock-based algorithm performs
189 almost identical to LRU (within about 1%, but I ran nondeterministally
190 with QEMU). I then reduced the cache size to 32 blocks and found again
191 the same performance, which raises the suspicion that the test
192 workload might not force any cache replacement, so the eviction
193 strategy doesn't matter.)
194
195 Godmar Back <godmar@gmail.com> writes:
196
197 > in your sample solution to P4, dir_reopen does not take any locks when
198 > changing a directory's open_cnt. This looks like a race condition to
199 > me, considering that dir_reopen is called from execute_process without
200 > any filesystem locks held.
201
202 * Get rid of rox--causes more trouble than it's worth
203
204 * Reconsider command line arg style--confuses everyone.
205
206 * Finish writing tour.
207
208 * Introduce a "yield" system call to speed up the syn-* tests.
209
210 via Godmar Back:
211
212 * Get rid of mmap syscall, add sbrk.
213
214 * Make backtrace program accept multiple object file arguments,
215   e.g. add -u option to allow backtracing user program also.
216
217 * page-linear, page-shuffle VM tests do not use enough memory to force
218   eviction.  Should increase memory consumption.
219
220 * Add FS persistence test(s).
221
222 * process_death test needs improvement
223
224 * Internal tests.
225
226 * Improve automatic interpretation of exception messages.
227
228 * Userprog project:
229
230   - Mark read-only pages as actually read-only in the page table.  Or,
231     since this was consistently rated as the easiest project by the
232     students, require them to do it.
233
234   - Don't provide per-process pagedir implementation but only
235     single-process implementation and require students to implement
236     the separation?  This project was rated as the easiest after all.
237     Alternately we could just remove the synchronization on pid
238     selection and check that students fix it.
239
240 * Filesys project:
241
242   - Need a better way to measure performance improvement of buffer
243     cache.  Some students reported that their system was slower with
244     cache--likely, Bochs doesn't simulate a disk with a realistic
245     speed.
246
247 * Documentation:
248
249   - Add "Digging Deeper" sections that describe the nitty-gritty x86
250     details for the benefit of those interested.
251
252   - Add explanations of what "real" OSes do to give students some
253     perspective.
254
255 * Assignments:
256
257   - Add extra credit:
258
259     . Low-level x86 stuff, like paged page tables.
260
261     . Specifics on how to implement sbrk, malloc.
262
263     . Other good ideas.
264
265     . opendir/readdir/closedir
266
267     . everything needed for getcwd()
268
269 To add partition support:
270
271 - Find four partition types that are more or less unused and choose to
272   use them for Pintos.  (This is implemented.)
273
274 - Bootloader reads partition tables of all BIOS devices to find the
275   first that has the "Pintos kernel" partition type.  (This is
276   implemented.)  Ideally the bootloader would make sure there is
277   exactly one such partition, but I didn't implement that yet.
278
279 - Bootloader reads kernel into memory at 1 MB using BIOS calls.  (This
280   is implemented.)
281
282 - Kernel arguments have to go into a separate sector because the
283   bootloader is otherwise too big to fit now?  (I don't recall if I
284   did anything about this.)
285
286 - Kernel at boot also scans partition tables of all the disks it can
287   find to find the ones with the four Pintos partition types (perhaps
288   not all exist).  After that, it makes them available to the rest of
289   the kernel (and doesn't allow access to other devices, for safety).
290
291 - "pintos" and "pintos-mkdisk" need to write a partition table to the
292   disks that they create.  "pintos-mkdisk" will need to take a new
293   parameter specifying the type.  (I might have partially implemented
294   this, don't remember.)
295
296 - "pintos" should insist on finding a partition header on disks handed
297   to it, for safety.
298
299 - Need some way for "pintos" to assemble multiple disks or partitions
300   into a single image that can be copied directly to a USB block
301   device.  (I don't know whether I came up with a good solution yet or
302   not, or whether I implemented any of it.)
303
304 To add USB support:
305
306 - Needs to be able to scan PCI bus for UHCI controller.  (I
307   implemented this partially.)
308
309 - May want to be able to initialize USB controllers over CardBus
310   bridges.  I don't know whether this requires additional work or if
311   it's useful enough to warrant extra work.  (It's of special interest
312   for me because I have a laptop that only has USB via CardBus.)
313
314 - There are many protocol layers involved: SCSI over USB-Mass Storage
315   over USB over UHCI over PCI.  (I may be forgetting one.)  I don't
316   know yet whether it's best to separate the layers or to merge (some
317   of) them.  I think that a simple and clean organization should be a
318   priority.
319
320 - VMware can likely be used for testing because it can expose host USB
321   devices as guest USB devices.  This is safer and more convenient
322   than using real hardware for testing.
323
324 - Should test with a variety of USB keychain devices because there
325   seems to be wide variation among them, especially in the SCSI
326   protocols they support.  Should try to use a "lowest-common
327   denominator" SCSI protocol if any such thing really exists.
328
329 - Might want to add a feature whereby kernel arguments can be given
330   interactively, rather than passed on-disk.  Needs some though.