Closed Bug 1171994 Opened 10 years ago Closed 10 years ago

Improve RIL I/O code

Categories

(Firefox OS Graveyard :: RIL, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(tracking-b2g:backlog, firefox42 fixed)

RESOLVED FIXED
FxOS-S3 (24Jul)
tracking-b2g backlog
Tracking Status
firefox42 --- fixed

People

(Reporter: tzimmermann, Assigned: tzimmermann)

References

Details

Attachments

(6 files, 6 obsolete files)

8.91 KB, patch
hsinyi
: review+
Details | Diff | Splinter Review
18.76 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
9.97 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
4.68 KB, patch
hsinyi
: review+
Details | Diff | Splinter Review
10.78 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
13.14 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
The IPC code that transfers messages between RIL worker and I/O thread always sends messages through the main thread. We can probably improve this by transferring messages without the intermediate step.
Depends on: 1172479
It seems to me that the content of Ril.{cpp,h} is more about workers than IPC. Would it make sense to move the code to dom/system/gonk?
Thomas, I don't want to let you down but I will be occupied by product line resource allocation meeting this week. That means, I won't be able to start the review work until next week :( If this is urgent, feel free to ask other peer's review.
I see. But it's not urgent, so next week would also be OK. It's actually hard to find other reviewers for this code. Maybe Kyle can help here as well.
Flags: needinfo?(kyle)
Outside of saying your indentation is off in Patch 1's RilSocket.cpp (function name length changed but multi-line argument indents didn't :) ), I'd like to stay out of this if possible. I'm not on the FxOS team anymore, so the more eyes we can get on this from FxOS members who may be more directly involved, the better.
Flags: needinfo?(kyle)
See Also: → 1173802
Comment on attachment 8616680 [details] [diff] [review] [01] Bug 1171994: Add |RilSocket| and |RilSocketConsumer| Review of attachment 8616680 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me!
Attachment #8616680 - Flags: review?(htsai) → review+
[Tracking Requested - why for this release]:
Comment on attachment 8616681 [details] [diff] [review] [02] Bug 1171994: Forward received RIL socket I/O via |WorkerCrossThreadDispatcher| Review of attachment 8616681 [details] [diff] [review]: ----------------------------------------------------------------- ::: ipc/ril/RilSocket.cpp @@ +206,4 @@ > } > > private: > + RilSocketIO* mIO; Can you explain that why we don't need it to be nsRefPtr?
Comment on attachment 8616684 [details] [diff] [review] [03] Bug 1171994: Separate RIL I/O interfaces Review of attachment 8616684 [details] [diff] [review]: ----------------------------------------------------------------- This part looks good to me.
Attachment #8616684 - Flags: review?(htsai) → review+
Comment on attachment 8616685 [details] [diff] [review] [04] Bug 1171994: Store an instance of |RilWorker| for each RIL connection Review of attachment 8616685 [details] [diff] [review]: ----------------------------------------------------------------- ::: ipc/ril/Ril.h @@ +41,5 @@ > + void UnregisterConsumer(unsigned int aClientId); > + > + static nsTArray<nsAutoPtr<RilWorker>> sRilWorkers; > + > + mozilla::dom::workers::WorkerCrossThreadDispatcher* mDispatcher; Could you explain why this doesn't need to be nsRefPtr?
Hi! (In reply to Hsin-Yi Tsai [:hsinyi] from comment #14) > Comment on attachment 8616681 [details] [diff] [review] > [02] Bug 1171994: Forward received RIL socket I/O via > |WorkerCrossThreadDispatcher| > > Review of attachment 8616681 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: ipc/ril/RilSocket.cpp > @@ +206,4 @@ > > } > > > > private: > > + RilSocketIO* mIO; > > Can you explain that why we don't need it to be nsRefPtr? This field is stored in |ReceiveTask|, which is send from the I/O thread to the consumer thread. Releasing the instance of |mIO| requires closing the socket. The closing is written to only happen *after* all other tasks have been processed, so any |ReceiveTask| would have been processed at this point. New tasks aren't created after the socket has been closed.
> ::: ipc/ril/Ril.h > @@ +41,5 @@ > > + void UnregisterConsumer(unsigned int aClientId); > > + > > + static nsTArray<nsAutoPtr<RilWorker>> sRilWorkers; > > + > > + mozilla::dom::workers::WorkerCrossThreadDispatcher* mDispatcher; > > Could you explain why this doesn't need to be nsRefPtr? Using |nsRefPtr| sounds reasonable. Currently |RilConsumer| holds the reference, but that might lead to problems in some corner cases without an instance of this class. I'll fix the patch.
Comment on attachment 8616681 [details] [diff] [review] [02] Bug 1171994: Forward received RIL socket I/O via |WorkerCrossThreadDispatcher| Review of attachment 8616681 [details] [diff] [review]: ----------------------------------------------------------------- r+ after comment 17, thanks.
Attachment #8616681 - Flags: review?(htsai) → review+
Comment on attachment 8616687 [details] [diff] [review] [05] Bug 1171994: Use |RilSocket| to handle RIL messages on the RIL worker Review of attachment 8616687 [details] [diff] [review]: ----------------------------------------------------------------- ::: ipc/ril/Ril.cpp @@ +353,5 @@ > + } > + > +private: > + unsigned int mClientId; > + WorkerCrossThreadDispatcher* mDispatcher; sorry again, why doesn't this need to be nsRefPtr?
Attachment #8616688 - Flags: review?(htsai) → review+
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #20) > Comment on attachment 8616687 [details] [diff] [review] > [05] Bug 1171994: Use |RilSocket| to handle RIL messages on the RIL worker > > Review of attachment 8616687 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: ipc/ril/Ril.cpp > @@ +353,5 @@ > > + } > > + > > +private: > > + unsigned int mClientId; > > + WorkerCrossThreadDispatcher* mDispatcher; > > sorry again, why doesn't this need to be nsRefPtr? Another case where holding a reference makes sense. Will be fixed in next version. I tried to minimize references to keep the overhead low. In the current code base the clients are registered while the WCTD is around, so all this works without ref-counting. But now that I look at the patches, I can see the corner cases where it might fail. It's probably safer to use ref-counting everywhere.
Changes since v1: - fixed indention
Attachment #8616680 - Attachment is obsolete: true
Attachment #8632666 - Flags: review+
Changes since v1: - hold reference to WCTD in RIL socket classes
Attachment #8616681 - Attachment is obsolete: true
Attachment #8632667 - Flags: review+
Changes since v1: - hold reference to WCTD in RIL worker class
Attachment #8616685 - Attachment is obsolete: true
Attachment #8616685 - Flags: review?(htsai)
Attachment #8632668 - Flags: review?(htsai)
Changes since v1: - hold reference to WCTD in |RegisterConsumerTask|
Attachment #8616687 - Attachment is obsolete: true
Attachment #8616687 - Flags: review?(htsai)
Attachment #8632670 - Flags: review?(htsai)
Changes since v1: - rebased onto latest [01]-[05]
Attachment #8616688 - Attachment is obsolete: true
Attachment #8632671 - Flags: review+
Comment on attachment 8632668 [details] [diff] [review] [04] Bug 1171994: Store an instance of |RilWorker| for each RIL connection (v2) Review of attachment 8632668 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me!
Attachment #8632668 - Flags: review?(htsai) → review+
Comment on attachment 8632670 [details] [diff] [review] [05] Bug 1171994: Use |RilSocket| to handle RIL messages on the RIL worker (v2) Review of attachment 8632670 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for the work, Thomas :)
Attachment #8632670 - Flags: review?(htsai) → review+
Depends on: 1184161
This caused a sanity blocker "Unable to make calls" for Flame and Aries devices, need this backed out ASAP.
Whiteboard: [backout-asap]
Backed out at the request of QA and nightlies respun. https://hg.mozilla.org/mozilla-central/rev/16e30af059b7
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: [backout-asap]
Changes since v2: - store outgoing commands in send queue until connection to rild has been established
Attachment #8632670 - Attachment is obsolete: true
Attachment #8634664 - Flags: review+
Hi Hsinyi, I noticed that the RIL worker starts sending commands to rild before the connection is fully established. So the first few commands got lost and the RIL worker was forever waiting for their responses. While it was trivial to fix, the RIL worker seems fragile when commands get lost. Is there a plan to only start sending after the connection has been established? Or to integrate the socket code more closely into the RIL worker? Once there was bug 760649, but it was closed a few weeks ago.
Flags: needinfo?(htsai)
I'd like to make sure it's also on another module owner, Edgar's radar ;)
Flags: needinfo?(echen)
Blocks: 1191256
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #37) > Hi Hsinyi, > > I noticed that the RIL worker starts sending commands to rild before the > connection is fully established. So the first few commands got lost and the > RIL worker was forever waiting for their responses. > > While it was trivial to fix, the RIL worker seems fragile when commands get > lost. Is there a plan to only start sending after the connection has been > established? Or to integrate the socket code more closely into the RIL > worker? Yes, we could have better handling in ril code. RIL worker now doesn't have too much information about the underlying status. We could expose more information to ril worker and have better handling. I have filed bug 1191256 for this. Thank you. > > Once there was bug 760649, but it was closed a few weeks ago.
Flags: needinfo?(htsai)
Flags: needinfo?(echen)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: