Skip to content

introduce a context structure to encompass global state in the K64F Storage driver #2121

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

Merged
merged 5 commits into from
Jul 12, 2016
Merged

Conversation

rgrover
Copy link
Contributor

@rgrover rgrover commented Jul 7, 2016

Together with other minor changes.
This will bring the state of the K64F driver to the point where we can submit a fix for the read-while-write issue in isolation.

@simonqhughes

follows from #2117

@rgrover rgrover changed the title update the K64F storage driver to bring in introduce a context structure to encompass global state in the K64F Storage driver Jul 7, 2016
@rgrover
Copy link
Contributor Author

rgrover commented Jul 8, 2016

@simonqhughes could you please confirm that this change set works for you.

@sg- @0xc0170 Please help merge this change. It sets up the stage for the next bit of work around solving the read-while-write issue with K64F

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 11, 2016

@simonqhughes could you please confirm that this change set works for you.

Any update?

It looks fine to me

@simonqhughes
Copy link
Contributor

simonqhughes commented Jul 11, 2016

Hi

Here are the cfstore test results for a flash-journal sync mode build

built as follows:
mbed compile -v --tests -m K64F -t GCC_ARM -DSTORAGE_DRIVER_CONFIG_HARDWARE_MTD_ASYNC_OPS=0 -DDEVICE_STORAGE_CONFIG_HARDWARE_MTD_ASYNC_OPS=0 

excerpt from test results:

mbedgt: test suite report:
+--------------+---------------+-------------------------------------------------------+--------+--------------------+-------------+
| target       | platform_name | test suite                                            | result | elapsed_time (sec) | copy_method |
+--------------+---------------+-------------------------------------------------------+--------+--------------------+-------------+
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-add_del        | OK     | 15.31              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-close          | OK     | 14.06              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-create         | OK     | 18.65              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-dump           | OK     | 13.51              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example1       | OK     | 14.78              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example2       | OK     | 13.87              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example3       | OK     | 14.44              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example4       | OK     | 14.4               | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example5       | OK     | 13.86              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-find           | OK     | 16.01              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-find2          | OK     | 14.18              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-flash          | OK     | 14.3               | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-flash_set      | OK     | 14.59              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-flush          | OK     | 16.88              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-flush2         | OK     | 15.11              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-init           | OK     | 14.31              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-misc           | OK     | 15.76              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-open           | OK     | 18.15              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-read           | OK     | 14.44              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-write          | OK     | 14.42              | shell       |
+--------------+---------------+-------------------------------------------------------+--------+--------------------+-------------+
mbedgt: test case report:

Here are the results for the async case:

built with

mbed compile -v --tests -m K64F -t GCC_ARM

mbedgt: test suite report:
+--------------+---------------+-------------------------------------------------------+--------+--------------------+-------------+
| target       | platform_name | test suite                                            | result | elapsed_time (sec) | copy_method |
+--------------+---------------+-------------------------------------------------------+--------+--------------------+-------------+
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-add_del        | OK     | 15.12              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-close          | OK     | 14.21              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-create         | OK     | 18.26              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-dump           | OK     | 13.48              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example1       | OK     | 14.67              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example2       | OK     | 13.65              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example3       | OK     | 13.97              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example4       | OK     | 13.32              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-example5       | OK     | 13.31              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-find           | OK     | 16.18              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-find2          | OK     | 13.82              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-flash          | OK     | 14.14              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-flash_set      | OK     | 13.51              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-flush          | OK     | 16.52              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-flush2         | OK     | 14.89              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-init           | OK     | 13.72              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-misc           | OK     | 15.57              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-open           | OK     | 17.99              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-read           | OK     | 14.41              | shell       |
| K64F-GCC_ARM | K64F          | mbed-os-features-storage-tests-cfstore-write          | OK     | 14.35              | shell       |
+--------------+---------------+-------------------------------------------------------+--------+--------------------+-------------+
mbedgt: test case report:

@rgrover
Copy link
Contributor Author

rgrover commented Jul 11, 2016

@simonqhughes Could you please elaborate on the failure? I don't expect any of the flash-journal tests would fail as a result of this change. Did this test pass with code prior to this change? Are you mindful of the new CONFIG variable to define START_ADDR and SIZE?

@rgrover
Copy link
Contributor Author

rgrover commented Jul 11, 2016

@simonqhughes submitted #454 to fix tests for the synchronous case. The problem was with the tests, not with the Storage driver.

@simonqhughes
Copy link
Contributor

simonqhughes commented Jul 11, 2016

I understand the failure you mention was caused by an out of date version of the flash-journal basicAPI test, which works when the correct version is used.

{
launchCommand();

/* At this point, The FTFE reads the command code and performs a series of
* parameter checks and protection checks, if applicable, which are unique
* to each command. */

if (asyncOperationsEnabled()) {
/* Asynchronous operation */
#if ASYNC_OPS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain if you have a strong objection. Otherwise let's avoid loosing time over minor disagreements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain if you have a strong objection. Otherwise let's avoid loosing time over minor disagreements.

+1

Not a fan of 14a14a0 but otherwise LGTM

Please provide more details why not a fan and how it could be.

Copy link
Contributor

@sg- sg- Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By authoring a driver you are not in the know of how it will be consumed. By providing 2 methods of operation that are only compile time selectable you cause upstream problems by the consumers of your driver given that multiple consumers may not use the driver in the same way and now you have conflict and nasty failures.

Keep it simple. If you want a sync and async API create both, don't share a common interface and don't make a compile time decision if you support both. Otherwise if there is no consumer for the async API, stash it and remove from the implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having multiple compile-time selectable implementations doesn't automatically result in 'upstream problems'. There could be good reasons why users would want to select between the two kinds of behaviors. As the author, I myself have been one of the users of this driver, and I've found it useful to have this option. I may not know all the ways in which the driver would be used, but I do know that both options I provide have their merit.

I agree that keeping it simple might be a deliberate choice. But letting it remain complex and multi-featured doesn't automatically imply problems.

This disagreement is qualitative.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having multiple compile-time selectable implementations doesn't automatically result in 'upstream problems'.

It does the moment you have one consumer using sync and the other using async in the same program.

@sg-
Copy link
Contributor

sg- commented Jul 11, 2016

Not a fan of 14a14a0 but otherwise LGTM

@0xc0170 0xc0170 merged commit 4b441c9 into ARMmbed:master Jul 12, 2016
@rgrover rgrover deleted the develop branch July 22, 2016 08:01
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