Closed Bug 960894 Opened 10 years ago Closed 10 years ago

Utilize one single RIL worker in DSDS

Categories

(Firefox OS Graveyard :: RIL, defect)

defect
Not set
normal

Tracking

(blocking-b2g:1.3T+, b2g-v1.3T fixed, b2g-v1.4 fixed)

RESOLVED FIXED
blocking-b2g 1.3T+
Tracking Status
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed

People

(Reporter: vicamo, Assigned: vicamo)

References

Details

(Whiteboard: [MemShrink:P1][~2.5MB])

Attachments

(27 files, 42 obsolete files)

102.88 KB, application/zip
Details
101.88 KB, application/zip
Details
6.41 KB, patch
hsinyi
: review+
Details | Diff | Splinter Review
1.25 KB, patch
hsinyi
: review+
Details | Diff | Splinter Review
10.38 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
13.57 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
88.42 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
2.76 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
94.88 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
8.06 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
3.97 KB, patch
bzbarsky
: review+
Details | Diff | Splinter Review
2.62 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
207.56 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
156.56 KB, patch
vicamo
: review+
Details | Diff | Splinter Review
4.73 KB, patch
bzbarsky
: review+
Details | Diff | Splinter Review
6.27 KB, patch
Details | Diff | Splinter Review
10.51 KB, patch
Details | Diff | Splinter Review
2.63 KB, patch
Details | Diff | Splinter Review
13.73 KB, patch
Details | Diff | Splinter Review
92.00 KB, patch
Details | Diff | Splinter Review
2.83 KB, patch
Details | Diff | Splinter Review
93.39 KB, patch
Details | Diff | Splinter Review
8.17 KB, patch
Details | Diff | Splinter Review
1.17 KB, patch
Details | Diff | Splinter Review
152.12 KB, patch
seinlin
: feedback+
fabrice
: feedback+
Details | Diff | Splinter Review
5.67 KB, patch
Details | Diff | Splinter Review
206.74 KB, patch
Details | Diff | Splinter Review
+++ This bug was initially created as a clone of Bug #864927 +++

From bug 864927 comment 9, we'd like to have a research about the possibility to merge multiple ril_workers in DSDS for saving more memory.
Whiteboard: [MemShrink][tarako][~5MB] → [MemShrink][tarako][~2.5MB]
One possible way is to wrap most lines in ril_worker into a huge function.  This way minimizes LOC modified while preserves validness of most xpcshell tests with a few changes.  Worker instantiation in RIL.js and onRILMessage in ril_worker.js have to be modified as well.
This patch basically adds an additional data member in |class DispatchRILEvent|.

|class DispatchRILEvent| will pass the received data to the corresponding worker by calling |onRILMessage|.  Because there may be several RilConsumer instances mapped to one single worker, we need something, the CLIENT_ID, to identify the received data at calling |onRILMessage|.
Assignee: nobody → vyang
Refactor WorkerMessenger and make it RadioInterface-neutral.

WorkerMessenger instances was originally created by RadioInterface.  This patch moves the instantiation into RadioInterfaceLayer instead.  Also introduce a new method |registerClient| to assign CLIENT_ID in the worker global.
Whiteboard: [MemShrink][tarako][~2.5MB] → [MemShrink:P1][tarako][~2.5MB]
Move onRILMessage change (add an additional argument 'clientId') to this part.
Attachment #8362849 - Attachment is obsolete: true
Marionette test cases look fine, have to fix ICC/STK related ones on emulator-jb because they assume there is only one rild.
Add a 'context' property to global helpers, RIL and Buf.  Access each other through, for example, |this.context.RIL|.
Attachment #8363741 - Attachment is obsolete: true
Attachment #8364422 - Flags: review?(htsai)
1) Create one |Context| object for each registered client
2) Define a |ContextPool| object for dispatching messages from chrome and rild, instantiating new contexts upon receiving 'registerClient' messages.
3) Switch CURRENT_CLIENT_ID correctly for printing debug messages.  Note that call paths originated from 'setTimeout' calls have to be handled specially.
Attachment #8364425 - Flags: review?(htsai)
Relatively simple.  Just move WorkerMessenger instantiation outside RadioInterface instantiation loop.
Attachment #8364427 - Flags: review?(htsai)
Attachment #8363665 - Flags: review?(htsai)
Attachment #8363664 - Flags: review?(htsai)
Attachment #8363662 - Flags: review?(htsai)
Attachment #8363661 - Flags: review?(htsai)
Attachment #8363659 - Attachment description: part 2.a/4: move ril_worker init code out of RadioInterfaceLayer ctor : WIP → part 2.a/4: move ril_worker init code out of RadioInterfaceLayer ctor
Attachment #8363659 - Flags: review?(htsai)
Attachment #8363661 - Attachment description: part 2.b/4: allow sharing WorkerMessenger between RadioInterface instances : WIP → part 2.b/4: allow sharing WorkerMessenger between RadioInterface instances
Attachment #8363662 - Attachment description: part 3.a/4: Move PENDING_NETWORK_TYPE into RIL and rename to pendingNetworkType : WIP → part 3.a/4: Move PENDING_NETWORK_TYPE into RIL and rename to pendingNetworkType
Attachment #8363664 - Attachment description: part 3.b/4: don't modify shared global variables after initialized : WIP → part 3.b/4: don't modify shared global variables after initialized
Attachment #8363665 - Attachment description: part 3.c/4: refactor object literals to object ctors : WIP → part 3.c/4: refactor object literals to object ctors
Attached file Emulator-Jellybean-9-SIMS-Merged.zip (obsolete) —
** THIS IS MEMORY-REPORT IS COLLECTED FROM emulator-jb WITH 9 SIM CARDS **

│   ├──5.30 MB (10.46%) -- worker(resource://gre/modules/ril_worker.js, 0x437d4c00)
│   │  ├──1.95 MB (03.85%) -- gc-heap
│   │  │  ├──1.91 MB (03.76%) ── unused-arenas
│   │  │  └──0.05 MB (00.09%) ++ (2 tiny)
│   │  ├──1.77 MB (03.50%) -- runtime
│   │  │  ├──0.94 MB (01.86%) ── script-sources
│   │  │  └──0.83 MB (01.64%) ++ (11 tiny)
│   │  ├──0.98 MB (01.93%) -- zone(0x44873800)
│   │  │  ├──0.65 MB (01.28%) ++ compartment(web-worker)
│   │  │  └──0.33 MB (00.65%) ++ (4 tiny)
│   │  └──0.60 MB (01.18%) ++ (2 tiny)
** THIS IS MEMORY-REPORT IS COLLECTED FROM emulator-jb WITH 9 SIM CARDS **

│  ├───2.88 MB (04.00%) -- worker(resource://gre/modules/ril_worker.js, 0x4486fc00)
│  │   ├──1.66 MB (02.31%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.76 MB (01.06%) ++ (11 tiny)
│  │   └──1.21 MB (01.69%) ++ (4 tiny)
│  ├───2.88 MB (04.00%) -- worker(resource://gre/modules/ril_worker.js, 0x44e17800)
│  │   ├──1.66 MB (02.31%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.76 MB (01.06%) ++ (11 tiny)
│  │   └──1.21 MB (01.69%) ++ (4 tiny)
│  ├───2.88 MB (04.00%) -- worker(resource://gre/modules/ril_worker.js, 0x44e1a000)
│  │   ├──1.66 MB (02.31%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.76 MB (01.06%) ++ (11 tiny)
│  │   └──1.21 MB (01.69%) ++ (4 tiny)
│  ├───2.88 MB (04.00%) -- worker(resource://gre/modules/ril_worker.js, 0x45664400)
│  │   ├──1.66 MB (02.31%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.76 MB (01.06%) ++ (11 tiny)
│  │   └──1.21 MB (01.69%) ++ (4 tiny)
│  ├───2.88 MB (04.00%) -- worker(resource://gre/modules/ril_worker.js, 0x45667c00)
│  │   ├──1.66 MB (02.31%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.76 MB (01.06%) ++ (11 tiny)
│  │   └──1.21 MB (01.69%) ++ (4 tiny)
│  ├───2.88 MB (04.00%) -- worker(resource://gre/modules/ril_worker.js, 0x45f54000)
│  │   ├──1.66 MB (02.31%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.76 MB (01.06%) ++ (11 tiny)
│  │   └──1.21 MB (01.69%) ++ (4 tiny)
│  ├───2.88 MB (04.00%) -- worker(resource://gre/modules/ril_worker.js, 0x45fe1000)
│  │   ├──1.66 MB (02.31%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.76 MB (01.06%) ++ (11 tiny)
│  │   └──1.21 MB (01.69%) ++ (4 tiny)
│  ├───2.87 MB (04.00%) -- worker(resource://gre/modules/ril_worker.js, 0x45fe5800)
│  │   ├──1.66 MB (02.31%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.76 MB (01.06%) ++ (11 tiny)
│  │   └──1.21 MB (01.68%) ++ (4 tiny)
│  ├───2.83 MB (03.94%) -- worker(resource://gre/modules/ril_worker.js, 0x437d4c00)
│  │   ├──1.60 MB (02.23%) -- runtime
│  │   │  ├──0.90 MB (01.25%) ── script-sources
│  │   │  └──0.70 MB (00.97%) ++ (11 tiny)
│  │   └──1.23 MB (01.71%) ++ (4 tiny)
** THIS IS MEMORY-REPORT IS COLLECTED FROM emulator-jb WITH 9 SIM CARDS **

(Diff)

├──-20.52 MB (96.87%) -- workers/workers()/worker(resource://gre/modules/ril_worker.js, 0xNNN)
│  ├──-13.12 MB (61.92%) -- runtime
│  │  ├───-7.15 MB (33.74%) ── script-sources [9]
│  │  ├───-2.56 MB (12.08%) ── script-data [9]
│  │  ├───-1.88 MB (08.85%) -- code
│  │  │   ├──-0.82 MB (03.88%) ── unused [9]
│  │  │   ├──-0.73 MB (03.47%) ── baseline [9]
│  │  │   └──-0.32 MB (01.51%) ── other [9]
│  │  ├───-1.00 MB (04.72%) ── atoms-table [9]
│  │  ├───-0.31 MB (01.47%) ── runtime-object [9]
│  │  └───-0.22 MB (01.06%) ++ (5 tiny)
│  └───-7.41 MB (34.95%) ++ (31 tiny)

Will find a Tarako and re-correct memory-reports on it tomorrow.
Above patches are based on those in bug 960961.
Depends on: 960961
TODO: fix existing xpcshell test cases as part 4.
Re-do with only 2 SIM cards, and invoke get_about_memory.py with --minimize.
Attachment #8364431 - Attachment is obsolete: true
Attached file Emulator-Jellybean-9-SIMS-Merged.zip (obsolete) —
Re-do with only 2 SIM cards, and invoke get_about_memory.py with --minimize.
Attachment #8364430 - Attachment is obsolete: true
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #21)
> Created attachment 8364878 [details]
> Emulator-Jellybean-9-SIMS-Merged.zip
> 
> Re-do with only 2 SIM cards, and invoke get_about_memory.py with --minimize.

can't view the report , with firefox nightly 26

Invalid memory report(s): non-sentence other description: mem/processes/process(\init, pid=1)/other-files/init/[r-xp], /init [r-xp]
Wrong file attached.
Attachment #8364878 - Attachment is obsolete: true
Attachment #8364877 - Attachment description: Emulator-Jellybean-9-SIMS-Separated (original).zip → Emulator-Jellybean-2-SIMS-Separated (original).zip
(In reply to ying.xu from comment #22)
> can't view the report , with firefox nightly 26

26 is not nightly.  It's many-nights-beforely. :)

> Invalid memory report(s): non-sentence other description:
> mem/processes/process(\init, pid=1)/other-files/init/[r-xp], /init [r-xp]

In summary, originally each ril_worker instance takes 2.67MB, and the merged one takes 2.80MB.  2.54MB saved here on emulator-jb with 2 SIM cards.

In that increased ~130KB per instance memory footprint, ~50KB comes from around additional 600 lines of code, ~10KB comes from additional strings, and gc-heap/unused-gc-things account for the remaining ~60KB.
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #17)
> Will find a Tarako and re-correct memory-reports on it tomorrow.

Have to rebase onto v1.3 to have a test on Tarako, and that will take some time...
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #18)
> Above patches are based on those in bug 960961.

And bug 958773 (remove systemlib.js from ril_worker), bug 959503 (follow-up).
Depends on: 958773, 959503
Please help include/test these [v1.3] patches in tarako patch queue.  Thank you!
Attachment #8365818 - Flags: feedback?(kli)
Comment on attachment 8365818 [details] [diff] [review]
[v1.3] 0011-Bug-960894-3.f-4-really-merge-all-RIL-worker-instanc.patch

Danny, I don't have a device, can you help to check and give a feedack? Thanks!
Attachment #8365818 - Flags: feedback?(kli) → feedback?(dliang)
Comment on attachment 8365818 [details] [diff] [review]
[v1.3] 0011-Bug-960894-3.f-4-really-merge-all-RIL-worker-instanc.patch

Patches have been merged/verified on v1.3 and it can save ~1.73MB. We have uploaded patches to tarako patch queue as 0016-Bug-960894-Utilize-one-single-RIL-worker-in-DSDS.patch
Attachment #8365818 - Flags: feedback?(dliang) → feedback+
Comment on attachment 8364425 [details] [diff] [review]
part 3.e/4: multiple contexts in one RIL worker

Review of attachment 8364425 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/system/gonk/ril_worker.js
@@ +14397,5 @@
> +
> +  executeContextJob: function(clientId, func) {
> +    CURRENT_CLIENT_ID = clientId; // push
> +    try {
> +      func.call(this, this.instances[clientId]);

Following warning message keeps popping up when running xpcshell tests.  It happens when RIL (or a test script) tries to register a new client through |ContextPool.registerClient|.  It does not fail the test, but is a sign for my bad taste. :(

  System JS : WARNING /data/local/tests/xpcshell/dom/system/gonk/tests/header_helpers.js -> resource://gre/modules/ril_worker.js:14407 - reference to undefined property this.instances[clientId]
Comment on attachment 8364422 [details] [diff] [review]
part 3.d/4: look up foreign objects through 'this.context'

Review of attachment 8364422 [details] [diff] [review]:
-----------------------------------------------------------------

Missed 'GsmPDUHelper' in |ComprehensionTlvHelper.writeDateTimeZoneTlv()| and |ComprehensionTlvHelper.writeLanguageTlv()|.
Rebase only.
Attachment #8363657 - Attachment is obsolete: true
Rebase only.
Attachment #8363664 - Attachment is obsolete: true
Attachment #8363664 - Flags: review?(htsai)
Attachment #8371358 - Flags: review?(htsai)
Rebase only.
Attachment #8363665 - Attachment is obsolete: true
Attachment #8363665 - Flags: review?(htsai)
Attachment #8371359 - Flags: review?(htsai)
Rebase and address comment 42.
Attachment #8364422 - Attachment is obsolete: true
Attachment #8364422 - Flags: review?(htsai)
Attachment #8371360 - Flags: review?(htsai)
Rebase
Attachment #8364425 - Attachment is obsolete: true
Attachment #8364425 - Flags: review?(htsai)
Attachment #8371362 - Flags: review?(htsai)
Mostly replace |worker.foo| with |worker.ContextPool.instances[0].foo|.

try: https://tbpl.mozilla.org/?tree=Try&rev=65a6f2aede62
Attachment #8371363 - Flags: review?(htsai)
Attachment #8371363 - Flags: review?(allstars.chh)
This patch adds an additional parameter to postRILMessage, which is meant to be called from native code and executed in worker thread.  That additional parameter identifies which context should the message be delivered to.
Attachment #8371357 - Attachment is obsolete: true
Attachment #8372171 - Flags: review?(bzbarsky)
Comment on attachment 8372171 [details] [diff] [review]
part 1/4: allow <1> WorkerCrossThreadDispatcher to <N> RilConsumer

If JS_LookupProperty returns false, calling JS_DefineFunction is not ok.

Also, I assume you're using JS_LookupProperty instead of JS_GetProperty for a reason?  Might be worth documenting.

>+    JS::Value argv[] = {
>+        INT_TO_JSVAL(mClientId),
>+        OBJECT_TO_JSVAL(array)
>+    };

This is a rooting hazard.  Please root the array properly!  We really need to get the static analysis working on b2g.  :(
Attachment #8372171 - Flags: review?(bzbarsky) → review-
Request for 1.3T? so that we can really land to gecko tarako branch.
blocking-b2g: --- → 1.3T?
remove [tarako] since it's marked 1.3T?
Whiteboard: [MemShrink:P1][tarako][~2.5MB] → [MemShrink:P1][~2.5MB]
Comment on attachment 8363659 [details] [diff] [review]
part 2.a/4: move ril_worker init code out of RadioInterfaceLayer ctor

Review of attachment 8363659 [details] [diff] [review]:
-----------------------------------------------------------------

This looks good and deserves r+. I gave f+ because bug 905568, refactored RIL code a little bit, has been landed and I'd like to see the patch rebased again (though I believe no major work for this bug required due to the refactoring).
Attachment #8363659 - Flags: review?(htsai) → feedback+
Comment on attachment 8363661 [details] [diff] [review]
part 2.b/4: allow sharing WorkerMessenger between RadioInterface instances

Review of attachment 8363661 [details] [diff] [review]:
-----------------------------------------------------------------

Same as part 2.a/4.
Attachment #8363661 - Flags: review?(htsai) → feedback+
Attachment #8363662 - Flags: review?(htsai) → review+
Attachment #8371358 - Flags: review?(htsai) → review+
Attachment #8371359 - Flags: review?(htsai) → review+
Comment on attachment 8371360 [details] [diff] [review]
part 3.d/4: look up foreign objects through 'this.context' : v2

Review of attachment 8371360 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks! Hopefully I didn't miss something :)

::: dom/system/gonk/ril_worker.js
@@ +10197,5 @@
>    processEventNotify: function(cmdDetails, ctlvs) {
>      let textMsg = {};
>  
> +    let ctlv = this.context.StkProactiveCmdHelper.searchForTag(
> +        COMPREHENSIONTLV_TAG_ALPHA_ID, ctlvs);

nit: idention

@@ +10344,1 @@
>          COMPREHENSIONTLV_TAG_ALPHA_ID, ctlvs);

nit: indention
Attachment #8371360 - Flags: review?(htsai) → review+
Comment on attachment 8371362 [details] [diff] [review]
part 3.e/4: multiple contexts in one RIL worker : v2

Review of attachment 8371362 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/system/gonk/ril_worker.js
@@ +14385,5 @@
> +  Buf: null,
> +  RIL: null
> +};
> +
> +for (let s of Context.prototype.lazySymbols) {

Let's consider not using for-of due to performance issue. See bug 969231.

@@ +14404,5 @@
> +
> +let ContextPool = {
> +  instances: [],
> +
> +  executeContextJob: function(clientId, func) {

Per our previous discussion, if the reason of having executeContextJob is printing debug messages with clientId, I am in favor of assigning 'clientId' to debug().
Attachment #8371362 - Flags: review?(htsai)
Attachment #8364427 - Flags: review?(htsai) → review+
Hi Boris,

I use LookupProperty because |postRILMessage| should only be defined by this cpp.  It's either undefined or defined as hook to the native function in the same file.  Is there still other risk or difference using LookupProperty here?
Attachment #8372171 - Attachment is obsolete: true
Attachment #8373264 - Flags: feedback?(bzbarsky)
Rebase only
Attachment #8363659 - Attachment is obsolete: true
Attachment #8373267 - Flags: review?(htsai)
Attachment #8363661 - Attachment is obsolete: true
Attachment #8373269 - Flags: review?(htsai)
This part is also affected by bug 905568.  Rebase only.
Attachment #8364427 - Attachment is obsolete: true
Attachment #8373271 - Flags: review?(htsai)
> Is there still other risk or difference using LookupProperty here?

No, it should be fine given that.

However, please see my review comment about it returning false.  If JS_LookupProperty returns false, that means an exception was thrown; this is the normal API contract for JSAPI functions.  So you shouldn't be calling JS_DefineFunction after that; it will just fatally assert that there is a pending exception on the context and that you shouldn't be messing with it.

As a side note, JS_TRUE doesn't exist.

> MOZ_ALWAYS_TRUE(argv.resize(2));

What guarantees that this allocation never fails?
Comment on attachment 8373267 [details] [diff] [review]
part 2.a/4: move ril_worker init code out of RadioInterfaceLayer ctor : v2

Review of attachment 8373267 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!
Attachment #8373267 - Flags: review?(htsai) → review+
Attachment #8373269 - Flags: review?(htsai) → review+
Attachment #8373271 - Flags: review?(htsai) → review+
Attachment #8373999 - Flags: review?(htsai)
Attachment #8374002 - Flags: review?(htsai)
Attachment #8371362 - Attachment is obsolete: true
Attachment #8374003 - Flags: review?(htsai)
Comment on attachment 8373264 [details] [diff] [review]
part 1/4: allow <1> WorkerCrossThreadDispatcher to <N> RilConsumer : v2

Review of attachment 8373264 [details] [diff] [review]:
-----------------------------------------------------------------

::: ipc/ril/Ril.cpp
@@ +189,3 @@
>  
> +    JS::AutoValueVector argv(aCx);
> +    MOZ_ALWAYS_TRUE(argv.resize(2));

Now that JS::AutoValueArray has landed, it would be better to write this instead of the previous two lines:

  JS::AutoValueArray<2> argv(aCx);
(In reply to Boris Zbarsky [:bz] from comment #61)
> However, please see my review comment about it returning false.  If
> JS_LookupProperty returns false, that means an exception was thrown; this is
> the normal API contract for JSAPI functions.  So you shouldn't be calling
> JS_DefineFunction after that; it will just fatally assert that there is a
> pending exception on the context and that you shouldn't be messing with it.

Thank you.  I misunderstood the document.  But it seems JS_GetProperty has the same problem?  Don't know what to do if I got a false value here.  A quick grep tells me most scenarios simply return false/NS_ERROR_* and some of the even return NS_OK or true.

> > MOZ_ALWAYS_TRUE(argv.resize(2));
> 
> What guarantees that this allocation never fails?

Just copied from other files.  I thought that's a convention.

(In reply to Jon Coppeard (:jonco) from comment #66)
> Now that JS::AutoValueArray has landed, it would be better to write this
> instead of the previous two lines:
> 
>   JS::AutoValueArray<2> argv(aCx);

Thank you!
Attachment #8373264 - Flags: feedback?(bzbarsky)
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #67)
> https://tbpl.mozilla.org/?tree=Try&rev=dcf27ec961f0

Fails test_ril_worker_cellbroadcast.js:165, "ril_worker.js:6948 - reference to undefined property this.context".
> Don't know what to do if I got a false value here

You either report the exception or return a failure code to someone who will report the exception, or clear the pending exception off the JSContext.  Which one you want depends on the behavior you want.

What does this code end up doing if the JS_DefineProperty fails?
Attachment #8373999 - Flags: review?(htsai) → review+
Comment on attachment 8374002 [details] [diff] [review]
part 3.d.3/4: use 'this.context.debug'

Review of attachment 8374002 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/system/gonk/ril_worker.js
@@ +4492,5 @@
>      // SEGMENT_NUMBER    | 8
>      // DATAGRAM          | (NUM_FIELDS – 3) * 8
>      let index = 0;
>      if (message.data[index++] !== 0) {
> +     if (DEBUG) this.context.debug("Ignore a WAP Message which is not WDP.");

nit: indention. I know it has existed before. As I see it, I point it out. :)

@@ +4506,5 @@
>        segmentSeq:     message.data[index++] + 1 // It's zero-based in CDMA WAP Push.
>      };
>  
>      if (message.header.segmentSeq > message.header.segmentMaxSeq) {
> +     if (DEBUG) this.context.debug("Wrong WDP segment info.");

ditto.
Attachment #8374002 - Flags: review?(htsai) → review+
Attachment #8374003 - Flags: review?(htsai) → review+
A error occurs when I test the patches locally:

System JS : WARNING /data/local/tests/xpcshell/dom/system/gonk/tests/header_helpers.js -> resource://gre/modules/ril_worker.js:6948 - reference to undefined property this.context
TEST-UNEXPECTED-FAIL | /data/local/tests/xpcshell/dom/system/gonk/tests/header_helpers.js -> resource://gre/modules/ril_worker.js | TypeError: this.context is undefined at /data/local/tests/xpcshell/dom/system/gonk/tests/header_helpers.js -> resource://gre/modules/ril_worker.js:6948 - See following stack:
GsmPDUHelperObject.prototype.readUCS2String@/data/local/tests/xpcshell/dom/system/gonk/tests/header_helpers.js -> resource://gre/modules/ril_worker.js:6948
GsmPDUHelperObject.prototype.readGsmCbData@/data/local/tests/xpcshell/dom/system/gonk/tests/header_helpers.js -> resource://gre/modules/ril_worker.js:8102

Line#8102: msg.body = this.readUCS2String.call(bufAdapter, length);
Line#6948: if (DEBUG) this.context.debug("Read UCS2 string: " + str);
so, this in #6948 isn't GsmPDUHelperObject, bufAdapter instead.

This is a miss in current patches. And I love tests! :)
(In reply to Hsin-Yi Tsai  [:hsinyi] from comment #72)
> A error occurs when I test the patches locally:
> This is a miss in current patches. And I love tests! :)

Yes, I reported in comment 69.  Already fixed in my working branch.
Hi Boris,

The function in concerned is a WorkerTask dispatched to RIL worker thread.  Return value of a WorkerTask::RunTask will then be the return value of nsIRunnable::Run.  The runnable seems to be wrapped by ExternalRunnableWrapper, which checks JS_IsExceptionPending() and Throw() in its own WorkerRun().
Attachment #8373264 - Attachment is obsolete: true
Attachment #8375557 - Flags: feedback?(bzbarsky)
Use camel case.
Attachment #8371358 - Attachment is obsolete: true
Attachment #8375561 - Flags: review+
Attachment #8375559 - Flags: review+
Rebase and use camel case.
Attachment #8371359 - Attachment is obsolete: true
Attachment #8375563 - Flags: review+
Rebase.
Attachment #8371360 - Attachment is obsolete: true
Attachment #8375564 - Flags: review+
Use camel case.
Attachment #8373999 - Attachment is obsolete: true
Attachment #8375566 - Flags: review+
Rebase and address comment 69, 71, 72.
Attachment #8374002 - Attachment is obsolete: true
Attachment #8375567 - Flags: review+
1) Rebase, 2) use camel case, and 3) ename attribute |ContextPool.instances| to |ContextPool._contexts| because it's a private member.
Attachment #8374003 - Attachment is obsolete: true
Attachment #8375573 - Flags: review+
Rename attribute |ContextPool.instances| to |ContextPool._contexts| because it's a private member.
Attachment #8371363 - Attachment is obsolete: true
Attachment #8371363 - Flags: review?(htsai)
Attachment #8371363 - Flags: review?(allstars.chh)
Attachment #8375577 - Flags: review?(htsai)
Attachment #8375577 - Flags: review?(allstars.chh)
Mwn & xpchesll https://tbpl.mozilla.org/?tree=Try&rev=988a73d42805

Again, for m-c git working branch, please see https://github.com/vicamo/b2g_mozilla-central/tree/bugzilla/960894/merge-ril-workers .  Working branch for v1.3t is pretty outdated.  Will only rebase after m-c changes are landed.
Comment on attachment 8375557 [details] [diff] [review]
part 1/4: allow <1> WorkerCrossThreadDispatcher to <N> RilConsumer : v3

I think you just want to JS_ReportPendingException in the failure case.
Attachment #8375557 - Flags: feedback?(bzbarsky) → feedback+
Address feedback comment 84, rebased onto bug 959787.
Attachment #8375557 - Attachment is obsolete: true
Attachment #8376068 - Flags: review?(bzbarsky)
Comment on attachment 8376068 [details] [diff] [review]
part 1/4: allow <1> WorkerCrossThreadDispatcher to <N> RilConsumer : v4

r=me
Attachment #8376068 - Flags: review?(bzbarsky) → review+
Comment on attachment 8375577 [details] [diff] [review]
part 4/4: fix existing test cases for ril worker : v2

Review of attachment 8375577 [details] [diff] [review]:
-----------------------------------------------------------------

I trust the test results! Working with Vicamo's latest WIP.

::: dom/system/gonk/tests/test_ril_worker_icc.js
@@ +1687,1 @@
>                                      [0x0, 0x0C, 0x0, 0x0, 0x0]:

nit: indention

@@ +1687,2 @@
>                                      [0x0, 0x0C, 0x0, 0x0, 0x0]:
>                                      [0x0, 0x00, 0x0, 0x0, 0x0];

ditto.
Attachment #8375577 - Flags: review?(htsai) → review+
(In reply to Hsin-Yi Tsai  [:hsinyi] from comment #87)
> Comment on attachment 8375577 [details] [diff] [review]
> part 4/4: fix existing test cases for ril worker : v2
> nit: indention

Thank you.  Will revise after Yoshi's review.
Attachment #8375577 - Flags: review?(allstars.chh) → review+
NO CHANGE, generated from hg.
Attachment #8363662 - Attachment is obsolete: true
Attachment #8377062 - Flags: review+
Address review comment 87.
Attachment #8375577 - Attachment is obsolete: true
Attachment #8377068 - Flags: review+
blocking-b2g: 1.3T? → 1.3T+
\o/

Vicamo, do you mind uplifting to 1.3t ?
(In reply to Fabrice Desré [:fabrice] from comment #94)
> \o/ Vicamo, do you mind uplifting to 1.3t ?

Already working on it, will update the patches before leaving office.  But I don't have a Tarako at hand now, so I'll see if it's worthy of rebasing yet again to v1.3 branch, with which I can run some test cases on emulator.
Obsolete attachment 8365808 [details] [diff] [review] and 8365809 because they have already been uplifted to v1.3t.

Hi, Boris,

Most js value rooting changes are not included in v1.3t plan, so this part is a little bit different especially in that RunTask function that rooting became an important issue in the review process.  I think I need your review again.

In v1.3t, there is no AutoValueArray.  Instead, I found similar thing called |AutoArrayRooter|.
Attachment #8365807 - Attachment is obsolete: true
Attachment #8365808 - Attachment is obsolete: true
Attachment #8365809 - Attachment is obsolete: true
Attachment #8377600 - Flags: review?(bzbarsky)
Rebase and generate patch with hg only.
Attachment #8365810 - Attachment is obsolete: true
Attachment #8375559 - Attachment is obsolete: false
Attachment #8365811 - Attachment is obsolete: true
Rebase
Attachment #8365816 - Attachment is obsolete: true
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #95)
> (In reply to Fabrice Desré [:fabrice] from comment #94)
> > \o/ Vicamo, do you mind uplifting to 1.3t ?
> 
> Already working on it, will update the patches before leaving office.  But I
> don't have a Tarako at hand now, so I'll see if it's worthy of rebasing yet
> again to v1.3 branch, with which I can run some test cases on emulator.

Verifying with 1.3 emulator.
Don't have a Tarako device.  v1.3 changes look good in emulator.

Danny, mind having another feedback?  I've already rebased the patches in https://github.com/vicamo/b2g_mozilla-central/tree/bugzilla/960894/v1.3t .  You can simply pull it into your working branch.

Fabrice, need your approval to land in v1.3t branch. :)
Attachment #8377674 - Flags: feedback?(fabrice)
Attachment #8377674 - Flags: feedback?(dliang)
Comment on attachment 8377674 [details] [diff] [review]
[v1.3t] part 4/4: fix existing test cases for ril worker

Review of attachment 8377674 [details] [diff] [review]:
-----------------------------------------------------------------

Worked just fine on my tarako!
Attachment #8377674 - Flags: feedback?(fabrice) → feedback+
Attachment #8377674 - Flags: feedback?(dliang) → feedback?(kli)
Comment on attachment 8377674 [details] [diff] [review]
[v1.3t] part 4/4: fix existing test cases for ril worker

Kai-Zhen, please help to veirfy the patch on v1.3t, thanks
Comment on attachment 8377674 [details] [diff] [review]
[v1.3t] part 4/4: fix existing test cases for ril worker

It also works fine on my Tarako, and I can see only one ril worker.

Main Process (pid 83)
Explicit Allocations
31.28 MB (100.0%) -- explicit
├──10.09 MB (32.26%) ++ js-non-window
├───4.96 MB (15.85%) ── heap-unclassified
├───4.69 MB (14.98%) ++ window-objects
├───3.33 MB (10.63%) ++ images
├───2.52 MB (08.05%) ++ heap-overhead
├───2.22 MB (07.11%) ++ workers/workers()/worker(resource://gre/modules/ril_worker.js, 0x4352cc00)
├───1.83 MB (05.85%) ++ (15 tiny)
├───0.88 MB (02.82%) ── xpti-working-set
└───0.77 MB (02.45%) ++ storage/sqlite
Attachment #8377674 - Flags: feedback?(kli) → feedback+
Blocks: 974260
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #95)
> Already working on it, will update the patches before leaving office.  But I
> don't have a Tarako at hand now, so I'll see if it's worthy of rebasing yet
> again to v1.3 branch, with which I can run some test cases on emulator.

Found two little imperfections and filed as bug 974260.  Already addressed in my v1.3 and v1.3t branch last night.
Comment on attachment 8377600 [details] [diff] [review]
[v1.3t] part 1/4: allow <1> WorkerCrossThreadDispatcher to <N> RilConsumer

Er, why is this back to using a Value[] on the stack?
Flags: needinfo?(vyang)
Comment on attachment 8377600 [details] [diff] [review]
[v1.3t] part 1/4: allow <1> WorkerCrossThreadDispatcher to <N> RilConsumer

And in general, interdiffs from the last-reviewed thing would be very much appreciated so I don't have to keep guessing what exactly got changed....
Attachment #8377600 - Flags: review?(bzbarsky)
(In reply to Boris Zbarsky [:bz] (reviews will be slow; ask someone else) from comment #114)
> Er, why is this back to using a Value[] on the stack?

Because there is no such thing named JS::AutoValueArray in v1.3t branch.  All the calls to JS_CallFunctionName are made by pass an JS::Value array.  You can find this by `grep -nR --exclude-dir=.git -B 10 -A 3 JS_CallFunctionName .`.  JS::AutoValueArray is just not yet invented at the time.
Flags: needinfo?(vyang)
OK, so are we talking about a branch backport now, or are we still reviewing patches to land on m-c?
(In reply to Boris Zbarsky [:bz] (reviews will be slow; ask someone else) from comment #118)
> OK, so are we talking about a branch backport now, or are we still reviewing
> patches to land on m-c?

This is the branch backport for b2g 1.3. The reviewed code landed on m-c.
Comment on attachment 8378361 [details] [diff] [review]
[m-c => v1.3t] part 1/4 inter-review patch

This is a diff of diffs, not an interdiff... :(
Attachment #8378361 - Flags: feedback?(bzbarsky)
> This is the branch backport for b2g 1.3.

OK, that would have been _really_ nice to say in the review request.  Would have saved me reading through 100+ comments _again_ trying to figure out why review was being requested on something I had already reviewed....
Comment on attachment 8377600 [details] [diff] [review]
[v1.3t] part 1/4: allow <1> WorkerCrossThreadDispatcher to <N> RilConsumer

r=me for branch
Attachment #8377600 - Flags: review+
Hmm. I guess comment 97 did say that, and I missed it somehow.  My apologies.  :(
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #125)
> https://hg.mozilla.org/releases/mozilla-b2g28_v1_3t/
> pushloghtml?changeset=2c3a2e723892

That landing doesn't classify itself as a 1.4 landing - that's just a 1.3T landing.
This landed on trunk on 2/17 though (comment 93), which puts it in 1.4, no?
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #127)
> This landed on trunk on 2/17 though (comment 93), which puts it in 1.4, no?

Oh right.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: