Saturday, July 7, 2018

Fix journalling issue older generation SSD performance in Linux

I found a solution to an issue that has been hampering my development efficiency for months.  The symptom of the problem was any large file I/O operations on my secondary SSD stalled my Linux system.  The drive only contains applications and it is not a working volume.

My initial guess was a failing SSD.   SMART values did not indicate as such.  The drive was only a few years old and was from some obscure brand (PNY).

IO profiling indicated that process [jdb2/sdd1-8] had high IO write wait times while the system was "stalled".  I reproduced the behavior by writing a large random file to the disk.

Fast forward a few hours of research and unsuccessful attempts at modifying filesystem settings.  The solution was to disable journaling for this "previous generation" SSD drive.  It is work noting that the problem does not occur on my "newer generation" Samsung 840 root drive.

Lesson learned?  It would have been nice to "call IT" and have them fix it.  Not much else.  I guess that learned about IO system profiling and file system journalling.  It's time to get back to real work.

# monitor journalling process
sudo iotop -obtqqq | grep "jbd2"

# write large random file
head -c 10G < /dev/urandom > tmp

# disable journaling, need to unmount first
sudo tune2fs -O ^has_journal /dev/sdd1

# drive information
=== START OF INFORMATION SECTION ===
Device Model: SSD2SC120G3LA726B087-327
Firmware Version: 560ABBF0


https://www.harddrivebenchmark.net/hdd.php?hdd=SSD2SC120G3LA726B087-327

Thursday, May 10, 2018

Another Scala Cheatsheet

I recently wrote up a "cheat sheet" for Scala.



You can download a .pdf copy of the file here.

My office is coming together nicely thanks to "decorations" as such.




References

https://alvinalexander.com/downloads/scala/Scala-Cheat-Sheet-devdaily.pdf (75% “copied” from his material)
https://alvinalexander.com/scala/how-to-define-use-partial-functions-in-scala-syntax-examples
http://blog.originate.com/blog/2014/06/15/idiomatic-scala-your-options-do-not-match/ (see: The Ultimate Scala Option Cheat Sheet)

Tuesday, May 8, 2018

Trying to gain traction

Few updates this time. The company is still in "stealth" mode and trying to gain market traction. The target market is quite small, and that is OK. The original business plan calls for developing partnerships with other businesses.  Unfortunately, one potential opportunity is on hold for reasons outside of my control. I have not spent sufficient time on marketing over the past 4-5 months.  This does not mean going out of "stealth" mode.  I expect it will happen before 2019.  Personal cash flow is not yet an issue.  However, I am slowly beginning to look for suitable (i.e., interesting) short-term contracting opportunities.  The timing of the search is arguably premature but I do not have a good sense of what the market for shorter-term contract work is like.  Therefore, some caution is necessary.

I have been updating my gist repository on GitHub several times per week. Check it out here.

Tuesday, April 10, 2018

Using IntelliJ as RocketChip IDE

• Checkout the code according to instructions here.

$ git clone https://github.com/ucb-bar/rocket-chip.git
$ cd rocket-chip
$ git submodule update --init
$ export ROCKET_CHIP=`realpath ./rocket-chip`

• Build and publish FIRRTL, as usual:

$ cd $ROCKET_CHIP/firrtl
$ sbt clean publishLocal

• Verify that Rocket Chip can be compiled outside of IDE:

$ cd $ROCKET_CHIP
$ sbt clean publishLocal

• Wipe existing IDE configuration .idea, if necessary:

$ rm -rf $ROCKET_CHIP/.idea

• Import project into IntelliJ



Navigate to build.sbt, select default settings.

• (Optional) Attempt to compile using sbt, within IntelliJ:


• Rebuild project using IntelliJ



• Now for the secret sauce, write your generator object:

Start with running freechips.rocketchip.groundtest.Generator.



It will fail.  That is good.

Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: Usage: sbt> run TargetDir TopModuleProjectName TopModuleName ConfigProjectName ConfigNameString
at scala.Predef$.require(Predef.scala:224)
at freechips.rocketchip.util.GeneratorApp$class.names(GeneratorUtils.scala:76)
at freechips.rocketchip.groundtest.Generator$.names$lzycompute(Generator.scala:7)
at freechips.rocketchip.groundtest.Generator$.names(Generator.scala:7)
at freechips.rocketchip.groundtest.Generator$.delayedEndpoint$freechips$rocketchip$groundtest$Generator$1(Generator.scala:8)
at freechips.rocketchip.groundtest.Generator$delayedInit$body.apply(Generator.scala:7)

Fixing this is left as an exercise to the reader, but I will provide this simple (and, oh so powerful, tip).



Right click on 'GeneratorApp' from line 'object Generator extends App' and click 'Go To'.  This will bring you the definition of the GeneratorApp trait.

So, why not add a breakpoint and debug yourself?  The process is outside of the scope of this post.

• Tips for advanced users:

I typically do not do work inside the rocket-chip repo.  Similar to the firrtl publishLocal step, I do a publishLocal of rocketchip and import the jar into my project.  My generator function is highly customized.

See the following for more information:

https://github.com/freechipsproject/rocket-chip/pull/1319




Sunday, March 4, 2018

Super! Busy!

I am always working.  It is a good thing and a bad thing.

It took me a long time, but I officially made the Red Hat to Ubuntu switch.  I have been a Red Hat/Fedora user since version 6 (nope, not RHEL 6).  That is nearly twenty years.  Why?  It is nothing against Red Hat.  Ubuntu simply has a stronger community.