Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transient Memory Update #1

Closed
wants to merge 76 commits into from
Closed

Transient Memory Update #1

wants to merge 76 commits into from

Conversation

interwq
Copy link
Contributor

@interwq interwq commented Jan 18, 2012

Merged code bases.

forzawq and others added 30 commits April 8, 2011 00:28
Updated git tracking file list for git repo server.
If the dependency chain resolved out to a blocked thread, we wanted to return from
the blocked dependent thread with an error as having a dependency on a blocked
thread does not make sense.  This commit does this.
1) change the assembly to always deal with a cos_stk structure, rather
than the top of the stack.

2) change the stack manager to include a thread id at the end of the
cos_stk structure, and ensure that we are always doing calculations
with sizeof(struct cos_stk).

Next step: save thread ids into the stack.
1) ensure that stacks hold the thread id of a thread using the stack

2) in the stack manager, make sure that we use the sched_block with
dependency support to provide priority inheritance of current thread
causing a stack miss to the the thread holding the stack.

3) take into account thread suspensions wrt the dependencies created.

TODO: 1) if we attempt to make a dependency on a thread that is
waiting for a stack in a component with self-suspended threads, then
we should increase the self-suspension count of the component that
actually has the threads with the self-suspensions...not the one we
are stack missing in.  2) add support in the stack manager/policy to
recognize self-suspension stack usage, and allocate stacks to
components with SRT threads where the components have self-suspensions
with priority to those that do not have self-suspensions.
Changed the period representation of NRT threads in Synthetic
Hierachical home component. Set period to 0 instead of -1 denotes none
real time threads. This solved the problem. Tested PIP with three
threads(high, mid, low).
pre_block more than one time. Ensure each component at least owns one
stack in stack manager.

1) when we try to depend on other thread, we would execute pre_block
which is the same as usual blocking. But we are not sure if we should
be modifing wake_cnt here. Now the problem is if we depend on other
threads more than once, the wake_cnt would be less than 0. We fixed it
by only decreasing wake_cnt if it is greater than 0.

2) Record a number of "empty components" in stack manager. And ensure
the remaining stacks number is at least equal to the number of empty
components. This can ensure each component has at least one stack
quota. Also modified stack policy to ensure enough stacks for time
event component(for temporal stack test).
Manager and Stack Policy to ensure allocating enough stacks to
self-suspension components.

1) Add a self-suspension counter to each component in Stack
Manager. Increase the counter when we can't find any thread to depend
on, which means all threads are self-suspended and this component is
self-suspension related (Not necessary to be where exactly
self-suspension happened).

2) Allow self-suspension over-quota allocation privilege. Will ignore
the quota limit of self-suspension components when granting stacks to
them.

3) Add a new interface to stack manager(detect_self_suspension). It
returns the self-suspension counter of the component, where a positive
value means there is self-suspension and 0 means not. Stack policy
uses this interface to gather information about self-suspension. And
policy ensures enough quota for those components.

4) Fixed a bug: pre_wakeup should be called if a thread is waken up
due to its dependency thread self-suspended.
self-suspension component, we should remove the current thread from
the block list(in stk manager) before we return to obtain a stack.
allocation. Add a over-quota limit(ss_max) to each component and a
global limit in stack manager. Fixed several bugs.
assembly code. Before we have to get the thread ID from memory. Now we
get it from register(eax) directly.
Conflicts:
	src/components/Makefile.comp
	src/components/implementation/pgfault/high_level/Makefile
	src/components/implementation/pgfault/stk_trace/Makefile
	src/components/interface/pgfault/stubs/s_stub.S
	src/kernel/include/shared/cos_config.h
	src/platform/linux/util/Makefile.end
pointer every time. Scheduler now supports nested lock, eg. take
valloc component lock while holding stack manager lock.

1) Stack manager, timed event and lock components use mem_mgr_large
interface as they use valloc and malloc.

2) Add a ncs_held to the thread structure. It keeps the number of
critical sections that are held by the thread.

3) Valloc component uses the lock provided by scheduler rather than
lock component as this can avoid depending on lock component.
create a tmem lib.

1) tmem.h contains all static inline functions and general data
structure.

2) tmem_tk.h declares functions implemented in the tmem lib and
functions need to be implemented in the manager.

3) tmem.c implements functions that need to call manager.

4) specific data structures need to be defined in tmem_conf.h, which
should be placed in the interface dir.
…ess from

grant function. Fixed bugs of cbuf.

1) Interfaces can have DEPENDENCIES in the Makefile. This is useful
for interfaces that depend on other interfaces, eg. cbuf interface
depends on valloc and mem_mgr_large interfaces.

2) Instead of returning the address of a stack, stkmgr just add the
stk into local free-list, and the thread returns from stkmgr and gets
the stack from local free-list. This can unify interfaces and avoid
some race conditions.

3) cbuf uses valloc now. Fixed the bug of object size calculation.
First step cbuf_vect implementation:
      1. When use page_alias, spd can only push out, not pull in
      2. Client needs to push/map its page to cbufmgr
Instead using of STATIC Array, 2 levels vectors are always created through vect_add_id()

TODO:
	1. Data structure in MGR to maintain pages
	2. Add thd_id
Conflicts:
	src/components/implementation/cbuf_c/naive/cbuf.c
	src/components/implementation/other/cbufc_test/cbufc.c
	src/components/include/cbuf.h
	src/components/interface/cbuf_c/cbuf_c.c
  1. All memory allocation/deallocation have been moved to manager side (no asymmetric
     allocation anymore)  -- tested

  2. Data structure spd_cbvect_range (link list) and its operation are implemeted in manager
     to track cbufs mapped bwtween clients and server  -- tested

  3. cbuf2buf (cache_miss and cbuf_retrieve) have been implemented and tested. Curretly, both
     server and client have 2 level structured vectors.   -- tested

  4. cbuf_free (cbuf_delete) is implemented without reference counting. Currently, when onwer's
     cbuf is removed, all mapped cbufs in other spds are also removed  -- testing

  5. PIP implementation is supported. Currently thread id is saved right next to the cbuf meta
     in vector. There are potential race condition when update these values  -- testing

  6. Most part of cbuf manager has been integrated into transient memory scheme,
     but there is no policy and memory pool yet.  -- To be continued
  	share all 2nd level vector
	...
      when the local cache can provide cbufs, they do not have to go back to mgr even when relinquish is set
      when create/delete, both cbufs and slabs info need be updated
2. each cbuf itmem is corresponding to a single page now
3. each cbuf can contain multiple shared memory
interwq and others added 22 commits October 5, 2011 16:55
Conflicts:
	src/components/interface/periodic_wake/stubs/s_stub.S
	src/components/interface/timed_blk/stubs/s_stub.S
estimate concurrency. Included new waking up method from Gabe. But not
used as we found some issues.
Conflicts:
	src/components/implementation/exe_cbuf_synth_hier/exe_cbuf_shrec/exe_cbuf_synth_hier.c
	src/components/interface/cbuf_c/cbuf_c.c
just for test. Remember to modify the number if used on different
machine.
…ound a free item here. Return to the tmem_grant function and try to use this one.
Conflicts:
	src/components/implementation/other/tmem_policy/tmem_policy.c
Best effort threads are going to be added
Conflicts:
	src/components/interface/mem_pool/mem_pool.h
Tmem scripts after merge. Everything works well!

Conflicts:
	src/Makefile.src
	src/components/Makefile.comp
	src/components/implementation/cbuf_c/naive/Makefile
	src/components/implementation/cbuf_c/naive/cbuf.c
	src/components/implementation/mem_mgr/naive/mem_man.c
	src/components/implementation/no_interface/boot/booter.c
	src/components/implementation/no_interface/cbufc_test/Makefile
	src/components/implementation/no_interface/cbufc_test/cbufc.c
	src/components/implementation/other/ping/ping.c
	src/components/implementation/pong/pingpong/pong.c
	src/components/implementation/sched/cos_scheduler.h
	src/components/implementation/stkmgr/naive/stkmgr.c
	src/components/implementation/stkmgr_new/naive/Makefile
	src/components/implementation/timed_blk/timed_evt/Makefile
	src/components/implementation/valloc/simple/Makefile
	src/components/implementation/valloc/simple/valloc.c
	src/components/include/cbuf.h
	src/components/interface/Makefile.subdir
	src/components/interface/cbuf_c/cbuf_c.c
	src/components/interface/lock/stubs/s_stub.S
	src/components/interface/valloc/stubs/s_stub.S
	src/kernel/include/shared/consts.h
	src/kernel/include/shared/cos_config.h
	src/platform/linux/module/modules.order
	src/platform/linux/net/modules.order
	src/platform/linux/util/Makefile.end
Merge branch 'master' of 128.164.157.181:~/master/composite

Conflicts:
	src/components/implementation/sched/cos_scheduler.h
Merge branch 'master' of https://github.com/gparmer/Composite

Conflicts:
	src/platform/linux/util/Makefile.end
	src/platform/linux/util/lpp.sh
@gparmer
Copy link
Collaborator

gparmer commented Jan 18, 2012

Guys, there are a number of small problems with the pull request. Fix these up, and I'll merge:

  1. You remove the symbolic links for components/interface/mem_mgr_large/*. The Makefile, cos_alloc.c, mem_mgr_large.h, and the stub should all be symbolic links to the corresponding files in mem_mgr/. I don't want to duplicate the files.
  2. You killed the .gitignore file. We want that.
  3. You're trying to commit a bunch of binaries: See them following this list. These binaries are present, I think, because you added them at some point.
  4. In src/platform/linux/util/, you have a bunch of Makefile.{backup|bak|last} files that I don't think should be committed.
  5. I wanted to confirm that you have the default policy for tmem management set to "infinite memory"...i.e. components should get what they ask for.

The list of binaries and random files you're trying to commit:
src/components/lib/dietlibc-0.29/bin-i386/diet BIN •••••
src/components/lib/dietlibc-0.29/bin-i386/diet-i BIN •••••
src/components/lib/dietlibc-0.29/bin-i386/dnsd BIN •••••
src/components/lib/dietlibc-0.29/bin-i386/elftrunc BIN •••••
src/components/lib/lwip/cos/.depend

@gparmer gparmer closed this Jan 18, 2012
gparmer added a commit that referenced this pull request Sep 10, 2012
1) Changed cbuf retrieve to pass all relevant data in the cbuf_meta,
   and set the flags according to the characteristics of the specific
   memory.  The client library uses these flags to do sanity checking
   to make sure what it think is tmem is, and what it thinks isn't,
   isn't.

2) Added an additional argument to the cbuf.h operations to denote if
   we are doing the operation on tmem or not.  Functions are provided
   that have this statically set to either 0 or 1, so that constant
   propagation and dead code elimination will optimize the code just
   as if we wrote separate paths.  The cost is that the code is a
   little uglier, and more difficult to follow.  There's no way to
   avoid this, as far as I can see.

3) In the cbuf component, we changed the cbid vector to track
   cos_cbuf_items instead of cbuf_descs.  Additionaly moved the
   pointer to the cbuf_meta structure that used to be in the item,
   into the cbuf_mapping structure so that we can track the cbuf_metas
   for _all_ components the cbuf is mapped into, rather than just the
   owner.

4) Add multiplexing code into cbuf.c to handle tmem and persistent
   cbufs differently.  Initial version of cbufp_grant, cbufp_collect,
   and cbufp_return for mapping a persistent cbuf into an address
   space.
gparmer pushed a commit that referenced this pull request Jul 2, 2015
yzcode pushed a commit to yzcode/composite that referenced this pull request Apr 23, 2018
Ioapic api for multi-core and apicid programming
gparmer pushed a commit that referenced this pull request Feb 25, 2022
gparmer pushed a commit that referenced this pull request Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants